|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectmadkit.kernel.Activator<AbstractAgent>
madkit.simulation.activators.TurboMethodActivator
public class TurboMethodActivator
Optimized version of the SingleMethodActivator can only invoke a simple method with no parameters
Field Summary | |
---|---|
protected java.util.Map<AbstractAgent,java.lang.reflect.Method> |
methods
methods maps an agent to its corresponding Method object for runtime invocation |
Constructor Summary | |
---|---|
TurboMethodActivator(java.lang.String methodName,
java.lang.String groupName,
java.lang.String roleName)
|
|
TurboMethodActivator(java.lang.String methodName,
java.lang.String communityName,
java.lang.String groupName,
java.lang.String roleName)
|
Method Summary | |
---|---|
void |
execute()
this method can be overridden and used to define one behavior for the activator. |
A |
getAgentNb(int nb)
|
java.util.ListIterator<A> |
getAgentsIterator()
Deprecated. as of MadKit 4.3 : simply type getCurrentAgentsList().listIterator() |
java.lang.String |
getCommunity()
|
java.util.List<A> |
getCurrentAgentsList()
|
java.lang.String |
getGroup()
|
java.lang.String |
getMethodName()
|
java.lang.String |
getRole()
|
java.util.List<A> |
getShuffledList()
|
void |
initialize()
this method is automatically invoked the first time the agents variable is updated so it's a good place to initialize activator's parameters like in the SingleMethodActivator for exemple |
int |
numberOfAgents()
|
void |
setDebugOff(boolean b)
|
java.lang.String |
toString()
|
void |
update(AbstractAgent theAgent,
boolean added)
this method is automatically invoked when changes occur on the considered group/role couple |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected final java.util.Map<AbstractAgent,java.lang.reflect.Method> methods
Constructor Detail |
---|
public TurboMethodActivator(java.lang.String methodName, java.lang.String groupName, java.lang.String roleName)
public TurboMethodActivator(java.lang.String methodName, java.lang.String communityName, java.lang.String groupName, java.lang.String roleName)
Method Detail |
---|
public java.lang.String getMethodName()
public void initialize()
Activator
initialize
in class Activator<AbstractAgent>
public void update(AbstractAgent theAgent, boolean added)
Activator
update
in class Activator<AbstractAgent>
theAgent
- is the agent which have been added or removed from the agents collection, the getAgentsList() List)added
- is true if the Agent has been added to the agents collection, false if removed from itpublic void execute()
Activator
execute
in class Activator<AbstractAgent>
public void setDebugOff(boolean b)
b
- true means that the activator will not display caught errors due to invocation problems. This is useful when agents are often killed and relaunched during the same simulation. This avoids to have exception messages when invoking methods on dead agents.public final java.util.ListIterator<A> getAgentsIterator()
getCurrentAgentsList().listIterator()
public final java.util.List<A> getShuffledList()
public final java.util.List<A> getCurrentAgentsList()
public final int numberOfAgents()
public final A getAgentNb(int nb)
public final java.lang.String getCommunity()
public final java.lang.String getGroup()
public final java.lang.String getRole()
public java.lang.String toString()
toString
in class java.lang.Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |