Class TimeUnit

java.lang.Object
com.ibm.icu.impl.duration.TimeUnit

public final class TimeUnit extends Object
'Enum' for individual time units. Not an actual enum so that it can be used by Java 1.4.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    (package private) static final long[]
    Approximate, durations for the units independent of the time at which they are measured
    static final TimeUnit
    Represents a day.
    static final TimeUnit
    Represents an hour.
    static final TimeUnit
    Represents a millisecond.
    static final TimeUnit
    Represents a minute.
    static final TimeUnit
    Represents a month.
    (package private) final String
    The name of this unit, a key, not for localization.
    (package private) final byte
    The ordinal of the unit, in order from largest to smallest.
    static final TimeUnit
    Represents a second.
    (package private) static final TimeUnit[]
    The list of units, in order from largest to smallest.
    static final TimeUnit
    Represents a week.
    static final TimeUnit
    Represents a year.
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    private
    TimeUnit(String name, int ordinal)
    Private constructor
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns the next larger time unit, or null if this is the largest.
    int
    Returns the ordinal value of this time unit, largest is 0.
    Returns the next smaller time unit, or null if this is the smallest.
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Field Details

    • name

      final String name
      The name of this unit, a key, not for localization.
    • ordinal

      final byte ordinal
      The ordinal of the unit, in order from largest to smallest.
    • YEAR

      public static final TimeUnit YEAR
      Represents a year.
    • MONTH

      public static final TimeUnit MONTH
      Represents a month.
    • WEEK

      public static final TimeUnit WEEK
      Represents a week.
    • DAY

      public static final TimeUnit DAY
      Represents a day.
    • HOUR

      public static final TimeUnit HOUR
      Represents an hour.
    • MINUTE

      public static final TimeUnit MINUTE
      Represents a minute.
    • SECOND

      public static final TimeUnit SECOND
      Represents a second.
    • MILLISECOND

      public static final TimeUnit MILLISECOND
      Represents a millisecond.
    • units

      static final TimeUnit[] units
      The list of units, in order from largest to smallest.
    • approxDurations

      static final long[] approxDurations
      Approximate, durations for the units independent of the time at which they are measured
  • Constructor Details

    • TimeUnit

      private TimeUnit(String name, int ordinal)
      Private constructor
  • Method Details

    • toString

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

      public TimeUnit larger()
      Returns the next larger time unit, or null if this is the largest.
    • smaller

      public TimeUnit smaller()
      Returns the next smaller time unit, or null if this is the smallest.
    • ordinal

      public int ordinal()
      Returns the ordinal value of this time unit, largest is 0.