Package org.osgi.util.measurement
Class State
- java.lang.Object
-
- org.osgi.util.measurement.State
-
public class State extends java.lang.ObjectGroups 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
Stateobject is immutable so that it may be easily shared.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(java.lang.Object obj)Return whether the specified object is equal to this object.java.lang.StringgetName()Returns the name of thisState.longgetTime()Returns the time with which thisStatewas created.intgetValue()Returns the value of thisState.inthashCode()Returns a hash code value for this object.java.lang.StringtoString()Returns aStringobject representing this object.
-
-
-
Constructor Detail
-
State
public State(int value, java.lang.String name, long time)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
public State(int value, java.lang.String name)Create a newStateobject 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 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
public final java.lang.String getName()
Returns the name of thisState.- Returns:
- The name of this
Stateobject.
-
toString
public java.lang.String toString()
Returns aStringobject representing this object.- Overrides:
toStringin classjava.lang.Object- Returns:
- a
Stringobject representing this object.
-
hashCode
public int hashCode()
Returns a hash code value for this object.- Overrides:
hashCodein classjava.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. TwoStateobjects are equal if they have same value and name.- Overrides:
equalsin classjava.lang.Object- Parameters:
obj- The object to compare with this object.- Returns:
trueif this object is equal to the specified object;falseotherwise.
-
-