|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectcom.sdm.quasar.client.core.states.AbstractState
com.sdm.quasar.client.core.states.ThresholdCounterBooleanState
A BooleanState implementation that is true, as long as the
managed counter is at least as big as the treshold set.
| Constructor Summary | |
ThresholdCounterBooleanState()
Creates a new ThresholdCounterBooleanState.
|
|
ThresholdCounterBooleanState(java.lang.String name)
Creates a new ThresholdCounterBooleanState.
|
|
ThresholdCounterBooleanState(java.lang.String name,
int threshold)
Creates a new ThresholdCounterBooleanState.
|
|
ThresholdCounterBooleanState(java.lang.String name,
int initialCounter,
int threshold)
Creates a new ThresholdCounterBooleanState. |
|
| Method Summary | |
void |
addCounter(int diff)
Adds the given diff value to the current counter. |
void |
decreaseCounter()
Decreases the counter. |
int |
getCounter()
Returns the counter value of this ThresholdCounterBooleanState.
|
int |
getThreshold()
Returns the threshold of this ThresholdCounterBooleanState. |
java.lang.Object |
getValue()
|
void |
increaseCounter()
Increases the counter. |
boolean |
isValueTrue()
Returns true, if this State is enabled,
false otherwise. |
void |
setThreshold(int threshold)
Sets the treshold to the given value. |
| Methods inherited from class com.sdm.quasar.client.core.states.AbstractState |
addStateListener, appendParametersToString, dispose, fireStateChanged, getName, removeStateListener, setName, stateValueToString, toString, toString |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface com.sdm.quasar.client.core.states.State |
addStateListener, getName, removeStateListener, setName |
| Methods inherited from interface com.sdm.quasar.client.core.common.Disposable |
dispose |
| Constructor Detail |
public ThresholdCounterBooleanState()
ThresholdCounterBooleanState.
Note: The counter will be initialized with 0 and the threshold
is 1.
public ThresholdCounterBooleanState(java.lang.String name)
ThresholdCounterBooleanState.
Note: The counter will be initialized with 0 and the threshold
is 1.
name - the name of this BooleanState (not null)
public ThresholdCounterBooleanState(java.lang.String name,
int threshold)
ThresholdCounterBooleanState.
Note: The counter will be initialized with 0.
name - the name of this BooleanState (not null)threshold - the threshold value (non-negative)
public ThresholdCounterBooleanState(java.lang.String name,
int initialCounter,
int threshold)
ThresholdCounterBooleanState.
name - the name of this BooleanState (not null)initialCounter - the initial counter value (non-negative)threshold - the threshold value (non-negative)| Method Detail |
public java.lang.Object getValue()
getValue in interface StateState.getValue()public boolean isValueTrue()
BooleanStatetrue, if this State is enabled,
false otherwise.
isValueTrue in interface BooleanStatetrue, if this State is enabled,
false otherwise.BooleanState.isValueTrue()public int getThreshold()
ThresholdCounterBooleanState.
public void setThreshold(int threshold)
threshold - the int to set.public int getCounter()
ThresholdCounterBooleanState.
The counter is always non-negative and starts with an initial value of
0.
public void increaseCounter()
public void decreaseCounter()
getThreshold(),
the state is disabled again.
public void addCounter(int diff)
Note: this method assures, that the counter does not become negative.
diff - the difference to add to the counter (may be negative)
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||