Package org.osgi.util.measurement
Class State
java.lang.Object
org.osgi.util.measurement.State
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 -
Method Summary
Modifier and TypeMethodDescriptionboolean
Return whether the specified object is equal to this object.final String
getName()
Returns the name of thisState
.final long
getTime()
Returns the time with which thisState
was created.final int
getValue()
Returns the value of thisState
.int
hashCode()
Returns a hash code value for this object.toString()
Returns aString
object representing this object.
-
Constructor Details
-
State
Create a newState
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
Create a newState
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 thisState
.- Returns:
- The value of this
State
object.
-
getTime
public final long getTime()Returns the time with which thisState
was created.- Returns:
- The time with which this
State
was created. The time is measured in milliseconds since midnight, January 1, 1970 UTC.
-
getName
Returns the name of thisState
.- Returns:
- The name of this
State
object.
-
toString
Returns aString
object representing this object. -
hashCode
public int hashCode()Returns a hash code value for this object. -
equals
Return whether the specified object is equal to this object. TwoState
objects are equal if they have same value and name.
-