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.
 
Method Summary
 StateObserver getObserver()
           
 void notifyObservers()
          Notifies any observer that this state has been updated
 void setActive(boolean value)
           
 
Methods inherited from interface org.jminor.common.model.StateObserver
addActivateListener, addDeactivateListener, addListeningAction, getReversedState, isActive, removeActiveListener, removeDeactiveListener
 
Methods inherited from interface org.jminor.common.model.EventObserver
addListener, removeListener
 

Method Detail

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