Class State


  • public class State
    extends java.lang.Object
    Groups a state name, value and timestamp.

    The state itself is represented as an integer and the time is measured in milliseconds since midnight, January 1, 1970 UTC.

    A State object is immutable so that it may be easily shared.

    • Constructor Summary

      Constructors 
      Constructor Description
      State​(int value, java.lang.String name)
      Create a new State object with a time of 0.
      State​(int value, java.lang.String name, long time)
      Create a new State object.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean equals​(java.lang.Object obj)
      Return whether the specified object is equal to this object.
      java.lang.String getName()
      Returns the name of this State.
      long getTime()
      Returns the time with which this State was created.
      int getValue()
      Returns the value of this State.
      int hashCode()
      Returns a hash code value for this object.
      java.lang.String toString()
      Returns a String object representing this object.
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • State

        public State​(int value,
                     java.lang.String name,
                     long time)
        Create a new State object.
        Parameters:
        value - The value of the state.
        name - The name of the state.
        time - The time measured in milliseconds since midnight, January 1, 1970 UTC.
      • State

        public State​(int value,
                     java.lang.String name)
        Create a new State object with a time of 0.
        Parameters:
        value - The value of the state.
        name - The name of the state.
    • Method Detail

      • getValue

        public final int getValue()
        Returns the value of this State.
        Returns:
        The value of this State object.
      • getTime

        public final long getTime()
        Returns the time with which this State was created.
        Returns:
        The time with which this State was created. The time is measured in milliseconds since midnight, January 1, 1970 UTC.
      • getName

        public final java.lang.String getName()
        Returns the name of this State.
        Returns:
        The name of this State object.
      • toString

        public java.lang.String toString()
        Returns a String object representing this object.
        Overrides:
        toString in class java.lang.Object
        Returns:
        a String object representing this object.
      • hashCode

        public int hashCode()
        Returns a hash code value for this object.
        Overrides:
        hashCode in class java.lang.Object
        Returns:
        A hash code value for this object.
      • equals

        public boolean equals​(java.lang.Object obj)
        Return whether the specified object is equal to this object. Two State objects are equal if they have same value and name.
        Overrides:
        equals in class java.lang.Object
        Parameters:
        obj - The object to compare with this object.
        Returns:
        true if this object is equal to the specified object; false otherwise.