@Immutable public final class TimeScaleUnit extends UnitImpl
| Modifier and Type | Class and Description |
|---|---|
protected static class |
TimeScaleUnit.MyConverter
Provides support for Converter-s.
|
| Constructor and Description |
|---|
TimeScaleUnit(Unit unit,
java.util.Date origin)
Constructs from a reference unit and a time origin.
|
TimeScaleUnit(Unit unit,
java.util.Date origin,
UnitName id)
Constructs from a reference unit, a time origin, 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.
|
java.lang.String |
getCanonicalString()
Returns the canonical string representation of the unit.
|
Converter |
getConverterTo(Unit outputUnit)
Returns a Converter for converting numeric values from this unit to
another unit.
|
DerivedUnit |
getDerivedUnit()
Returns the derived unit underlying the reference time unit.
|
java.util.Date |
getOrigin()
Returns the time origin.
|
Unit |
getUnit()
Returns the reference unit.
|
int |
hashCode()
Returns the hash code of this instance.
|
boolean |
isCompatible(Unit that)
Indicates if numeric values in this unit are convertible to another unit.
|
boolean |
isDimensionless()
Indicates if this unit is dimensionless.
|
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.
|
Unit |
shiftTo(java.util.Date origin)
Returns a unit identical to this instance but whose origin (i.e., zero
value) has been shifted to the given time.
|
Unit |
shiftTo(double origin)
Returns a unit identical to this instance but whose origin (i.e., zero
value) has been shifted to the given value.
|
java.lang.String |
toString()
Returns the string representation of this unit.
|
convertTo, convertTo, convertTo, convertTo, convertTo, convertTo, divideBy, divideInto, getName, getPlural, getSymbol, getUnitName, log, makeLabel, multiplyBy, multiplyBy, raiseTopublic TimeScaleUnit(Unit unit, java.util.Date origin) throws BadUnitException, UnitSystemException
unit - The reference time unit.origin - The time origin.BadUnitException - unit is not a unit of time.UnitSystemExceptionpublic TimeScaleUnit(Unit unit, java.util.Date origin, UnitName id) throws BadUnitException, UnitSystemException
unit - The reference time unit.origin - The time origin.id - The identifier.BadUnitException - unit is not a unit of time.UnitSystemExceptionpublic Unit getUnit()
public java.util.Date getOrigin()
public Unit clone(UnitName id)
id - The new identifier.public Unit shiftTo(double origin) throws ShiftException
UnitdegK
is a Kelvin unit, then degK.shiftTo(273.15) is a Celsius unit.shiftTo in interface UnitshiftTo in class UnitImplorigin - The new origin in units of this instance.origin of this instance.ShiftException - if the corresponding new unit can't be created.public Unit shiftTo(java.util.Date origin) throws ShiftException
Unitsec is
a second unit, then sec.shiftTo(new Date(0L) is the unit
corresponding to seconds since the epoch (1970-01-01 00:00:00 UTC).shiftTo in interface UnitshiftTo in class UnitImplorigin - The new origin.origin.ShiftException - if the corresponding new unit can't be created. For example,
if this instance isn't a unit of time.protected Unit myMultiplyBy(Unit that) throws MultiplyException
myMultiplyBy in class UnitImplthat - The other unit.MultiplyException - Illegal operation. Always thrown.protected Unit myDivideBy(Unit that) throws DivideException
myDivideBy in class UnitImplthat - The other unit.DivideException - Illegal operation. Always thrown.protected Unit myDivideInto(Unit that) throws DivideException
myDivideInto in class UnitImplthat - The other unit.DivideException - Illegal operation. Always thrown.protected Unit myRaiseTo(int power) throws RaiseException
myRaiseTo in class UnitImplpower - The power.RaiseException - Illegal operation. Always thrown.public DerivedUnit getDerivedUnit()
public Converter getConverterTo(Unit outputUnit) throws ConversionException
getConverterTo in interface UnitgetConverterTo in class UnitImploutputUnit - The other unit. Shall be a TimeScaleUnit.ConversionException - outputUnit is not a TimeScaleUnit.public final boolean isCompatible(Unit that)
isCompatible in interface UnitisCompatible in class UnitImplthat - The other unit.true if and only if numeric values in this unit are
convertible to
that.public boolean equals(java.lang.Object object)
public int hashCode()
public boolean isDimensionless()
false.public java.lang.String toString()
public java.lang.String getCanonicalString()