public class State
extends java.lang.Object
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.
Modifier and Type | Field and Description |
---|---|
private java.lang.String |
name |
private long |
time |
private int |
value |
Constructor and Description |
---|
State(int value,
java.lang.String name)
Create a new
State object with a time of 0. |
State(int value,
java.lang.String name,
long time)
Create a new
State object. |
Modifier and Type | Method and 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 this
State . |
long |
getTime()
Returns the time with which this
State was created. |
int |
getValue()
Returns the value of this
State . |
int |
hashCode()
Returns a hash code value for this object.
|
java.lang.String |
toString()
Returns a
String object representing this object. |
private final int value
private final long time
private final java.lang.String name
public State(int value, java.lang.String name, long time)
State
object.value
- The value of the state.name
- The name of the state.time
- The time measured in milliseconds since midnight, January 1,
1970 UTC.public State(int value, java.lang.String name)
State
object with a time of 0.value
- The value of the state.name
- The name of the state.public final int getValue()
State
.State
object.public final long getTime()
State
was created.State
was created. The time
is measured in milliseconds since midnight, January 1, 1970 UTC.public final java.lang.String getName()
State
.State
object.public java.lang.String toString()
String
object representing this object.toString
in class java.lang.Object
String
object representing this object.public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object obj)
State
objects are equal if they have same value and name.equals
in class java.lang.Object
obj
- The object to compare with this object.true
if this object is equal to the specified object;
false
otherwise.