Package jade.core
Class LifeCycle
- java.lang.Object
-
- jade.core.LifeCycle
-
- All Implemented Interfaces:
Serializable,Serializable
public abstract class LifeCycle extends Object implements Serializable
Common bas class for all agent life cycle states. Note that a single LifeCycle object may represent more than one agent state.- Author:
- Giovanni Caire - TILAB
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description LifeCycle(int s)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanalive()Specifies whether or not this is a termination statevoidend()This method is invoked when the agent thread termiantesbooleanequals(Object obj)voidexecute()This method actually implements what the agent has to do in this LifeCycle stateintgetState()voidinit()This method is invoked when the agent thread startsbooleanisMessageAware()Specifies whether or not the agent should react to incoming messages when in this LifeCycle state.voidtransitionFrom(LifeCycle from)This method is invoked as soon as we enter this LifeCycle state.booleantransitionTo(LifeCycle to)This method is invoked just before leaving this LifeCycle state.
-
-
-
Field Detail
-
myAgent
protected Agent myAgent
-
myState
protected int myState
-
-
Method Detail
-
init
public void init()
This method is invoked when the agent thread starts
-
execute
public void execute() throws JADESecurityException, InterruptedException, InterruptedIOExceptionThis method actually implements what the agent has to do in this LifeCycle state
-
end
public void end()
This method is invoked when the agent thread termiantes
-
alive
public boolean alive()
Specifies whether or not this is a termination state
-
getState
public int getState()
-
transitionFrom
public void transitionFrom(LifeCycle from)
This method is invoked as soon as we enter this LifeCycle state. When this method is executed this LifeCycle object is the current agent LifeCycle.
-
transitionTo
public boolean transitionTo(LifeCycle to)
This method is invoked just before leaving this LifeCycle state. When this method is executed this LifeCycle object is still the current agent LifeCycle. The boolean return value is used to prevent transitions to certain states. In that case the life cycle state does not change.
-
isMessageAware
public boolean isMessageAware()
Specifies whether or not the agent should react to incoming messages when in this LifeCycle state.
-
-