Package org.openjdk.jmc.common.unit
Class TimestampUnit
- All Implemented Interfaces:
IUnit
-
Nested Class Summary
Nested classes/interfaces inherited from class org.openjdk.jmc.common.unit.TypedUnit
TypedUnit.UnitSelector<U extends TypedUnit<U>> -
Field Summary
Fields inherited from interface org.openjdk.jmc.common.unit.IUnit
EMPTY_STRING_ARRAY -
Method Summary
Modifier and TypeMethodDescriptionprotected ITypedQuantity<TimestampUnit>add(long numericalAugend, LinearUnit addendUnit, long numericalAddend) booleanprotected ITypedQuantity<TimestampUnit>floorQuantize(double numericalValue, ITypedQuantity<LinearUnit> quanta) protected ITypedQuantity<TimestampUnit>floorQuantize(long numericalValue, ITypedQuantity<LinearUnit> quanta) String[]Get alternate names for content assist matching.getAppendableSuffix(boolean useBreakingSpace) Convenience method for (localized) formatters, to prepend a space toIUnit.getLocalizedSymbol(), if needed.Get the kind of quantity of this unit.Get the unit that the difference between two quantities in this unit will have.Persistable identifier, not to show interactively.In the real world, units are sometimes used ambiguously (like MB).Symbols for units are most often not locale dependent, but there are exceptions (like in French).protected TimestampUnitgetScaledUnit(LinearUnit deltaUnit) Return a unit with the same origin (if absolute) as this unit, but with the givendeltaUnitas its delta unit.protected final Class<TimestampUnit>inthashCode()booleanisLinear()If this unit is linear.protected StringlocalizedFormatFor(Number numericalValue, boolean useBreakingSpace, boolean allowCustomUnit) protected StringpersistableStringFor(Number numericalValue) quantity(double numericalValue) Create a quantity expressed in this unit and with a numerical quantity value equal tonumericalValue.quantity(long numericalValue) Create a quantity expressed in this unit and with a numerical quantity value equal tonumericalValue.Create a quantity expressed in this unit and with a numerical quantity value equal tonumericalValue.protected ITypedQuantity<LinearUnit>subtractSame(long numericalMinuend, TimestampUnit subtrahendUnit, long numericalSubtrahend) toString()valueTransformTo(TimestampUnit targetUnit) Get a transform for transforming numerical quantity values expressed in this unit to numerical quantity values expressed intargetUnit.Methods inherited from class org.openjdk.jmc.common.unit.TypedUnit
addPossiblyIntegral, valueTransformTo
-
Method Details
-
getUnitClass
Description copied from class:TypedUnitGet the typedClassobject of the actualTypedUnitsubclassU. This method is intended to simplify generic code, written inTypedUnit, to go from loosely typed arguments into stricter parameterized arguments.- Specified by:
getUnitClassin classTypedUnit<TimestampUnit>
-
getDeltaUnit
Description copied from interface:IUnitGet the unit that the difference between two quantities in this unit will have. For linear units, this is always the unit itself.- Returns:
- the linear unit in which deltas of this unit is expressed
-
getScaledUnit
Description copied from class:TypedUnitReturn a unit with the same origin (if absolute) as this unit, but with the givendeltaUnitas its delta unit.Linear unitswill returndeltaUnit.- Specified by:
getScaledUnitin classTypedUnit<TimestampUnit>
-
getContentType
Description copied from interface:IUnitGet the kind of quantity of this unit.- Specified by:
getContentTypein interfaceIUnit- Specified by:
getContentTypein classTypedUnit<TimestampUnit>
-
quantity
Description copied from interface:IUnitCreate a quantity expressed in this unit and with a numerical quantity value equal tonumericalValue.- Specified by:
quantityin interfaceIUnit- Overrides:
quantityin classTypedUnit<TimestampUnit>
-
quantity
Description copied from interface:IUnitCreate a quantity expressed in this unit and with a numerical quantity value equal tonumericalValue.- Specified by:
quantityin interfaceIUnit- Specified by:
quantityin classTypedUnit<TimestampUnit>
-
quantity
Description copied from interface:IUnitCreate a quantity expressed in this unit and with a numerical quantity value equal tonumericalValue.- Specified by:
quantityin interfaceIUnit- Specified by:
quantityin classTypedUnit<TimestampUnit>
-
valueTransformTo
Description copied from class:TypedUnitGet a transform for transforming numerical quantity values expressed in this unit to numerical quantity values expressed intargetUnit. This method is typically only used internally by the quantity implementations. Note that this method differs fromTypedUnit.valueTransformTo(IUnit)only by stricter typing.- Specified by:
valueTransformToin classTypedUnit<TimestampUnit>
-
isLinear
public boolean isLinear()Description copied from interface:IUnitIf this unit is linear. That is, if quantities expressed in this unit and in units of the same kind can be added to and subtracted from each other, and the resulting quantity remains of the same kind.- Returns:
trueif and only if the unit is linear
-
add
protected ITypedQuantity<TimestampUnit> add(long numericalAugend, LinearUnit addendUnit, long numericalAddend) - Specified by:
addin classTypedUnit<TimestampUnit>
-
subtractSame
protected ITypedQuantity<LinearUnit> subtractSame(long numericalMinuend, TimestampUnit subtrahendUnit, long numericalSubtrahend) - Specified by:
subtractSamein classTypedUnit<TimestampUnit>
-
floorQuantize
protected ITypedQuantity<TimestampUnit> floorQuantize(long numericalValue, ITypedQuantity<LinearUnit> quanta) - Specified by:
floorQuantizein classTypedUnit<TimestampUnit>
-
floorQuantize
protected ITypedQuantity<TimestampUnit> floorQuantize(double numericalValue, ITypedQuantity<LinearUnit> quanta) - Specified by:
floorQuantizein classTypedUnit<TimestampUnit>
-
toString
-
getIdentifier
Description copied from interface:IUnitPersistable identifier, not to show interactively.- Returns:
- the persistable (locale independent) identifier, or (possibly) null if this unit isn't persistable.
-
getLocalizedSymbol
Description copied from interface:IUnitSymbols for units are most often not locale dependent, but there are exceptions (like in French). Also, besides real persistable units, temporary units are sometimes constructed for display purposes, and they might vary due to internationalization, and conceivably language.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 (
).- Returns:
- the localized symbol of this unit.
-
getAppendableSuffix
Description copied from interface:IUnitConvenience method for (localized) formatters, to prepend a space toIUnit.getLocalizedSymbol(), if needed.- Parameters:
useBreakingSpace- to use breaking space instead of the default, non-breaking space (only for edit)- Returns:
- a localized string to be appended to a number when displaying a quantity (including space, if non-empty).
-
getLocalizedDescription
Description copied from interface:IUnitIn the real world, units are sometimes used ambiguously (like MB). This description is intended to remove such ambiguity where needed.- Returns:
- a (possibly) localized unambiguous description of this unit
-
getAltLocalizedNames
Description copied from interface:IUnitGet alternate names for content assist matching. Note that these should never contain non-breaking spaces, only regular (breaking) spaces.- Returns:
- an array, possibly empty, of names with which to match for content assist, never
null.
-
localizedFormatFor
protected String localizedFormatFor(Number numericalValue, boolean useBreakingSpace, boolean allowCustomUnit) - Specified by:
localizedFormatForin classTypedUnit<TimestampUnit>
-
persistableStringFor
- Specified by:
persistableStringForin classTypedUnit<TimestampUnit>
-
equals
-
hashCode
public int hashCode()
-