public class PlayGround2D
extends java.lang.Object
The information stored in this class is the only information needed by the 2D visualizer to visualize the simulation.
Constructor and Description |
---|
PlayGround2D()
Default Constructor for the playGround2D that initialize an empty lists and Maps
to be used to store information later.
|
Modifier and Type | Method and Description |
---|---|
PlayGround2D |
clone() |
AgentState |
findAgent(int agentID)
Find an agent in the playGround given the agent ID.
|
EnvObjectState |
findEnvObject(int envObjectID)
Find an environment object in the playGround given the environment object ID.
|
ExplosionVO2D |
findExplosion(int explosionID)
Find a explosion event in the playGround given an explosion event ID.
|
FireworkVO2D |
findFirework(int fireworkID)
Find a fireworks event in the playGround given an fireworks event ID.
|
java.util.Map<java.lang.Integer,AgentState> |
getAgents()
Gets the current map of agents in the playGround
|
int |
getAgentsCount(CellID cell) |
CellMap |
getCellMap()
Gets the current cellMap stored in the playGround
|
java.util.Map<CellID,CellStateDto> |
getCells()
Gets the current list of CEllBoundsVO in the playGround
|
int |
getEnvObjCount(CellID cell) |
java.util.List<EnvObjectState> |
getEnvObjects()
Gets the current list of environment object states in the playGround
|
java.util.List<ExplosionVO2D> |
getExplosions()
Gets the current explosion events in the simulation
|
java.util.List<FireworkVO2D> |
getFireworks()
Gets the current fireworks events in the simulation
|
VirtualState |
getSelectedObject(VirtualState state)
Return an agent or environment object that is selected with the picker
|
void |
removeAgent(AgentState agentState)
Removes the given agent state from the agent map in the PlayGround
|
void |
removeEnvObject(EnvObjectState o)
Removes the given environment object state from the list of environment objects in the playGround
|
void |
reset()
Reset the Playground by emptying all the list in the playGroound
|
void |
triggerEvent(java.util.List<EnvEvent> eventList)
Adds the list of events received from the simulation to the designated list of either
the explosion or fireworks events, and assigning an age of 0 to each new event.
|
void |
updateAgent(AgentState agentState)
Update the agents map in the playGround by adding the new agent state to the Map
or updating the the existing agent state.
|
void |
updateCell(CellStateDto cell)
Updates the current cellMap in the playGround with the given cellMap
|
void |
updateEnvObject(EnvObjectState o)
Updates the environment object states list in the playground by adding the new
environment object state or updating the existing one.
|
void |
updateEvents()
Updates the explosion and fireworks events stored in the playGround by increasing the age of each of
these events every cycle and delete the events that exceeds the age limits.
|
public PlayGround2D()
public java.util.List<ExplosionVO2D> getExplosions()
public java.util.List<FireworkVO2D> getFireworks()
public EnvObjectState findEnvObject(int envObjectID)
envObjectID
- The environment object ID to be find.public AgentState findAgent(int agentID)
agentID
- The agent Id to be find.public FireworkVO2D findFirework(int fireworkID)
fireworkID
- The event ID for the fireworks to be find.public ExplosionVO2D findExplosion(int explosionID)
explosionID
- The event ID for the explosion to be find.public void updateEnvObject(EnvObjectState o)
o
- Environment object state to be updated in the listpublic void removeEnvObject(EnvObjectState o)
o
- The environment object state to be removedpublic void updateAgent(AgentState agentState)
agentState
- Agent State to be updatedpublic void removeAgent(AgentState agentState)
agentState
- Agent state to be removed from the mappublic void triggerEvent(java.util.List<EnvEvent> eventList)
eventList
- List of event needs to be classified and added to the list of explosion or fireworkspublic void reset()
public void updateCell(CellStateDto cell)
cell
- CellMap to be set in the playGroundpublic java.util.Map<java.lang.Integer,AgentState> getAgents()
public java.util.List<EnvObjectState> getEnvObjects()
public java.util.Map<CellID,CellStateDto> getCells()
public CellMap getCellMap()
public void updateEvents()
public VirtualState getSelectedObject(VirtualState state)
state
- VirtualState that represent the pickerpublic PlayGround2D clone()
clone
in class java.lang.Object
public int getAgentsCount(CellID cell)
public int getEnvObjCount(CellID cell)