|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectvisad.Unit
visad.ScaledUnit
A class that represents a certain amount of a derived unit.
| Field Summary | |
(package private) double |
amount
The amount of the associated derived unit. |
(package private) DerivedUnit |
derivedUnit
The associated derived unit. |
| Fields inherited from class visad.Unit |
hashCode, hashCodeSet |
| Constructor Summary | |
ScaledUnit(double amount)
Construct a dimensionless scaled unit. |
|
ScaledUnit(double amount,
BaseUnit that)
Construct a scaled unit from a base unit. |
|
ScaledUnit(double amount,
BaseUnit that,
String identifier)
Construct a scaled unit from a base unit and an identifier. |
|
ScaledUnit(double amount,
DerivedUnit that)
Construct a scaled unit from a derived unit. |
|
ScaledUnit(double amount,
DerivedUnit that,
String identifier)
Construct a scaled unit from a derived unit and an identifier. |
|
ScaledUnit(double amount,
ScaledUnit unit)
Construct a scaled unit from a scaled unit. |
|
ScaledUnit(double amount,
ScaledUnit that,
String identifier)
Construct a scaled unit from a scaled unit and an identifier. |
|
ScaledUnit(double amount,
String identifier)
Construct a dimensionless scaled unit with an identifier. |
|
| Method Summary | |
static ScaledUnit |
create(double amount,
Unit unit)
Factory method for creating a scaled unit. |
Unit |
divide(Unit that)
Divides this unit by another unit. |
protected Unit |
divideInto(Unit that)
Divides this unit into another unit. |
boolean |
equals(Unit unit)
Indicates if this instance is equal to a unit. |
String |
getDefinition()
Returns the definition of this unit. |
int |
hashCode()
Returns the hash code of this instance. |
boolean |
isConvertible(Unit unit)
Indicate whether this unit is convertible with another unit. |
boolean |
isDimensionless()
Indicates if this instance is dimensionless. |
static void |
main(String[] args)
Test this class. |
Unit |
multiply(Unit that)
Multiplies this unit by another unit. |
Unit |
pow(double power)
Raises this unit to a power. |
Unit |
pow(int power)
Raises this unit to a power. |
protected Unit |
protectedClone(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. |
double[] |
toThat(double[] values,
Unit that,
boolean copy)
Convert values from this unit to another unit. |
float[] |
toThat(float[] values,
Unit that)
Convert values from this unit to another unit. |
float[] |
toThat(float[] values,
Unit that,
boolean copy)
Convert values from this unit to another unit. |
double[] |
toThis(double[] values,
Unit that)
Convert values to this unit from another unit. |
double[] |
toThis(double[] values,
Unit that,
boolean copy)
Convert values to this unit from another unit. |
float[] |
toThis(float[] values,
Unit that)
Convert values to this unit from another unit. |
float[] |
toThis(float[] values,
Unit that,
boolean copy)
Convert values to this unit from another unit. |
| Methods inherited from class visad.Unit |
adjustCheckAndCache, canConvert, canConvertArray, clone, convertTuple, convertTuple, convertTuple, convertTuple, copyUnitsArray, equals, getAbsoluteUnit, getIdentifier, scale, scale, shift, sqrt, toString, toThat, toThis, transformUnits, transformUnits, transformUnits, transformUnits |
| Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
final double amount
final DerivedUnit derivedUnit
| Constructor Detail |
public ScaledUnit(double amount)
amount - The given amount of this unit.
public ScaledUnit(double amount,
String identifier)
amount - The given amount of this unit.identifier - Name or abbreviation for the unit. May be
null or empty.
public ScaledUnit(double amount,
BaseUnit that)
null.
amount - The given amount of the base unit (e.g. 0.9144 to
create a yard unit if unit represents a
meter).that - The given base unit.
public ScaledUnit(double amount,
BaseUnit that,
String identifier)
amount - The given amount of the base unit (e.g. 0.9144
to create a yard unit if unit
represents a meter).that - The given base unit.identifier - Name or abbreviation for the unit. May be
null or empty.
public ScaledUnit(double amount,
DerivedUnit that)
null.
amount - The given amount of the derived unit (e.g. 0.44704 to
create a mile/hour unit if unit represents
a meter/second.that - The given derived unit.
public ScaledUnit(double amount,
DerivedUnit that,
String identifier)
amount - The given amount of the derived unit
(e.g. 0.44704 to create a mile/hour unit if
unit represents a meter/second.that - The given derived unit.identifier - Name or abbreviation for the unit. May be
null or empty.
public ScaledUnit(double amount,
ScaledUnit unit)
null.
amount - The given amount of the scaled unit (e.g. 3.0 to
create a yard unit if unit represents
a foot.unit - The given scaled unit.
public ScaledUnit(double amount,
ScaledUnit that,
String identifier)
amount - The given amount of the scaled unit (e.g. 3.0
to create a yard unit if unit
represents a foot.that - The given scaled unit.identifier - Name or abbreviation for the unit. May be
null or empty.| Method Detail |
public static ScaledUnit create(double amount,
Unit unit)
throws UnitException
null.
amount - The given amount of the scaled unit (e.g. 3.0 to
create a yard unit if unit represents
a foot.unit - The given unit.
UnitException - Can't create Scaled Unit from unit.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 Unitprotected Unit protectedClone(String identifier)
protectedClone in class Unitidentifier - The name or abbreviation for the cloned unit.
May be null or empty.
public Unit pow(int power)
pow in class Unitpower - The power to raise this unit by.
power.
public Unit root(int root)
throws IllegalArgumentException
root in class Unitroot - The root to take (e.g. 2 means square root). May not
be zero.
root-th root
of this unit.
IllegalArgumentException - The root value is zero or the resulting unit would have
a non-integral unit dimension.
public Unit pow(double power)
throws IllegalArgumentException
pow in class Unitpower - The power to raise this unit by. If this unit is
not dimensionless, then the value must be integral.
power.
IllegalArgumentException - This unit is not dimensionless and power
has a non-integral value.public String getDefinition()
getDefinition in class Unit
public Unit multiply(Unit that)
throws UnitException
multiply in class Unitthat - The unit with which to multiply this unit.
UnitException - Meaningless operation.
public Unit divide(Unit that)
throws UnitException
divide in class Unitthat - The unit to divide into this unit.
UnitException - Meaningless operation.
protected Unit divideInto(Unit that)
throws UnitException
divideInto in class Unitthat - The unit to be divided by this unit.
UnitException - Meaningless operation.
public double[] toThis(double[] values,
Unit that)
throws UnitException
toThis in class Unitvalues - 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 Unitvalues - The values to be converted.that - The unit of values.
UnitException - The units are not convertible.
public double[] toThis(double[] values,
Unit that,
boolean copy)
throws UnitException
toThis in class Unitvalues - The values to be converted.that - The unit of values.copy - if false and that equals this,
return values, else return a new array
UnitException - The units are not convertible.
public float[] toThis(float[] values,
Unit that,
boolean copy)
throws UnitException
toThis in class Unitvalues - The values to be converted.that - The unit of values.copy - if false and that equals this,
return values, else return a new array
UnitException - The units are not convertible.
public double[] toThat(double[] values,
Unit that)
throws UnitException
toThat in class Unitvalues - 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 Unitvalues - 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 double[] toThat(double[] values,
Unit that,
boolean copy)
throws UnitException
toThat in class Unitvalues - The values to be converted in units of this unit.that - The unit to which to convert the values.copy - if false and that equals this,
return values, else return a new array
UnitException - The units are not convertible.
public float[] toThat(float[] values,
Unit that,
boolean copy)
throws UnitException
toThat in class Unitvalues - The values to be converted in units of this unit.that - The unit to which to convert the values.copy - if false and that equals this,
return values, else return a new array
UnitException - The units are not convertible.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 Unitunit - The other unit.
public static void main(String[] args)
throws UnitException
args - Arguments (ignored).
UnitException - A problem occurred.public boolean equals(Unit unit)
equals in class Unitunit - The unit.
true if and only if this instance
equals the unit.public int hashCode()
Object.hashCode() should be
overridden whenever Object.equals(Object) is.
hashCode in class Unit
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||