Package org.baseagent
Class Agent
java.lang.Object
org.baseagent.sim.SimulationComponent
org.baseagent.Agent
- All Implemented Interfaces:
MessageListener,HasStep,SimulationListener
- Direct Known Subclasses:
DrawableAgent
An important aspect about this general Agent is that the only thing it maintains is
internal state and knowledge. It does not specifically include those things that
connect it to the world, whether that world is a Universe inside within BaseAgent
- Author:
- David Koelle
-
Nested Class Summary
Nested classes/interfaces inherited from class org.baseagent.sim.SimulationComponent
SimulationComponent.Type -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddBehavior(String name, Behavior behavior) voidaddBehavior(Behavior behavior) getBehavior(String name) intgetState()getType()voidbooleanvoidonMessageReceived(Message message) By default, the Agent will be sure to pass along any messages to its behaviors that are also listening for messages.voidvoidremoveBehavior(String name) voidremoveBehavior(Behavior behavior) voidsendDirectedMessage(MessageListener recipient, Message message) Convenience method to access the communicatorvoidsendMessage(Message message) Convenience method to access the communicatorvoidsetBehaviorPolicy(Behavior behaviorPolicy) voidsetKnowledge(Map<String, Object> knowledge) voidvoidstep(Simulation simulation) Step can be overridden, but if it's not, it will do the current behaviorvoidMethods inherited from class org.baseagent.sim.SimulationComponent
getSimulation, getUUID, setSimulationMethods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.baseagent.sim.SimulationListener
onAfterStepEnded, onAfterStepStarted, onBeforeStepEnded, onBeforeStepStarted, onSimulationComponentAdded, onSimulationComponentRemoved, onSimulationEnded, onSimulationPaused, onSimulationResumed, onSimulationStarted, onSimulationStopped, onStepEnded, onStepStarted
-
Field Details
-
SIMPLE_ID_COUNTER
public static int SIMPLE_ID_COUNTER
-
-
Constructor Details
-
Agent
public Agent() -
Agent
-
Agent
-
-
Method Details
-
getSimpleID
public int getSimpleID() -
getType
- Specified by:
getTypein classSimulationComponent
-
step
Step can be overridden, but if it's not, it will do the current behavior -
setKnowledge
-
getKnowledge
-
getInventory
-
give
-
receive
-
take
-
isState
-
setState
-
getState
-
addBehavior
-
addBehavior
-
getBehavior
-
removeBehavior
-
removeBehavior
-
getBehaviors
-
setBehaviorPolicy
-
getBehaviorPolicy
-
onMessageReceived
By default, the Agent will be sure to pass along any messages to its behaviors that are also listening for messages. When you create a subclass of Agent, you may want to call super.onMessageReceived() or passMessageToBehaviors() to continue this behavior.- Specified by:
onMessageReceivedin interfaceMessageListener
-
sendMessage
Convenience method to access the communicator -
sendDirectedMessage
Convenience method to access the communicator
-