|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectmassim.gridsimulations.SimulationWorldState
massim.competition2012.GraphSimulationWorldState
public class GraphSimulationWorldState
Holds the current state of a graph simulation (2012 Mars Scenario)
Field Summary | |
---|---|
protected java.util.Map<java.lang.String,GraphSimulationAgentState> |
agentNamesMap
A map from an agent's name to its current state. |
protected java.util.Vector<GraphSimulationAgentState> |
agents
A vector holding all agents that take part in the simulation. |
protected GraphSimulationConfiguration |
config
The configuration of this simulation. |
protected java.util.Map<GraphNode,java.util.List<GraphEdge>> |
connectedEdgesMap
A map holding the list of edges connected to each node. |
protected java.util.Vector<GraphEdge> |
edges
The edges conforming the map graph. |
protected java.util.Map<GraphNode,java.util.List<GraphNode>> |
neighborsMap
A map holding the list of nodes directly connected to each node. |
protected java.util.Map<java.lang.String,GraphNode> |
nodeNamesMap
A map from a node's name to its current state. |
protected java.util.Vector<GraphNode> |
nodes
The nodes conforming the map graph. |
protected int |
sizeX
The width of the abstract grid to which the graph is subscribed. |
protected int |
sizeY
The height of the abstract grid to which the graph is subscribed. |
java.util.Vector<TeamState> |
teamsStates
A vector holding the states of all the teams that take part in the simulation. |
Fields inherited from class massim.gridsimulations.SimulationWorldState |
---|
actionSuccessProbability, currentStep, informationDistortionProbability, maxNumberOfSteps, numberOfAgents, numberOfObstacles, numberOfSteps, outputFolder, simulationName, sizex, sizey, teamName, teamScore, tournamentName |
Constructor Summary | |
---|---|
GraphSimulationWorldState(GraphSimulationConfiguration config)
Creates a simulation state as defined by config |
Method Summary | |
---|---|
void |
addAgent(GraphSimulationAgentState agent,
java.util.Vector<java.lang.Integer> agentPositions,
boolean newPosition)
Adds agent to the currently simulation, and situates it in a random node in the map. |
GraphSimulationAgentState |
getAgent(java.lang.String agentName)
Returns the state of an agent given its name. |
java.util.Vector<GraphSimulationAgentState> |
getAgents()
getter for the vector holding all agents that take part in the simulation. |
GraphSimulationConfiguration |
getConfig()
getter for the configuration object. |
java.util.List<GraphEdge> |
getConnectedEdges(GraphNode node)
Returns the list of the edges connected to node |
java.util.List<GraphNode> |
getNeighborNodes(GraphNode node)
Returns the list of the nodes directly connected to node |
GraphNode |
getNode(java.lang.String nodeName)
Returns the node object representation given its name. |
java.util.Collection<GraphNode> |
getNodes()
getter for the vector holding all nodes of the map. |
java.lang.String |
getTeamName(int number)
Provides a numeric representation of the team name, null if the number does not correspond to any team. |
int |
getTeamNr(java.lang.String name)
Returns a numeric representation of the team name, -1 if the team has not been added to the teams list of the simulation. |
TeamState |
getTeamState(java.lang.String name)
Returns the state of team given its name. |
protected void |
populateMapsCahes()
Initialize the maps used as cache for faster data access. |
void |
setAgents(java.util.Vector<GraphSimulationAgentState> agents)
setter for the vector holding all agents that take part in the simulation. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected java.util.Vector<GraphNode> nodes
protected java.util.Vector<GraphEdge> edges
protected java.util.Map<GraphNode,java.util.List<GraphNode>> neighborsMap
protected java.util.Map<GraphNode,java.util.List<GraphEdge>> connectedEdgesMap
protected java.util.Map<java.lang.String,GraphSimulationAgentState> agentNamesMap
protected java.util.Map<java.lang.String,GraphNode> nodeNamesMap
protected java.util.Vector<GraphSimulationAgentState> agents
protected GraphSimulationConfiguration config
public java.util.Vector<TeamState> teamsStates
protected int sizeX
protected int sizeY
Constructor Detail |
---|
public GraphSimulationWorldState(GraphSimulationConfiguration config)
config
config
- Method Detail |
---|
protected void populateMapsCahes()
public java.util.Vector<GraphSimulationAgentState> getAgents()
public void setAgents(java.util.Vector<GraphSimulationAgentState> agents)
agents
- public GraphSimulationConfiguration getConfig()
public GraphSimulationAgentState getAgent(java.lang.String agentName)
agentName
-
public GraphNode getNode(java.lang.String nodeName)
nodeName
-
public java.util.List<GraphNode> getNeighborNodes(GraphNode node)
node
node
-
public java.util.List<GraphEdge> getConnectedEdges(GraphNode node)
node
node
-
public java.util.Collection<GraphNode> getNodes()
public void addAgent(GraphSimulationAgentState agent, java.util.Vector<java.lang.Integer> agentPositions, boolean newPosition)
agent
to the currently simulation, and situates it in a random node in the map.
agent
- public int getTeamNr(java.lang.String name)
name
-
public java.lang.String getTeamName(int number)
name
-
public TeamState getTeamState(java.lang.String name)
name
-
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |