Class Network
java.lang.Object
Network
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
Network
Constructs and initializes a network of nodes from a txt file. Every node is stored with its position and neighbours based on the radius.- Parameters:
readNodes- the scanner that reads the network txt file.radius- the distance that the node can reach its neighbours.
-
-
Method Details
-
getNode
Returns a node based on its position.- Parameters:
position- the position of the node that will be returned.- Returns:
- the node in the position.
-
getRandomNode
Returns a random node in the network.- Returns:
- a random node in the network.
-
getAllNodes
Returns all the nodes in the network as an array.- Returns:
- all the nodes as an array.
-
getTime
public int getTime()Returns the current time.- Returns:
- the time.
-
updateTime
public void updateTime()Updates the time 1 time unit. -
generateId
Returns a unique id string.- Returns:
- an id string.
-