public class TimestampUnit extends TypedUnit<TimestampUnit>
TypedUnit.UnitSelector<U extends TypedUnit<U>>
Modifier and Type | Field and Description |
---|---|
private LinearUnit |
timeOffsetUnit |
private java.util.concurrent.atomic.AtomicReference<java.lang.String> |
unitDescriptionRef |
private java.lang.String |
unitId |
EMPTY_STRING_ARRAY
Constructor and Description |
---|
TimestampUnit(LinearUnit timeOffsetUnit) |
Modifier and Type | Method and Description |
---|---|
protected ITypedQuantity<TimestampUnit> |
add(long numericalAugend,
LinearUnit addendUnit,
long numericalAddend) |
boolean |
equals(java.lang.Object other) |
protected ITypedQuantity<TimestampUnit> |
floorQuantize(double numericalValue,
ITypedQuantity<LinearUnit> quanta) |
protected ITypedQuantity<TimestampUnit> |
floorQuantize(long numericalValue,
ITypedQuantity<LinearUnit> quanta) |
private long |
floorValueIn(long numericalValue,
TimestampUnit targetUnit) |
java.lang.String[] |
getAltLocalizedNames()
Get alternate names for content assist matching.
|
java.lang.String |
getAppendableSuffix(boolean useBreakingSpace)
Convenience method for (localized) formatters, to prepend a space to
IUnit.getLocalizedSymbol() , if needed. |
KindOfQuantity<TimestampUnit> |
getContentType()
Get the kind of quantity of this unit.
|
LinearUnit |
getDeltaUnit()
Get the unit that the difference between two quantities in this unit will have.
|
java.lang.String |
getIdentifier()
Persistable identifier, not to show interactively.
|
java.lang.String |
getLocalizedDescription()
In the real world, units are sometimes used ambiguously (like MB).
|
java.lang.String |
getLocalizedSymbol()
Symbols for units are most often not locale dependent, but there are exceptions (like in
French).
|
protected TimestampUnit |
getScaledUnit(LinearUnit deltaUnit)
Return a unit with the same origin (if absolute) as this unit, but with the given
deltaUnit as its delta unit. |
protected java.lang.Class<TimestampUnit> |
getUnitClass()
|
int |
hashCode() |
boolean |
isLinear()
If this unit is linear.
|
protected java.lang.String |
localizedFormatFor(java.lang.Number numericalValue,
boolean useBreakingSpace,
boolean allowCustomUnit) |
protected java.lang.String |
persistableStringFor(java.lang.Number numericalValue) |
ITypedQuantity<TimestampUnit> |
quantity(double numericalValue)
Create a quantity expressed in this unit and with a numerical quantity value equal to
numericalValue . |
ITypedQuantity<TimestampUnit> |
quantity(long numericalValue)
Create a quantity expressed in this unit and with a numerical quantity value equal to
numericalValue . |
ITypedQuantity<TimestampUnit> |
quantity(java.lang.Number numericalValue)
Create a quantity expressed in this unit and with a numerical quantity value equal to
numericalValue . |
protected ITypedQuantity<LinearUnit> |
subtractSame(long numericalMinuend,
TimestampUnit subtrahendUnit,
long numericalSubtrahend) |
java.lang.String |
toString() |
IScalarAffineTransform |
valueTransformTo(TimestampUnit targetUnit)
Get a transform for transforming numerical quantity values expressed in this unit to
numerical quantity values expressed in
targetUnit . |
addPossiblyIntegral, valueTransformTo
private final LinearUnit timeOffsetUnit
private final java.lang.String unitId
private final java.util.concurrent.atomic.AtomicReference<java.lang.String> unitDescriptionRef
TimestampUnit(LinearUnit timeOffsetUnit)
protected final java.lang.Class<TimestampUnit> getUnitClass()
TypedUnit
Class
object of the actual TypedUnit
subclass U
. This
method is intended to simplify generic code, written in TypedUnit
, to go from loosely
typed arguments into stricter parameterized arguments.getUnitClass
in class TypedUnit<TimestampUnit>
public LinearUnit getDeltaUnit()
IUnit
protected TimestampUnit getScaledUnit(LinearUnit deltaUnit)
TypedUnit
deltaUnit
as its delta unit. Linear units
will return
deltaUnit
.getScaledUnit
in class TypedUnit<TimestampUnit>
public KindOfQuantity<TimestampUnit> getContentType()
IUnit
getContentType
in interface IUnit
getContentType
in class TypedUnit<TimestampUnit>
public ITypedQuantity<TimestampUnit> quantity(java.lang.Number numericalValue)
IUnit
numericalValue
.quantity
in interface IUnit
quantity
in class TypedUnit<TimestampUnit>
public ITypedQuantity<TimestampUnit> quantity(long numericalValue)
IUnit
numericalValue
.quantity
in interface IUnit
quantity
in class TypedUnit<TimestampUnit>
public ITypedQuantity<TimestampUnit> quantity(double numericalValue)
IUnit
numericalValue
.quantity
in interface IUnit
quantity
in class TypedUnit<TimestampUnit>
public IScalarAffineTransform valueTransformTo(TimestampUnit targetUnit)
TypedUnit
targetUnit
. This method is typically only used
internally by the quantity implementations. Note that this method differs from
TypedUnit.valueTransformTo(IUnit)
only by stricter typing.valueTransformTo
in class TypedUnit<TimestampUnit>
public boolean isLinear()
IUnit
true
if and only if the unit is linearprotected ITypedQuantity<TimestampUnit> add(long numericalAugend, LinearUnit addendUnit, long numericalAddend)
add
in class TypedUnit<TimestampUnit>
protected ITypedQuantity<LinearUnit> subtractSame(long numericalMinuend, TimestampUnit subtrahendUnit, long numericalSubtrahend)
subtractSame
in class TypedUnit<TimestampUnit>
protected ITypedQuantity<TimestampUnit> floorQuantize(long numericalValue, ITypedQuantity<LinearUnit> quanta)
floorQuantize
in class TypedUnit<TimestampUnit>
protected ITypedQuantity<TimestampUnit> floorQuantize(double numericalValue, ITypedQuantity<LinearUnit> quanta)
floorQuantize
in class TypedUnit<TimestampUnit>
public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String getIdentifier()
IUnit
public java.lang.String getLocalizedSymbol()
IUnit
While symbols normally don't contain any white space, spacing occur in circumstances like
custom units. In this case, it is important that they are non-breaking spaces
(
).
public java.lang.String getAppendableSuffix(boolean useBreakingSpace)
IUnit
IUnit.getLocalizedSymbol()
, if needed.useBreakingSpace
- to use breaking space instead of the default, non-breaking space (only for edit)public java.lang.String getLocalizedDescription()
IUnit
public java.lang.String[] getAltLocalizedNames()
IUnit
null
.private long floorValueIn(long numericalValue, TimestampUnit targetUnit)
protected java.lang.String localizedFormatFor(java.lang.Number numericalValue, boolean useBreakingSpace, boolean allowCustomUnit)
localizedFormatFor
in class TypedUnit<TimestampUnit>
protected java.lang.String persistableStringFor(java.lang.Number numericalValue)
persistableStringFor
in class TypedUnit<TimestampUnit>
public boolean equals(java.lang.Object other)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object