jade.core
Class LifeCycle

java.lang.Object
  extended by jade.core.LifeCycle
All Implemented Interfaces:
java.io.Serializable

public abstract class LifeCycle
extends java.lang.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

Field Summary
protected  Agent myAgent
           
protected  int myState
           
 
Constructor Summary
LifeCycle(int s)
           
 
Method Summary
 boolean alive()
          Specifies whether or not this is a termination state
 void end()
          This method is invoked when the agent thread termiantes
 boolean equals(java.lang.Object obj)
           
 void execute()
          This method actually implements what the agent has to do in this LifeCycle state
 int getState()
           
 void init()
          This method is invoked when the agent thread starts
 boolean isMessageAware()
          Specifies whether or not the agent should react to incoming messages when in this LifeCycle state.
 void transitionFrom(LifeCycle from)
          This method is invoked as soon as we enter this LifeCycle state.
 boolean transitionTo(LifeCycle to)
          This method is invoked just before leaving this LifeCycle state.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

myAgent

protected Agent myAgent

myState

protected int myState
Constructor Detail

LifeCycle

public LifeCycle(int s)
Method Detail

init

public void init()
This method is invoked when the agent thread starts


execute

public void execute()
             throws jade.security.JADESecurityException,
                    java.lang.InterruptedException,
                    java.io.InterruptedIOException
This method actually implements what the agent has to do in this LifeCycle state

Throws:
jade.security.JADESecurityException
java.lang.InterruptedException
java.io.InterruptedIOException

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.


equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object