public class TimedStateBoolean extends Object
| Constructor and Description |
|---|
TimedStateBoolean(boolean initialValue)
Creates a new instance with the initalValue.
|
TimedStateBoolean(boolean initialValue,
boolean expectedValue)
Creates a new instance with the initalValue.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
get()
Returns the current value.
|
boolean |
getAndSet(boolean newValue)
Sets to the given value and returns the previous value.
|
boolean |
getExpected()
Returns the expected value of this state boolean.
|
org.joda.time.DateTime |
getValueDateTime()
Returns a DateTime that represents the last time this boolean changed state.
|
org.joda.time.Period |
getValueDuration()
Based on the time this method is called (System.currentTimeMillis), this
method returns a Period that represents the duration of time this value
has retained this value.
|
long |
getValueDurationInMills()
Based on the time this method is called (System.currentTimeMillis), this
method returns a long that represents the duration of time this value
has retained this value.
|
long |
getValueTimeMillis()
Returns the timestamp (num of milliseconds via System.currentTimeMillis) of the
last time this boolean changed state.
|
boolean |
isExpected()
Tests whether this state boolean is what we would expect it to be.
|
void |
set(boolean newValue)
Unconditionally sets to the given value.
|
String |
toString() |
public TimedStateBoolean(boolean initialValue)
initialValue - The initial value of the boolean.public TimedStateBoolean(boolean initialValue,
boolean expectedValue)
initialValue - The initial value of the boolean.expectedValue - The expected value of the boolean if this was in
a good state.public boolean getExpected()
public boolean isExpected()
public boolean getAndSet(boolean newValue)
newValue - The new boolean valuepublic void set(boolean newValue)
newValue - The new boolean valuepublic boolean get()
public long getValueTimeMillis()
public org.joda.time.DateTime getValueDateTime()
public org.joda.time.Period getValueDuration()
getValueDurationInMills()public long getValueDurationInMills()
getValueDuration()Copyright © 2012-2015 Cloudhopper by Twitter. All Rights Reserved.