Enum TimeValueConfig

    • Field Detail

      • loChar

        private final char loChar
      • hiChar

        private final char hiChar
      • interval

        private final long interval
    • Constructor Detail

      • TimeValueConfig

        private TimeValueConfig​(char lo,
                                char hi,
                                long interval)
    • Method Detail

      • values

        public static TimeValueConfig[] 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 (TimeValueConfig c : TimeValueConfig.values())
            System.out.println(c);
        
        Returns:
        an array containing the constants of this enum type, in the order they are declared
      • valueOf

        public static TimeValueConfig valueOf​(java.lang.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:
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        java.lang.NullPointerException - if the argument is null
      • getLowerCaseValue

        public final char getLowerCaseValue()
      • getUpperCaseValue

        public final char getUpperCaseValue()
      • getInterval

        public final long getInterval()
      • durationOf

        public static long durationOf​(java.lang.String s)
        Parameters:
        s - A time specification
        Returns:
        The specified duration in milliseconds
        See Also:
        parse(String), durationOf(Map)
      • parse

        public static java.util.Map<TimeValueConfig,​java.lang.Long> parse​(java.lang.String s)
                                                                         throws java.lang.IllegalArgumentException
        Parameters:
        s - An input time specification containing possibly mixed numbers and units - e.g., 3h10m to indicate 3 hours and 10 minutes
        Returns:
        A Map specifying for each time unit its count
        Throws:
        java.lang.NumberFormatException - If bad numbers found - e.g., negative counts
        java.lang.IllegalArgumentException - If bad format - e.g., unknown unit
      • durationOf

        public static long durationOf​(java.util.Map<TimeValueConfig,​? extends java.lang.Number> spec)
                               throws java.lang.IllegalArgumentException
        Parameters:
        spec - The Map specifying the count for each TimeValueConfig
        Returns:
        The total duration in milliseconds
        Throws:
        java.lang.IllegalArgumentException - If negative count for a time unit