Class Cell
- All Implemented Interfaces:
Agent
,ModelEntity
Agent representing a cell of the grid.
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.simplesim.model.Agent
Agent.UnknownEventType
Nested classes/interfaces inherited from interface org.simplesim.model.ModelEntity
ModelEntity.PortConnectionException, ModelEntity.PortOperationException, ModelEntity.UniqueConstraintViolationException
-
Field Summary
Fields inherited from interface org.simplesim.model.ModelEntity
ROOT_LEVEL
-
Constructor Summary
-
Method Summary
Methods inherited from class org.simplesim.model.BasicAgent
getState, getTimeOfNextEvent, isSimulationRunning, pollModelChangeRequest, toggleSimulationIsRunning
Methods inherited from class org.simplesim.model.BasicModelEntity
addToDomain, equals, getAddress, getFullName, getInport, getLevel, getOutport, getParent, removeFromDomain, toString
Methods inherited from class java.lang.Object
getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.simplesim.model.ModelEntity
addToDomain, getAddress, getFullName, getInport, getLevel, getOutport, getParent, removeFromDomain
-
Constructor Details
-
Cell
public Cell(int posX, int posY, boolean life)
-
-
Method Details
-
doEvent
Description copied from interface:Agent
Calculates new outputs from the available inputs and implements the agent's strategy.This method is called by the simulator every time this agent is scheduled as an event in the global event queue. Outputs are basically massages that have to be put onto the outport of this agent. It should implement the general strategy of the agent and will acquire the actual simulation time from the simulator.
This method is supposed to do the following steps:
- read the messages from the inports
- modify the agent's state
- compute output and write messages to other entities to the outports
- add events to the internal event queue if necessary
- return the time of the next local event (=next time to call this method)
Do not invoke from outside the simulation loop!
- Parameters:
time
- current simulation time- Returns:
- tone - time of next event
-
getName
Description copied from interface:ModelEntity
Returns the name of this model entityReturns an empty string as default, may be overridden in derived classes.
- Specified by:
getName
in interfaceModelEntity
- Overrides:
getName
in classBasicModelEntity
- Returns:
- the name of this model entity, may be an empty string but not null
-