|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.codexombie.jspasm.AbsEntity
public abstract class AbsEntity
The abstract superclass of all Entity classes. Entity objects are what the state engine tracks through the state models in response to events. The action methods associated with states are also defined in the Entity - this may seem strange but in practice the state code almost always manipulates Entity data, so making the methods members of the Entity class removes the need to cast the entity references in every state action.
Entities are created by calling Engine.createEntity()
. An
entity can delete itself from the system at the end of its lifecycle by
calling delete()
in the termination state method.
Field Summary | |
---|---|
protected com.codexombie.jspasm.EntityState |
currentState
The current state of the entity (references a EntityState object in the state model). |
protected java.lang.String |
id
Identifier of the entity. |
protected Engine |
ownerEngine
The state engine within which this entity exists. |
protected Model |
ownerModel
The state model that the entity is associated with. |
Constructor Summary | |
---|---|
AbsEntity()
|
Method Summary | |
---|---|
protected void |
delete()
Deletes this entity from the state engine (usually called from the termination state code in the state model). |
protected void |
generateEvent(AbsEntity entity,
com.codexombie.jspasm.EventSpec eventSpec,
java.lang.Object[] args)
Generate a normal event. |
protected void |
generateEvent(AbsEntity entity,
java.lang.String eventSpecId,
java.lang.Object[] args)
Generate a normal event. |
protected void |
generateEvent(java.lang.String entityId,
java.lang.String eventSpecId,
java.lang.Object[] args)
Generate a normal event. |
protected void |
generateInternalEvent(com.codexombie.jspasm.EventSpec eventSpec,
java.lang.Object[] args)
Generate an internal event. |
protected void |
generateInternalEvent(java.lang.String eventSpecId)
Generate an internal event with no arguments. |
protected void |
generateInternalEvent(java.lang.String eventSpecId,
java.lang.Object[] args)
Generate an internal event. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected java.lang.String id
Identifier of the entity. Each entity associated with a state engine must have an id unique to that entity (the id is used to direct events to the correct entity).
protected com.codexombie.jspasm.EntityState currentState
The current state of the entity (references a EntityState object in the state model).
protected Engine ownerEngine
The state engine within which this entity exists.
protected Model ownerModel
The state model that the entity is associated with.
Constructor Detail |
---|
public AbsEntity()
Method Detail |
---|
protected final void delete()
Deletes this entity from the state engine (usually called from the termination state code in the state model).
protected final void generateEvent(AbsEntity entity, com.codexombie.jspasm.EventSpec eventSpec, java.lang.Object[] args) throws StateProcessingException
Generate a normal event.
entity
- The target entity.eventSpec
- The event type specifier.args
- The arguments to the target state code.
StateProcessingException
- if any arguments are null
.protected final void generateEvent(AbsEntity entity, java.lang.String eventSpecId, java.lang.Object[] args) throws StateProcessingException
Generate a normal event.
entity
- The target entity.eventSpecId
- The name of the event type specifier.args
- The arguments to the target state code.
StateProcessingException
- if any arguments are null
or the event spec
name is not recognized.protected final void generateEvent(java.lang.String entityId, java.lang.String eventSpecId, java.lang.Object[] args) throws StateProcessingException
Generate a normal event.
entityId
- The target entity id.eventSpecId
- The name of the event type specifier.args
- The arguments to the target state code.
StateProcessingException
- if any arguments are null
or the entity or
event spec name is not recognized..protected final void generateInternalEvent(java.lang.String eventSpecId, java.lang.Object[] args) throws StateProcessingException
Generate an internal event.
eventSpecId
- The name of the event type specifier.args
- The arguments to the target state code.
StateProcessingException
- if any arguments are null
or the event spec
name is not recognized.protected final void generateInternalEvent(java.lang.String eventSpecId) throws StateProcessingException
Generate an internal event with no arguments.
eventSpecId
- The name of the event type specifier.
StateProcessingException
- if any arguments are null
or the event spec
name is not recognized.protected final void generateInternalEvent(com.codexombie.jspasm.EventSpec eventSpec, java.lang.Object[] args) throws StateProcessingException
Generate an internal event.
eventSpec
- The event type specifier.args
- The arguments to the target state code.
StateProcessingException
- if any arguments are null
or the event spec
name is not recognized.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |