public abstract class TypedUnit<U extends TypedUnit<U>> extends java.lang.Object implements IUnit
IUnit. This construction exists to reduce clutter for
casual users of IUnit, while still providing type safety for internal implementations. (Proposed
"self-variance" extensions to Java, in JDK 9 or beyond, may directly support this with a single
interface.)| Modifier and Type | Class and Description |
|---|---|
static interface |
TypedUnit.UnitSelector<U extends TypedUnit<U>> |
EMPTY_STRING_ARRAY| Constructor and Description |
|---|
TypedUnit() |
| Modifier and Type | Method and Description |
|---|---|
protected abstract ITypedQuantity<U> |
add(long numericalAugend,
LinearUnit addendUnit,
long numericalAddend) |
protected ITypedQuantity<U> |
addPossiblyIntegral(long numericalAugend,
IScalarAffineTransform addendValueTransform,
long numericalAddend) |
protected abstract ITypedQuantity<U> |
floorQuantize(double numericalValue,
ITypedQuantity<LinearUnit> quanta) |
protected abstract ITypedQuantity<U> |
floorQuantize(long numericalValue,
ITypedQuantity<LinearUnit> quanta) |
abstract KindOfQuantity<U> |
getContentType()
Get the kind of quantity of this unit.
|
protected abstract U |
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 abstract java.lang.Class<U> |
getUnitClass()
|
protected abstract java.lang.String |
localizedFormatFor(java.lang.Number numericalValue,
boolean useBreakingSpace,
boolean allowCustomUnit) |
protected abstract java.lang.String |
persistableStringFor(java.lang.Number numericalValue) |
abstract ITypedQuantity<U> |
quantity(double numericalValue)
Create a quantity expressed in this unit and with a numerical quantity value equal to
numericalValue. |
abstract ITypedQuantity<U> |
quantity(long numericalValue)
Create a quantity expressed in this unit and with a numerical quantity value equal to
numericalValue. |
ITypedQuantity<U> |
quantity(java.lang.Number value)
Create a quantity expressed in this unit and with a numerical quantity value equal to
numericalValue. |
protected abstract ITypedQuantity<LinearUnit> |
subtractSame(long numericalMinuend,
U subtrahendUnit,
long numericalSubtrahend) |
IScalarAffineTransform |
valueTransformTo(IUnit targetUnit)
Get a transform for transforming numerical quantity values expressed in this unit to
numerical quantity values expressed in
targetUnit. |
abstract IScalarAffineTransform |
valueTransformTo(U targetUnit)
Get a transform for transforming numerical quantity values expressed in this unit to
numerical quantity values expressed in
targetUnit. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetAltLocalizedNames, getAppendableSuffix, getDeltaUnit, getIdentifier, getLocalizedDescription, getLocalizedSymbol, isLinearprotected abstract java.lang.Class<U> getUnitClass()
protected abstract U getScaledUnit(LinearUnit deltaUnit)
deltaUnit as its delta unit. Linear units will return
deltaUnit.java.lang.IllegalArgumentException - if deltaUnit is of the wrong kind, although linear units are not
guaranteed to verify this herepublic abstract KindOfQuantity<U> getContentType()
IUnitgetContentType in interface IUnitpublic ITypedQuantity<U> quantity(java.lang.Number value)
IUnitnumericalValue.public abstract ITypedQuantity<U> quantity(long numericalValue)
IUnitnumericalValue.public abstract ITypedQuantity<U> quantity(double numericalValue)
IUnitnumericalValue.public IScalarAffineTransform valueTransformTo(IUnit targetUnit)
IUnittargetUnit. This method is typically only used
internally by the quantity implementations.valueTransformTo in interface IUnitpublic abstract IScalarAffineTransform valueTransformTo(U targetUnit)
targetUnit. This method is typically only used
internally by the quantity implementations. Note that this method differs from
valueTransformTo(IUnit) only by stricter typing.java.lang.IllegalArgumentException - if targetUnit is not of the same kind of quantityprotected final ITypedQuantity<U> addPossiblyIntegral(long numericalAugend, IScalarAffineTransform addendValueTransform, long numericalAddend)
protected abstract ITypedQuantity<U> add(long numericalAugend, LinearUnit addendUnit, long numericalAddend)
protected abstract ITypedQuantity<LinearUnit> subtractSame(long numericalMinuend, U subtrahendUnit, long numericalSubtrahend)
protected abstract ITypedQuantity<U> floorQuantize(long numericalValue, ITypedQuantity<LinearUnit> quanta)
protected abstract ITypedQuantity<U> floorQuantize(double numericalValue, ITypedQuantity<LinearUnit> quanta)
protected abstract java.lang.String localizedFormatFor(java.lang.Number numericalValue,
boolean useBreakingSpace,
boolean allowCustomUnit)
protected abstract java.lang.String persistableStringFor(java.lang.Number numericalValue)