Skip to content

Network.java

Raphael Lutz edited this page Jul 12, 2018 · 7 revisions

Represents the road network. Builds the network, roads, round-abouts and crossroads.

Fields

  • Simulation sim : contains a link to the Simulation instance (managing the simulation itself)
  • ArrayList<Road> roads = new ArrayList<Road>() : contains all Roads of the network.
  • ArrayList<RoundAbout> roundAbouts = new ArrayList<RoundAbout>() : contains all RoundAbouts of the network.
  • ArrayList<CrossRoad> crossRoads = new ArrayList<CrossRoad>() : contains all CrossRoads of the network.
  • int cellWidth=10, cellHeight=cellWidth : dimensions of a Cell in the simulation.
  • boolean drawWire = true : tells if cells borders are rendered
  • boolean drawColors = true : tells if color codes are rendered
  • boolean drawRoadID = false : tells if roads IDs are rendered

Methods

  • Network(Simulation sim) : constructor of the Network, create the whole network
  • void switchDrawWire() : switch the value of drawWire
  • void switchDrawColors() : switch the value of drawColors
  • void switchDrawRoadID() : switch the value of drawRoadID
  • Simulation getSimulation() : getter for sim
  • ArrayList<CrossRoad> getCrossRoads() : getter for crossRoads
  • ArrayList<Road> getRoads() : getter for roads
  • ArrayList<RoundAbout> getRoundAbouts() : getter for roundAbouts
  • boolean getDrawWire() : getter for drawWire
  • boolean getDrawColors() : getter for drawColors
  • boolean getDrawRoadID() : getter for drawRoadID
  • void addRoadtoRoads(Road r) : add the road r to the array list roads
  • int getCellWidth() : getter for cellWidth
  • void setCellWidth(int cellWidth) : setter for cellWidth
  • int getCellHeight() : getter for cellHeight
  • void setCellHeight(int cellHeight) : setter for cellHeight
Clone this wiki locally