public class TrafficManager
extends java.lang.Object
Constructor and Description |
---|
TrafficManager()
Construct a new TrafficManager.
|
Modifier and Type | Method and Description |
---|---|
void |
cacheInformation(StandardWorldModel world)
Compute pre-cached information about the world.
|
void |
clear()
Remove all objects from this manager.
|
TrafficArea |
findArea(double x,
double y)
Find the area that contains a point.
|
java.util.Collection<TrafficAgent> |
getAgents()
Get all TrafficAgents.
|
java.util.Collection<TrafficArea> |
getAreas()
Get all TrafficAreas.
|
java.util.Collection<TrafficBlockade> |
getBlockades()
Get all TrafficBlockades.
|
java.util.Collection<TrafficAgent> |
getNearbyAgents(TrafficAgent agent)
Get all agents in the same area or a neighbouring area as an agent.
|
java.util.Collection<TrafficArea> |
getNeighbours(TrafficArea area)
Get the neighbouring areas to a TrafficArea.
|
TrafficAgent |
getTrafficAgent(Human h)
Get the TrafficAgent that wraps a given human.
|
TrafficArea |
getTrafficArea(Area a)
Get the TrafficArea that wraps a given Area.
|
TrafficBlockade |
getTrafficBlockade(Blockade b)
Get the TrafficBlockade that wraps a given Blockade.
|
void |
register(TrafficAgent agent)
Register a new TrafficAgent.
|
void |
register(TrafficArea area)
Register a new TrafficArea.
|
void |
register(TrafficBlockade block)
Register a new TrafficBlockade.
|
void |
remove(Blockade block)
Remove a blockade.
|
void |
remove(TrafficBlockade block)
Remove a blockade.
|
public TrafficArea findArea(double x, double y)
x
- The X coordinate.y
- The Y coordinate.public java.util.Collection<TrafficArea> getNeighbours(TrafficArea area)
area
- The area to look up.public java.util.Collection<TrafficAgent> getNearbyAgents(TrafficAgent agent)
agent
- The agent to look up.public void clear()
public void register(TrafficArea area)
area
- The TrafficArea to register.public void register(TrafficAgent agent)
agent
- The TrafficAgent to register.public void register(TrafficBlockade block)
block
- The TrafficBlockade to register.public void remove(TrafficBlockade block)
block
- The TrafficBlockade to remove.public void remove(Blockade block)
block
- The Blockade to remove.public java.util.Collection<TrafficAgent> getAgents()
public java.util.Collection<TrafficArea> getAreas()
public java.util.Collection<TrafficBlockade> getBlockades()
public void cacheInformation(StandardWorldModel world)
register(TrafficArea)
and register(TrafficAgent)
.world
- The world model.public TrafficArea getTrafficArea(Area a)
a
- The area to look up.public TrafficBlockade getTrafficBlockade(Blockade b)
b
- The blockade to look up.public TrafficAgent getTrafficAgent(Human h)
h
- The human to look up.