Package org.osgi.util.measurement
Class State
- java.lang.Object
-
- org.osgi.util.measurement.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.
-
-
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 thisState
.long
getTime()
Returns the time with which thisState
was created.int
getValue()
Returns the value of thisState
.int
hashCode()
Returns a hash code value for this object.java.lang.String
toString()
Returns aString
object representing this object.
-
-
-
Constructor Detail
-
State
public State(int value, java.lang.String name, long time)
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
public State(int value, java.lang.String name)
Create a newState
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 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
public final java.lang.String getName()
Returns the name of thisState
.- Returns:
- The name of this
State
object.
-
toString
public java.lang.String toString()
Returns aString
object representing this object.- Overrides:
toString
in classjava.lang.Object
- Returns:
- a
String
object representing this object.
-
hashCode
public int hashCode()
Returns a hash code value for this object.- Overrides:
hashCode
in 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. TwoState
objects are equal if they have same value and name.- Overrides:
equals
in classjava.lang.Object
- Parameters:
obj
- The object to compare with this object.- Returns:
true
if this object is equal to the specified object;false
otherwise.
-
-