org.rrd4j.core.timespec

## Class TimeToken

- java.lang.Object
- - org.rrd4j.core.timespec.TimeToken

-     class TimeToken
      extends Object

  Token representation for time specification parsing.

  This class represents individual tokens produced by the lexical scanner during time specification parsing. Each token contains both the original text value and a token type identifier that categorizes the token's meaning in the time specification grammar.

  Token categories include:
  - Time markers: Specific times like midnight, noon, teatime
  - Relative references: yesterday, today, tomorrow, now
  - Time units: seconds, minutes, hours, days, weeks, months, years
  - Calendar units: Month names (JAN-DEC) and day names (SUN-SAT)
  - Operators: Plus, minus, dot, colon, slash
  - Special tokens: Numbers, identifiers, end-of-file marker

  The token system supports both abbreviated and full forms where applicable, providing flexibility in time specification syntax. For example, both "January" and "Jan" map to the same JAN token type.

  Tokens are immutable objects created by the TimeScanner and consumed by the TimeParser during the parsing process.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static int` | `AM` Token for "am" - morning times for 0-12 hour clock
    `static int` | `APR` Token for "apr", "april" - fourth month
    `static int` | `AUG` Token for "aug", "august" - eighth month
    `static int` | `COLON` Token for ":" - time separator
    `static int` | `DAYS` Token for "day", "days", "d" - days multiplier
    `static int` | `DEC` Token for "dec", "december" - twelfth month
    `static int` | `DOT` Token for "." - decimal point or date separator
    `static int` | `END` Token for "end" or "e" - end of time range
    `static int` | `EOF` Token for end of input - no more tokens available
    `static int` | `FEB` Token for "feb", "february" - second month
    `static int` | `FRI` Token for "fri", "friday" - sixth day of week
    `static int` | `HOURS` Token for "hour", "hours", "hr", "h" - hours multiplier
    `static int` | `ID` Token for unrecognized identifiers - unknown words
    `static int` | `JAN` Token for "jan", "january" - first month
    `static int` | `JUL` Token for "jul", "july" - seventh month
    `static int` | `JUN` Token for "jun", "june" - sixth month
    `static int` | `JUNK` Token for invalid/unparseable input
    `static int` | `MAR` Token for "mar", "march" - third month
    `static int` | `MAY` Token for "may" - fifth month
    `static int` | `MIDNIGHT` Token for "midnight" - represents 00:00:00 of today or tomorrow
    `static int` | `MINUS` Token for "-" - subtraction operator
    `static int` | `MINUTES` Token for "minute", "minutes", "min" - minutes multiplier
    `static int` | `MON` Token for "mon", "monday" - second day of week
    `static int` | `MONTHS` Token for "month", "months", "mon" - months multiplier
    `static int` | `MONTHS_MINUTES` Token for ambiguous "m" - requires context resolution to months or minutes
    `static int` | `NOON` Token for "noon" - represents 12:00:00 of today or tomorrow
    `static int` | `NOV` Token for "nov", "november" - eleventh month
    `static int` | `NOW` Token for "now" or "n" - current timestamp
    `static int` | `NUMBER` Token for numeric values - sequences of digits
    `static int` | `OCT` Token for "oct", "october" - tenth month
    `static int` | `PLUS` Token for "+" - addition operator
    `static int` | `PM` Token for "pm" - evening times for 0-12 hour clock
    `static int` | `SAT` Token for "sat", "saturday" - seventh day of week
    `static int` | `SECONDS` Token for "second", "seconds", "sec", "s" - seconds multiplier
    `static int` | `SEP` Token for "sep", "september" - ninth month
    `static int` | `SLASH` Token for "/" - date separator
    `static int` | `START` Token for "start" or "s" - beginning of time range
    `static int` | `SUN` Token for "sun", "sunday" - first day of week
    `static int` | `TEATIME` Token for "teatime" - represents 16:00:00 of today or tomorrow
    `static int` | `THU` Token for "thu", "thursday" - fifth day of week
    `static int` | `TODAY` Token for "today" - current date
    `(package private) int` | `token_id` The token type identifier
    `static int` | `TOMORROW` Token for "tomorrow" - one day after current date
    `static int` | `TUE` Token for "tue", "tuesday" - third day of week
    `(package private) String` | `value` The original text value of this token
    `static int` | `WED` Token for "wed", "wednesday" - fourth day of week
    `static int` | `WEEKS` Token for "week", "weeks", "wk", "w" - weeks multiplier
    `static int` | `YEARS` Token for "year", "years", "yr", "y" - years multiplier
    `static int` | `YESTERDAY` Token for "yesterday" - one day before current date

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `TimeToken(String value, int token_id)` Creates a new TimeToken with the specified value and type.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `String` | `toString()` Returns a string representation of this token for debugging.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Field Detail

    - #### AM

          public static final int AM

      Token for "am" - morning times for 0-12 hour clock
      See Also:
        Constant Field Values

    - #### APR

          public static final int APR

      Token for "apr", "april" - fourth month
      See Also:
        Constant Field Values

    - #### AUG

          public static final int AUG

      Token for "aug", "august" - eighth month
      See Also:
        Constant Field Values

    - #### COLON

          public static final int COLON

      Token for ":" - time separator
      See Also:
        Constant Field Values

    - #### DAYS

          public static final int DAYS

      Token for "day", "days", "d" - days multiplier
      See Also:
        Constant Field Values

    - #### DEC

          public static final int DEC

      Token for "dec", "december" - twelfth month
      See Also:
        Constant Field Values

    - #### DOT

          public static final int DOT

      Token for "." - decimal point or date separator
      See Also:
        Constant Field Values

    - #### END

          public static final int END

      Token for "end" or "e" - end of time range
      See Also:
        Constant Field Values

    - #### EOF

          public static final int EOF

      Token for end of input - no more tokens available
      See Also:
        Constant Field Values

    - #### FEB

          public static final int FEB

      Token for "feb", "february" - second month
      See Also:
        Constant Field Values

    - #### FRI

          public static final int FRI

      Token for "fri", "friday" - sixth day of week
      See Also:
        Constant Field Values

    - #### HOURS

          public static final int HOURS

      Token for "hour", "hours", "hr", "h" - hours multiplier
      See Also:
        Constant Field Values

    - #### ID

          public static final int ID

      Token for unrecognized identifiers - unknown words
      See Also:
        Constant Field Values

    - #### JAN

          public static final int JAN

      Token for "jan", "january" - first month
      See Also:
        Constant Field Values

    - #### JUL

          public static final int JUL

      Token for "jul", "july" - seventh month
      See Also:
        Constant Field Values

    - #### JUN

          public static final int JUN

      Token for "jun", "june" - sixth month
      See Also:
        Constant Field Values

    - #### JUNK

          public static final int JUNK

      Token for invalid/unparseable input
      See Also:
        Constant Field Values

    - #### MAR

          public static final int MAR

      Token for "mar", "march" - third month
      See Also:
        Constant Field Values

    - #### MAY

          public static final int MAY

      Token for "may" - fifth month
      See Also:
        Constant Field Values

    - #### MIDNIGHT

          public static final int MIDNIGHT

      Token for "midnight" - represents 00:00:00 of today or tomorrow
      See Also:
        Constant Field Values

    - #### MINUS

          public static final int MINUS

      Token for "-" - subtraction operator
      See Also:
        Constant Field Values

    - #### MINUTES

          public static final int MINUTES

      Token for "minute", "minutes", "min" - minutes multiplier
      See Also:
        Constant Field Values

    - #### MON

          public static final int MON

      Token for "mon", "monday" - second day of week
      See Also:
        Constant Field Values

    - #### MONTHS

          public static final int MONTHS

      Token for "month", "months", "mon" - months multiplier
      See Also:
        Constant Field Values

    - #### MONTHS_MINUTES

          public static final int MONTHS_MINUTES

      Token for ambiguous "m" - requires context resolution to months or minutes
      See Also:
        Constant Field Values

    - #### NOON

          public static final int NOON

      Token for "noon" - represents 12:00:00 of today or tomorrow
      See Also:
        Constant Field Values

    - #### NOV

          public static final int NOV

      Token for "nov", "november" - eleventh month
      See Also:
        Constant Field Values

    - #### NOW

          public static final int NOW

      Token for "now" or "n" - current timestamp
      See Also:
        Constant Field Values

    - #### NUMBER

          public static final int NUMBER

      Token for numeric values - sequences of digits
      See Also:
        Constant Field Values

    - #### OCT

          public static final int OCT

      Token for "oct", "october" - tenth month
      See Also:
        Constant Field Values

    - #### PLUS

          public static final int PLUS

      Token for "+" - addition operator
      See Also:
        Constant Field Values

    - #### PM

          public static final int PM

      Token for "pm" - evening times for 0-12 hour clock
      See Also:
        Constant Field Values

    - #### SAT

          public static final int SAT

      Token for "sat", "saturday" - seventh day of week
      See Also:
        Constant Field Values

    - #### SECONDS

          public static final int SECONDS

      Token for "second", "seconds", "sec", "s" - seconds multiplier
      See Also:
        Constant Field Values

    - #### SEP

          public static final int SEP

      Token for "sep", "september" - ninth month
      See Also:
        Constant Field Values

    - #### SLASH

          public static final int SLASH

      Token for "/" - date separator
      See Also:
        Constant Field Values

    - #### START

          public static final int START

      Token for "start" or "s" - beginning of time range
      See Also:
        Constant Field Values

    - #### SUN

          public static final int SUN

      Token for "sun", "sunday" - first day of week
      See Also:
        Constant Field Values

    - #### TEATIME

          public static final int TEATIME

      Token for "teatime" - represents 16:00:00 of today or tomorrow
      See Also:
        Constant Field Values

    - #### THU

          public static final int THU

      Token for "thu", "thursday" - fifth day of week
      See Also:
        Constant Field Values

    - #### TODAY

          public static final int TODAY

      Token for "today" - current date
      See Also:
        Constant Field Values

    - #### token_id

          final int token_id

      The token type identifier

    - #### TOMORROW

          public static final int TOMORROW

      Token for "tomorrow" - one day after current date
      See Also:
        Constant Field Values

    - #### TUE

          public static final int TUE

      Token for "tue", "tuesday" - third day of week
      See Also:
        Constant Field Values

    - #### value

          final String value

      The original text value of this token

    - #### WED

          public static final int WED

      Token for "wed", "wednesday" - fourth day of week
      See Also:
        Constant Field Values

    - #### WEEKS

          public static final int WEEKS

      Token for "week", "weeks", "wk", "w" - weeks multiplier
      See Also:
        Constant Field Values

    - #### YEARS

          public static final int YEARS

      Token for "year", "years", "yr", "y" - years multiplier
      See Also:
        Constant Field Values

    - #### YESTERDAY

          public static final int YESTERDAY

      Token for "yesterday" - one day before current date
      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### TimeToken

          public TimeToken(String value,
                           int token_id)

      Creates a new TimeToken with the specified value and type.
      Parameters:
        `value` - the original text value of the token (may be null for EOF)
        `token_id` - the token type identifier from the constant definitions

  - ### Method Detail

    - #### toString

          public String toString()

      Returns a string representation of this token for debugging.

      The format is "value [token_id]" which makes it easy to see both the original text and the token type during parsing and debugging.

      Overrides:
        `toString` in class `Object`
      Returns:
        a formatted string containing the token value and type identifier