Class TimestampUnit

java.lang.Object
org.openjdk.jmc.common.unit.TypedUnit<TimestampUnit>
org.openjdk.jmc.common.unit.TimestampUnit
All Implemented Interfaces:
IUnit

public class TimestampUnit extends TypedUnit<TimestampUnit>
  • Method Details

    • getUnitClass

      protected final Class<TimestampUnit> getUnitClass()
      Description copied from class: TypedUnit
      Get the typed 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.
      Specified by:
      getUnitClass in class TypedUnit<TimestampUnit>
    • getDeltaUnit

      public LinearUnit getDeltaUnit()
      Description copied from interface: IUnit
      Get 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

      protected TimestampUnit getScaledUnit(LinearUnit deltaUnit)
      Description copied from class: TypedUnit
      Return a unit with the same origin (if absolute) as this unit, but with the given deltaUnit as its delta unit. Linear units will return deltaUnit.
      Specified by:
      getScaledUnit in class TypedUnit<TimestampUnit>
    • getContentType

      public KindOfQuantity<TimestampUnit> getContentType()
      Description copied from interface: IUnit
      Get the kind of quantity of this unit.
      Specified by:
      getContentType in interface IUnit
      Specified by:
      getContentType in class TypedUnit<TimestampUnit>
    • quantity

      public ITypedQuantity<TimestampUnit> quantity(Number numericalValue)
      Description copied from interface: IUnit
      Create a quantity expressed in this unit and with a numerical quantity value equal to numericalValue.
      Specified by:
      quantity in interface IUnit
      Overrides:
      quantity in class TypedUnit<TimestampUnit>
    • quantity

      public ITypedQuantity<TimestampUnit> quantity(long numericalValue)
      Description copied from interface: IUnit
      Create a quantity expressed in this unit and with a numerical quantity value equal to numericalValue.
      Specified by:
      quantity in interface IUnit
      Specified by:
      quantity in class TypedUnit<TimestampUnit>
    • quantity

      public ITypedQuantity<TimestampUnit> quantity(double numericalValue)
      Description copied from interface: IUnit
      Create a quantity expressed in this unit and with a numerical quantity value equal to numericalValue.
      Specified by:
      quantity in interface IUnit
      Specified by:
      quantity in class TypedUnit<TimestampUnit>
    • valueTransformTo

      public IScalarAffineTransform valueTransformTo(TimestampUnit targetUnit)
      Description copied from class: TypedUnit
      Get a transform for transforming numerical quantity values expressed in this unit to numerical quantity values expressed in 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.
      Specified by:
      valueTransformTo in class TypedUnit<TimestampUnit>
    • isLinear

      public boolean isLinear()
      Description copied from interface: IUnit
      If 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:
      true if and only if the unit is linear
    • add

      protected ITypedQuantity<TimestampUnit> add(long numericalAugend, LinearUnit addendUnit, long numericalAddend)
      Specified by:
      add in class TypedUnit<TimestampUnit>
    • subtractSame

      protected ITypedQuantity<LinearUnit> subtractSame(long numericalMinuend, TimestampUnit subtrahendUnit, long numericalSubtrahend)
      Specified by:
      subtractSame in class TypedUnit<TimestampUnit>
    • floorQuantize

      protected ITypedQuantity<TimestampUnit> floorQuantize(long numericalValue, ITypedQuantity<LinearUnit> quanta)
      Specified by:
      floorQuantize in class TypedUnit<TimestampUnit>
    • floorQuantize

      protected ITypedQuantity<TimestampUnit> floorQuantize(double numericalValue, ITypedQuantity<LinearUnit> quanta)
      Specified by:
      floorQuantize in class TypedUnit<TimestampUnit>
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • getIdentifier

      public String getIdentifier()
      Description copied from interface: IUnit
      Persistable identifier, not to show interactively.
      Returns:
      the persistable (locale independent) identifier, or (possibly) null if this unit isn't persistable.
    • getLocalizedSymbol

      public String getLocalizedSymbol()
      Description copied from interface: IUnit
      Symbols 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

      public String getAppendableSuffix(boolean useBreakingSpace)
      Description copied from interface: IUnit
      Convenience method for (localized) formatters, to prepend a space to IUnit.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

      public String getLocalizedDescription()
      Description copied from interface: IUnit
      In 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

      public String[] getAltLocalizedNames()
      Description copied from interface: IUnit
      Get 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:
      localizedFormatFor in class TypedUnit<TimestampUnit>
    • persistableStringFor

      protected String persistableStringFor(Number numericalValue)
      Specified by:
      persistableStringFor in class TypedUnit<TimestampUnit>
    • equals

      public boolean equals(Object other)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object