|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectou3.Map
public class Map
A map consisting of a matrix of nodes.
Field Summary | |
---|---|
private int |
agentMaxSteps
The maximum amount of steps an Agent is allowed to take. |
private double |
agentProbability
A number representing the probability of an Agent being created. |
private java.util.ArrayList<java.util.ArrayList<Node>> |
nodeList
Contains all nodes in the map. |
private int |
nOfEvents
The number of events detected in the map. |
private int |
nOfRequestNodes
The number of nodes designated to create requests. |
private int |
requestMaxSteps
The maximum amount of steps an Request is allowed to take. |
private java.util.ArrayList<Node> |
requestNodes
Contains the request nodes. |
private int |
time
The amount of timesteps taken by the map |
private int |
xSize
The width of the map |
private int |
ySize
The height of the map |
Constructor Summary | |
---|---|
Map(int xSize,
int ySize)
Creates a map. |
Method Summary | |
---|---|
private java.util.ArrayList<java.util.ArrayList<Node>> |
createNodeList()
Returns an array of nodes. |
private void |
createRequest()
Creates a request in the four request nodes and randomizes what event the requests will be searching for. |
private void |
detectEvents()
Detects if any events are created. |
java.util.ArrayList<Node> |
getNeighbours(Position pos)
Returns the neighbours of a node given its position. |
private java.util.ArrayList<Node> |
getRequestNodes()
Selects four random nodes from the nodeList and returns an ArrayList containing them. |
int |
tick()
Advances all the nodes on the map a timestep and detects if any events are created. |
private void |
tickNodes()
Advances all the nodes on the map a timestep. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private java.util.ArrayList<java.util.ArrayList<Node>> nodeList
private int time
private int xSize
private int ySize
private int nOfEvents
private final int nOfRequestNodes
private java.util.ArrayList<Node> requestNodes
private final double agentProbability
private final int agentMaxSteps
private final int requestMaxSteps
Constructor Detail |
---|
public Map(int xSize, int ySize)
int
- xSizeint
- ySizeMethod Detail |
---|
private java.util.ArrayList<java.util.ArrayList<Node>> createNodeList()
private java.util.ArrayList<Node> getRequestNodes()
public java.util.ArrayList<Node> getNeighbours(Position pos) throws java.lang.IndexOutOfBoundsException
Position
- pos
java.lang.Exception
java.lang.IndexOutOfBoundsException
public int tick()
private void detectEvents()
private void createRequest()
private void tickNodes()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |