public final class CycleHandler extends Object
getInstance()
.getInstance()
Modifier and Type | Field and Description |
---|---|
private RuleSet |
events |
private static CycleHandler |
instance |
private CycleState |
myState |
Modifier | Constructor and Description |
---|---|
private |
CycleHandler()
Constructor of the class.
|
Modifier and Type | Method and Description |
---|---|
void |
addEvent(Rule event)
Adds the specified event/action to the events set.
|
RuleSet |
getEvents()
Gets the events/actions that have been decided to be performed during the
previous cycle.
|
static CycleHandler |
getInstance()
Gets the only object of this singleton class.
|
void |
handlerMethod(String NAME)
Sends the request to the current state to operate its behavior.
|
void |
setEvents(RuleSet events)
Sets the events/actions that have been decided to be performed during the
previous cycle.
|
void |
setState(CycleState NEW_STATE)
Sets the state from which the
CycleHandler will call the
handlerMethod
This allows states to terminate and send a request to the
CycleHandler to go to the specified and next state. |
private static volatile CycleHandler instance
private CycleState myState
private RuleSet events
private CycleHandler()
getInstance()
instead.getInstance()
public static CycleHandler getInstance()
public void setState(CycleState NEW_STATE)
CycleHandler
will call the
handlerMethod
This allows states to terminate and send a request to the
CycleHandler
to go to the specified and next state.
NEW_STATE
- the next step of the cycle.public void handlerMethod(String NAME)
This method should be the only way to perform the action of a state. It
calls the handlerMethod()
of the interface CycleState
which every state
implements.
NAME
- the name of the step. It has no use except to debug.public RuleSet getEvents()
See a LPS documentation for more details on cycles and actions/events.
RuleSet
containing the events triggered during
the last cycle.public void setEvents(RuleSet events)
This method is basically used by a cycle during its final step to prepare the next cycle.
See a LPS documentation for more details on cycles and actions/events.
events
- the events under the form of a RuleSet
object,
triggered during the last cycle.public void addEvent(Rule event)
This method is basically used when a user adds an event.
See a LPS documentation for more details on cycles and actions/events.
event
- the event under the form of a Rule
object.