org.jminor.common.model
Interface State
- All Superinterfaces:
- EventObserver, StateObserver
- All Known Subinterfaces:
- State.AggregateState
public interface State
- extends StateObserver
A class encapsulating a simple boolean state, providing a change event.
State state = States.state();
Action action = ...;
state.addListeningAction(action);
//action is now disabled since states are inactive by default
state.setActive(true);
//action is now enabled
Nested Class Summary |
static interface |
State.AggregateState
A state which behaves according to a set of states, either ANDing or ORing those together
when determining its own state. |
static interface |
State.StateGroup
A StateGroup deactivates all other states when a state in the group is activated. |
setActive
void setActive(boolean value)
- Parameters:
value
- the new active state of this State instance
getObserver
StateObserver getObserver()
- Returns:
- an StateObserver notified each time the state changes or
notifyObservers()
is called - See Also:
notifyObservers()
notifyObservers
void notifyObservers()
- Notifies any observer that this state has been updated