@Immutable public final class ScaledUnit extends UnitImpl implements DerivableUnit
UnitImpl.MyConverter| Constructor and Description |
|---|
ScaledUnit(double scale)
Constructs from a multiplicative factor.
|
ScaledUnit(double scale,
Unit unit)
Constructs from a multiplicative factor and a reference unit.
|
ScaledUnit(double scale,
Unit unit,
UnitName id)
Constructs from a multiplicative factor, a reference unit, and an
identifier.
|
| Modifier and Type | Method and Description |
|---|---|
Unit |
clone(UnitName id)
Clones this unit, changing the identifier.
|
boolean |
equals(java.lang.Object object)
Indicates if this unit is semantically identical to an object.
|
double |
fromDerivedUnit(double amount)
Converts a numeric value from the underlying derived unit to this unit.
|
double[] |
fromDerivedUnit(double[] input,
double[] output)
Converts numeric values from the underlying derived unit to this unit.
|
float |
fromDerivedUnit(float amount)
Converts a numeric value from the underlying derived unit to this unit.
|
float[] |
fromDerivedUnit(float[] input,
float[] output)
Converts numeric values from the underlying derived unit to this unit.
|
java.lang.String |
getCanonicalString()
Returns the canonical string representation of the unit.
|
DerivedUnit |
getDerivedUnit()
Gets the derived unit underlying this unit.
|
double |
getScale()
Returns the multiplicative factor.
|
Unit |
getUnit()
Returns the reference unit.
|
int |
hashCode()
Returns the hash code of this instance.
|
boolean |
isDimensionless()
Indicates if this unit is dimensionless.
|
Unit |
multiplyBy(double scale)
Multiplies this unit by a scale factor.
|
protected Unit |
myDivideBy(Unit that)
Divides this unit by another unit.
|
protected Unit |
myDivideInto(Unit that)
Divides this unit into another unit.
|
protected Unit |
myMultiplyBy(Unit that)
Multiplies this unit by another unit.
|
protected Unit |
myRaiseTo(int power)
Raises this unit to a power.
|
double |
toDerivedUnit(double amount)
Converts a numeric value from this unit to the underlying derived unit.
|
double[] |
toDerivedUnit(double[] input,
double[] output)
Converts numeric values from this unit to the underlying derived unit.
|
float |
toDerivedUnit(float amount)
Converts a numeric value from this unit to the underlying derived unit.
|
float[] |
toDerivedUnit(float[] input,
float[] output)
Converts numeric values from this unit to the underlying derived unit.
|
java.lang.String |
toString()
Returns the string representation of this unit.
|
convertTo, convertTo, convertTo, convertTo, convertTo, convertTo, divideBy, divideInto, getConverterTo, getName, getPlural, getSymbol, getUnitName, isCompatible, log, makeLabel, multiplyBy, raiseTo, shiftTo, shiftTopublic ScaledUnit(double scale)
scale - The multiplicative factor.public ScaledUnit(double scale,
Unit unit)
scale - The multiplicative factor.unit - The reference unit.public double getScale()
public Unit getUnit()
public Unit multiplyBy(double scale) throws MultiplyException
Unitm is a
meter unit, then m.multiplyBy(1e-2) returns a centimeter unit.multiplyBy in interface UnitmultiplyBy in class UnitImplscale - The scale factor.MultiplyException - if scale is zero.protected Unit myMultiplyBy(Unit that) throws MultiplyException
myMultiplyBy in class UnitImplthat - The other unit.MultiplyException - Can't multiply these units together.protected Unit myDivideBy(Unit that) throws OperationException
myDivideBy in class UnitImplthat - The other unit.OperationException - Can't divide these units.protected Unit myDivideInto(Unit that) throws OperationException
myDivideInto in class UnitImplthat - The other unit.OperationException - Can't divide these units.protected Unit myRaiseTo(int power) throws RaiseException
myRaiseTo in class UnitImplpower - The power.RaiseException - Can't raise this unit to a power.public DerivedUnit getDerivedUnit()
getDerivedUnit in interface DerivableUnitgetDerivedUnit in interface Unitpublic float toDerivedUnit(float amount)
throws ConversionException
toDerivedUnit in interface DerivableUnitamount - The numeric value in this unit.ConversionException - Can't convert value to the underlying derived unit.public double toDerivedUnit(double amount)
throws ConversionException
toDerivedUnit in interface DerivableUnitamount - The numeric value in this unit.ConversionException - Can't convert value to the underlying derived unit.public float[] toDerivedUnit(float[] input,
float[] output)
throws ConversionException
toDerivedUnit in interface DerivableUnitinput - The numeric values in this unit.output - The equivalent values in the underlying derived unit.output.ConversionException - Can't convert values to the underlying derived unit.public double[] toDerivedUnit(double[] input,
double[] output)
throws ConversionException
toDerivedUnit in interface DerivableUnitinput - The numeric values in this unit.output - The equivalent values in the underlying derived unit.output.ConversionException - Can't convert values to the underlying derived unit.public float fromDerivedUnit(float amount)
throws ConversionException
fromDerivedUnit in interface DerivableUnitamount - The numeric value in the underlying derived unit.ConversionException - Can't convert value.public double fromDerivedUnit(double amount)
throws ConversionException
fromDerivedUnit in interface DerivableUnitamount - The numeric value in the underlying derived unit.ConversionException - Can't convert value.public float[] fromDerivedUnit(float[] input,
float[] output)
throws ConversionException
fromDerivedUnit in interface DerivableUnitinput - The numeric values in the underlying derived unit.output - The equivalent values in this unit.output.ConversionException - Can't convert values.public double[] fromDerivedUnit(double[] input,
double[] output)
throws ConversionException
fromDerivedUnit in interface DerivableUnitinput - The numeric values in the underlying derived unit.output - The equivalent values in this unit.output.ConversionException - Can't convert values.public boolean equals(java.lang.Object object)
public int hashCode()
public boolean isDimensionless()
isDimensionless in interface Unittrue if and only if this unit is dimensionless.public java.lang.String toString()
public java.lang.String getCanonicalString()
getCanonicalString in interface Unit