|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectvisad.Unit
visad.OffsetUnit
public final class OffsetUnit
A class that represents a scaled unit with an offset.
Constructor Summary | |
---|---|
OffsetUnit(double offset)
Construct an offset, dimensionless unit. |
|
OffsetUnit(double offset,
BaseUnit that)
Construct an offset unit from a base unit. |
|
OffsetUnit(double offset,
BaseUnit that,
java.lang.String identifier)
Construct an offset unit from a base unit and an identifier. |
|
OffsetUnit(double offset,
DerivedUnit that)
Construct an offset unit from a derived unit. |
|
OffsetUnit(double offset,
DerivedUnit that,
java.lang.String identifier)
Construct an offset unit from a derived unit and an identifier. |
|
OffsetUnit(double offset,
OffsetUnit that)
Construct an offset unit from an offset unit. |
|
OffsetUnit(double offset,
OffsetUnit that,
java.lang.String identifier)
Construct an offset unit from an offset unit and an identifier.. |
|
OffsetUnit(double offset,
ScaledUnit that)
Construct an offset unit from a scaled unit. |
|
OffsetUnit(double offset,
ScaledUnit that,
java.lang.String identifier)
Construct an offset unit from a scaled unit and an identifier. |
|
OffsetUnit(double offset,
java.lang.String identifier)
Construct an offset, dimensionless unit with an identifier. |
Method Summary | |
---|---|
Unit |
divide(Unit that)
Divide an offset unit by another unit. |
protected Unit |
divideInto(Unit that)
Divide an offset unit into another unit. |
boolean |
equals(Unit unit)
Indicates if this instance equals a unit. |
Unit |
getAbsoluteUnit()
Gets the absolute unit of this unit. |
java.lang.String |
getDefinition()
Return the definition of this unit. |
boolean |
isConvertible(Unit unit)
Indicate whether this unit is convertible with another unit. |
boolean |
isDimensionless()
Indicates if this instance is dimensionless. |
protected boolean |
isTime()
Indicates if this instance is a unit of time. |
static void |
main(java.lang.String[] args)
Test this class. |
Unit |
multiply(Unit that)
Multiply an offset unit by another unit. |
Unit |
pow(double power)
Raises an offset unit to a power. |
Unit |
pow(int power)
Raises an offset unit to a power. |
protected Unit |
protectedClone(java.lang.String identifier)
Clones this unit, changing the identifier. |
Unit |
root(int root)
Returns the N-th root of this unit. |
double[] |
toThat(double[] values,
Unit that)
Convert values from this unit to another unit. |
float[] |
toThat(float[] values,
Unit that)
Convert values from this unit to another unit. |
double[] |
toThis(double[] values,
Unit that)
Convert values to this unit from another unit. |
float[] |
toThis(float[] values,
Unit that)
Convert values to this unit from another unit. |
Methods inherited from class visad.Unit |
---|
adjustCheckAndCache, canConvert, canConvertArray, clone, convertTuple, convertTuple, copyUnitsArray, getIdentifier, scale, shift, sqrt, toString, toThat, toThis, transformUnits, transformUnits |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public OffsetUnit(double offset)
offset
- The amount of offset.public OffsetUnit(double offset, java.lang.String identifier)
offset
- The amount of offset.identifier
- The name or abbreviation for the cloned unit.
May be null
or empty.public OffsetUnit(double offset, BaseUnit that)
null
.
offset
- The amount of offset.that
- The base unit.public OffsetUnit(double offset, BaseUnit that, java.lang.String identifier)
offset
- The amount of offset.that
- The base unit.identifier
- The name or abbreviation for the cloned unit.
May be null
or empty.public OffsetUnit(double offset, DerivedUnit that)
null
.
offset
- The amount of offset.that
- The derived unit.public OffsetUnit(double offset, DerivedUnit that, java.lang.String identifier)
offset
- The amount of offset.that
- The derived unit.identifier
- The name or abbreviation for the cloned unit.
May be null
or empty.public OffsetUnit(double offset, ScaledUnit that)
null
.
offset
- The amount of offset.that
- The scaled unit.public OffsetUnit(double offset, ScaledUnit that, java.lang.String identifier)
offset
- The amount of offset.that
- The scaled unit.identifier
- The name or abbreviation for the cloned unit.
May be null
or empty.public OffsetUnit(double offset, OffsetUnit that)
null
.
offset
- The amount of offset.that
- The given unit.public OffsetUnit(double offset, OffsetUnit that, java.lang.String identifier)
offset
- The amount of offset.that
- The given unit.identifier
- The name or abbreviation for the cloned unit.
May be null
or empty.Method Detail |
---|
public boolean isDimensionless()
Indicates if this instance is dimensionless. A unit is dimensionless if it is a measure of a dimensionless quantity like angle or concentration. Examples of dimensionless units include radian, degree, steradian, and "g/kg".
isDimensionless
in class Unit
protected boolean isTime()
true
if and only if this instance
is a unit of time.protected Unit protectedClone(java.lang.String identifier)
protectedClone
in class Unit
identifier
- The name or abbreviation for the cloned unit.
May be null
or empty.
public Unit pow(int power)
pow
in class Unit
power
- The power to raise this unit by.
public Unit root(int root) throws java.lang.IllegalArgumentException
root
in class Unit
root
- The root to take (e.g. 2 means square root). May not
be zero.
root
-th root
of this unit.
java.lang.IllegalArgumentException
- The root value is zero or the resulting unit would have
a non-integral unit dimension.public Unit pow(double power)
pow
in class Unit
power
- The power to raise this unit by.
public java.lang.String getDefinition()
getDefinition
in class Unit
public Unit multiply(Unit that) throws UnitException
multiply
in class Unit
that
- The unit with which to multiply this unit.
UnitException
- Can't multiply units.public Unit divide(Unit that) throws UnitException
divide
in class Unit
that
- The unit to divide into this unit.
UnitException
- Can't divide units.protected Unit divideInto(Unit that) throws UnitException
divideInto
in class Unit
that
- The unit to be divide by this unit.
UnitException
- Meaningless operation.public double[] toThis(double[] values, Unit that) throws UnitException
toThis
in class Unit
values
- The values to be converted.that
- The unit of values
.
UnitException
- The units are not convertible.public float[] toThis(float[] values, Unit that) throws UnitException
toThis
in class Unit
values
- The values to be converted.that
- The unit of values
.
UnitException
- The units are not convertible.public double[] toThat(double[] values, Unit that) throws UnitException
toThat
in class Unit
values
- The values to be converted in units of this unit.that
- The unit to which to convert the values.
UnitException
- The units are not convertible.public float[] toThat(float[] values, Unit that) throws UnitException
toThat
in class Unit
values
- The values to be converted in units of this unit.that
- The unit to which to convert the values.
UnitException
- The units are not convertible.public Unit getAbsoluteUnit()
getAbsoluteUnit
in class Unit
public boolean isConvertible(Unit unit)
toThis(...)
/ and
toThat(...)
methods will not throw a UnitException. Unit A
is convertible with unit B if and only if unit B is convertible with unit
A; hence, calling-order is irrelevant.
isConvertible
in class Unit
unit
- The other unit.
public static void main(java.lang.String[] args) throws UnitException
args
- Arguments (ignored).
UnitException
- A problem occurred.public boolean equals(Unit unit)
equals
in class Unit
unit
- The unit.
true
if and only if this instance equals
the unit.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |