com.comtrade.ecm.engine.datatypes

## Class Time

- java.lang.Object
- - com.comtrade.ecm.engine.datatypes.Time

-     public class Time
      extends java.lang.Object

  Object that keeps information regarding a time (in a day) : an hour [0-23], a minute [0-59], a second [0-59], and a nano [0-999_999_999].
  There are no public constructors, all of the objects must be created using factory methods.
  See Also:
    Serialized Form

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `Time.Unit` Units to be used in `Time`-mathemathics.

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static java.lang.String` | `DEFAULT_TIME_FORMAT` A time-format-pattern to be used for formatting, if no other is defined.

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `Time` | `add(long amountToAdd, Time.Unit unit)` Changes a current value of an object for `amountToAdd` units of `unit`
    `int` | `compareTo(Time other)` Compares an object with another `Time`-object.
    `boolean` | `equals(java.lang.Object other)` Compares an object to another `Time` object.
    `int` | `getHour()`
    `int` | `getMillisecond()`
    `int` | `getMinute()`
    `int` | `getNano()`
    `int` | `getSecond()`
    `int` | `hashCode()` Hashcode of an object. Hashcode of an object will be a hashcode of its value-container object `value`
    `static Time` | `noon()` Creating a noon time
    `static Time` | `now()` Creating an object with a current time
    `static Time` | `of(java.time.LocalTime localTime)` Creating a time from a `LocalTime`
    `static Time` | `of(Time time)` Creating new `Time`-object from already existing `Time`-object.
    `java.time.LocalTime` | `toLocalTime()` Converts an object to `LocalTime`.
    `java.lang.String` | `toString()` Converts to `String`, using `DEFAULT_FORMATTER`.
    `java.lang.String` | `toString(java.time.format.DateTimeFormatter formatter)` Converts to `String`, using `formatter`.
    `java.lang.String` | `toString(java.util.Locale locale)` Converts to `String`, using `locale`.
    `java.lang.String` | `toString(java.lang.String formatDescription)` Converts to `String`, using a `DateTimeFormatter` defined by `formatDescription`.
    `static Time` | `zero()` Creating a zero time

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

      `getClass, notify, notifyAll, wait, wait, wait`

- - ### Field Detail

    - #### DEFAULT_TIME_FORMAT

          public static final java.lang.String DEFAULT_TIME_FORMAT

      A time-format-pattern to be used for formatting, if no other is defined.
      See Also:
        Constant Field Values

  - ### Method Detail

    - #### of

          public static Time of(java.time.LocalTime localTime)

      Creating a time from a `LocalTime`
      Parameters:
        `localTime` - A `LocalTime`-object that defines initial values for a newly created `Time`-object
      Returns:
        A newly created `Time` object

    - #### of

          public static Time of(Time time)

      Creating new `Time`-object from already existing `Time`-object.
      Parameters:
        `time` - A `Time`-object that we should clone.
      Returns:
        A newly created `Time` object

    - #### zero

          public static Time zero()

      Creating a zero time
      Returns:
        A newly created `Time` object

    - #### now

          public static Time now()

      Creating an object with a current time
      Returns:
        A newly created `Time` object

    - #### noon

          public static Time noon()

      Creating a noon time
      Returns:
        A newly created `Time` object

    - #### getHour

          public int getHour()

      Returns:
        The hour-of-day (from 0 to 23) of this `Time`-object

    - #### getMinute

          public int getMinute()

      Returns:
        the the minute-of-hour (from 0 to 59) of this `Time`-object.

    - #### getSecond

          public int getSecond()

      Returns:
        the the second-of-minute (from 0 to 59) of this `Time`-object.

    - #### getMillisecond

          public int getMillisecond()

      Returns:
        the millisecond-of-second, from 0 to 999

    - #### getNano

          public int getNano()

      Returns:
        the nano-of-second (from 0 to 999_999_999) of this `Time`-object.

    - #### compareTo

          public int compareTo(Time other)

      Compares an object with another `Time`-object.
      Returns:
        -1, if `other` is not `null` and `value` is `null`,
        0, if `other` is `null` and `value` is `null`,
        1, if `other` is `null` and `value` is not `null`,
        `value.compareTo(other.value)`, otherwise.

    - #### add

          public Time add(long amountToAdd,
                          Time.Unit unit)

      Changes a current value of an object for `amountToAdd` units of `unit`
      Parameters:
        `amountToAdd` - quantity of `unit` to be added (or subtracted, if `amountToAdd` is negative} to a current object.
        `unit` - Chrono-unit of measure
      Returns:
        A reference to a current `Time`-object

    - #### toLocalTime

          public java.time.LocalTime toLocalTime()

      Converts an object to `LocalTime`.
      Returns:
        `LocalTime` value of an object.

    - #### toString

          public java.lang.String toString()

      Converts to `String`, using `DEFAULT_FORMATTER`.
      Overrides:
        `toString` in class `java.lang.Object`
      Returns:
        Time presented as a formatted string

    - #### toString

          public java.lang.String toString(java.time.format.DateTimeFormatter formatter)

      Converts to `String`, using `formatter`. If `formatter` is `null`, then a standard `toString()` is used.
      Parameters:
        `formatter` - A format to be used when formatting a time
      Returns:
        Formatted time

    - #### toString

          public java.lang.String toString(java.util.Locale locale)

      Converts to `String`, using `locale`. If `locale` is `null`, then a standard `DEFAULT_LOCALE` is used.
      Parameters:
        `locale` - A locale to be used when formatting a time
      Returns:
        Formatted time

    - #### toString

          public java.lang.String toString(java.lang.String formatDescription)

      Converts to `String`, using a `DateTimeFormatter` defined by `formatDescription`.
      Parameters:
        `formatDescription` - A String-definition of a `DateTimeFormatter` to be used when formatting a time
      Returns:
        Formatted time

    - #### hashCode

          public int hashCode()

      Hashcode of an object.
      Hashcode of an object will be a hashcode of its value-container object `value`
      Overrides:
        `hashCode` in class `java.lang.Object`

    - #### equals

          public boolean equals(java.lang.Object other)

      Compares an object to another `Time` object. Two `Time` objects will be treated equal, if their value-container objects `value` are equal.
      Overrides:
        `equals` in class `java.lang.Object`
      Returns:
        `true`, if objects are equal,
        `false`, otherwise.