org.licas.util

## Class TimeConst

- java.lang.Object
- - org.licas.util.TimeConst

-     public class TimeConst
      extends java.lang.Object

  Constant values relating to time periods.
  Author:
    Kieran Greer

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static java.lang.String` | `DAY` Day tag name
    `static java.lang.String` | `HOUR` Day tag name
    `static long` | `MILLIDAY` Day in milliseconds
    `static long` | `MILLIHOUR` Hour in milliseconds
    `static long` | `MILLIMINUTE` Minute in milliseconds
    `static long` | `MILLIMONTH` Month in milliseconds
    `static long` | `MILLISECOND` Second in milliseconds
    `static java.lang.String` | `MILLISECONDPART` Day tag name
    `static long` | `MILLIWEEK` Day in milliseconds
    `static long` | `MILLIYEAR` Year in milliseconds
    `static java.lang.String` | `MINUTE` Day tag name
    `static java.lang.String` | `MONTH` Month tag name
    `static java.lang.String` | `SECOND` Day tag name
    `static java.lang.String` | `TIMEPERIOD` Time attribute name
    `static java.lang.String` | `WEEK` Week tag name
    `static java.lang.String` | `YEAR` Year tag name

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `TimeConst()`

  - ### Method Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static long` | `asTimeUnit(java.lang.String timeUnit, long milliseconds)` Convert the milliseconds value into a number for the the time unit.
    `static long` | `getMilliseconds(java.lang.String timeUnit, int timeCount)` Convert the number of time units into a total milliseconds value.
    `static java.util.ArrayList<java.lang.String>` | `getTimePeriods()` Get a list of all stored time periods.
    `static java.util.ArrayList<java.lang.String>` | `getTimePeriods(java.lang.String start, java.lang.String end)` Get a list of all stored time periods, between and including the start/end.

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

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

- - ### Field Detail

    - #### TIMEPERIOD

          public static final java.lang.String TIMEPERIOD

      Time attribute name
      See Also:
        Constant Field Values

    - #### MILLISECONDPART

          public static final java.lang.String MILLISECONDPART

      Day tag name
      See Also:
        Constant Field Values

    - #### SECOND

          public static final java.lang.String SECOND

      Day tag name
      See Also:
        Constant Field Values

    - #### MINUTE

          public static final java.lang.String MINUTE

      Day tag name
      See Also:
        Constant Field Values

    - #### HOUR

          public static final java.lang.String HOUR

      Day tag name
      See Also:
        Constant Field Values

    - #### DAY

          public static final java.lang.String DAY

      Day tag name
      See Also:
        Constant Field Values

    - #### WEEK

          public static final java.lang.String WEEK

      Week tag name
      See Also:
        Constant Field Values

    - #### MONTH

          public static final java.lang.String MONTH

      Month tag name
      See Also:
        Constant Field Values

    - #### YEAR

          public static final java.lang.String YEAR

      Year tag name
      See Also:
        Constant Field Values

    - #### MILLISECOND

          public static final long MILLISECOND

      Second in milliseconds
      See Also:
        Constant Field Values

    - #### MILLIMINUTE

          public static final long MILLIMINUTE

      Minute in milliseconds
      See Also:
        Constant Field Values

    - #### MILLIHOUR

          public static final long MILLIHOUR

      Hour in milliseconds
      See Also:
        Constant Field Values

    - #### MILLIDAY

          public static final long MILLIDAY

      Day in milliseconds
      See Also:
        Constant Field Values

    - #### MILLIWEEK

          public static final long MILLIWEEK

      Day in milliseconds
      See Also:
        Constant Field Values

    - #### MILLIMONTH

          public static final long MILLIMONTH

      Month in milliseconds
      See Also:
        Constant Field Values

    - #### MILLIYEAR

          public static final long MILLIYEAR

      Year in milliseconds
      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### TimeConst

          public TimeConst()

  - ### Method Detail

    - #### getTimePeriods

          public static java.util.ArrayList<java.lang.String> getTimePeriods()

      Get a list of all stored time periods.
      Returns:
        a list of time period descriptions.

    - #### getTimePeriods

          public static java.util.ArrayList<java.lang.String> getTimePeriods(java.lang.String start,
                                                                             java.lang.String end)

      Get a list of all stored time periods, between and including the start/end.
      Parameters:
        `start` - period to start with. If null start from the smallest one.
        `end` - period to end with. If null end with the largest one.
      Returns:
        the list of time periods.

    - #### asTimeUnit

          public static long asTimeUnit(java.lang.String timeUnit,
                                        long milliseconds)

      Convert the milliseconds value into a number for the the time unit.
      Parameters:
        `timeUnit` - the unit to convert to.
        `milliseconds` - the time in milliseconds.
      Returns:
        the time in the specified time units.

    - #### getMilliseconds

          public static long getMilliseconds(java.lang.String timeUnit,
                                             int timeCount)

      Convert the number of time units into a total milliseconds value.
      Parameters:
        `timeUnit` - the time unit.
        `timeCount` - the number of this time unit.
      Returns:
        the total time in milliseconds.