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.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanReturn whether the specified object is equal to this object.final StringgetName()Returns the name of thisState.final longgetTime()Returns the time with which thisStatewas created.final intgetValue()Returns the value of thisState.inthashCode()Returns a hash code value for this object.toString()Returns aStringobject representing this object.
-
Field Details
-
value
private final int value -
time
private final long time -
name
-
-
Constructor Details
-
State
Create a newStateobject.- 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 newStateobject 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
Stateobject.
-
getTime
public final long getTime()Returns the time with which thisStatewas created.- Returns:
- The time with which this
Statewas created. The time is measured in milliseconds since midnight, January 1, 1970 UTC.
-
getName
Returns the name of thisState.- Returns:
- The name of this
Stateobject.
-
toString
Returns aStringobject 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. TwoStateobjects are equal if they have same value and name.
-