Class State

java.lang.Object
org.osgi.util.measurement.State

public class State extends 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.

Author:
$Id: e9fcca59ef704cafbc23e1f629713a804db59760 $
  • Constructor Summary

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

    Modifier and Type
    Method
    Description
    boolean
    Return whether the specified object is equal to this object.
    final String
    Returns the name of this State.
    final long
    Returns the time with which this State was created.
    final int
    Returns the value of this State.
    int
    Returns a hash code value for this object.
    Returns a String object representing this object.

    Methods inherited from class java.lang.Object

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

    • State

      public State(int value, 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, 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 Details

    • 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 String getName()
      Returns the name of this State.
      Returns:
      The name of this State object.
    • toString

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

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

      public boolean equals(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 Object
      Parameters:
      obj - The object to compare with this object.
      Returns:
      true if this object is equal to the specified object; false otherwise.