Enum SimpleUnit

    • Enum Constant Detail

      • ONE

        public static final SimpleUnit ONE
        A granularity representing one millisecond.
        Since:
        1.0
      • TEN

        public static final SimpleUnit TEN
        A granularity representing ten milliseconds.
        Since:
        1.0
      • HUNDRED

        public static final SimpleUnit HUNDRED
        A granularity representing one hundred milliseconds.
        Since:
        1.0
      • THOUSAND

        public static final SimpleUnit THOUSAND
        A granularity representing one thousand milliseconds.
        Since:
        1.0
      • THOUSAND_TEN

        public static final SimpleUnit THOUSAND_TEN
        A granularity representing ten thousand milliseconds.
        Since:
        1.0
      • THOUSAND_HUNDRED

        public static final SimpleUnit THOUSAND_HUNDRED
        A granularity representing one hundred thousand milliseconds.
        Since:
        1.0
      • MILLION

        public static final SimpleUnit MILLION
        A granularity representing one million milliseconds.
        Since:
        1.0
      • MILLION_TEN

        public static final SimpleUnit MILLION_TEN
        A granularity representing ten million milliseconds.
        Since:
        1.0
      • MILLION_HUNDRED

        public static final SimpleUnit MILLION_HUNDRED
        A granularity representing one hundred million milliseconds.
        Since:
        1.0
      • BILLION

        public static final SimpleUnit BILLION
        A granularity representing one billion milliseconds.
        Since:
        1.0
      • BILLION_TEN

        public static final SimpleUnit BILLION_TEN
        A granularity representing ten billion milliseconds.
        Since:
        1.0
      • BILLION_HUNDRED

        public static final SimpleUnit BILLION_HUNDRED
        A granularity representing one hundred billion milliseconds.
        Since:
        1.0
      • TRILLION

        public static final SimpleUnit TRILLION
        A granularity representing one trillion milliseconds.
        Since:
        1.0
    • Method Detail

      • values

        public static SimpleUnit[] values()
        Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
        for (SimpleUnit c : SimpleUnit.values())
            System.out.println(c);
        
        Returns:
        an array containing the constants of this enum type, in the order they are declared
      • valueOf

        public static SimpleUnit valueOf​(String name)
        Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
        Parameters:
        name - the name of the enum constant to be returned.
        Returns:
        the enum constant with the specified name
        Throws:
        IllegalArgumentException - if this enum type has no constant with the specified name
        NullPointerException - if the argument is null
      • increment

        public long increment​(long time)
        Increments the given number of milliseconds with the milliseconds represented by the enumerator value.
        Parameters:
        time - the time to increment
        Returns:
        the given time plus the milliseconds represented by the value
        Since:
        1.0
      • decrement

        public long decrement​(long time)
        Decrements the given number of milliseconds with the milliseconds represented by the enumerator value.
        Parameters:
        time - the time to increment
        Returns:
        the given time minus the milliseconds represented by the value
        Since:
        1.0
      • truncate

        public long truncate​(long time)
        Truncates the given time point by rounding it down to the nearest multitude of the milliseconds represented by the granularity value. Example: the granularity THOUSAND would adjust the time point 4366 to 4000.
        Parameters:
        time - the time that needs adjustment
        Returns:
        a number of milliseconds that is a multitude of the number of milliseconds represented by the enumerator value and that is still smaller than the given time
        Since:
        1.0
      • getMillis

        public long getMillis()
        Returns the number of milliseconds represented by the granularity.
        Returns:
        number of milliseconds represented by the granularity
        Since:
        1.0
      • addTo

        public <R extends Temporal> R addTo​(R temporal,
                                            long periodToAdd)
        Specified by:
        addTo in interface TemporalUnit