Skip to content

Commit

Permalink
Removed CrossRoad and Direction classes
Browse files Browse the repository at this point in the history
  • Loading branch information
lutzilutz committed May 24, 2019
1 parent 8937d12 commit fbba9ec
Show file tree
Hide file tree
Showing 8 changed files with 1 addition and 371 deletions.
224 changes: 0 additions & 224 deletions src/elements/CrossRoad.java

This file was deleted.

7 changes: 0 additions & 7 deletions src/elements/Direction.java

This file was deleted.

14 changes: 0 additions & 14 deletions src/elements/MultiLaneRoundAbout.java
Original file line number Diff line number Diff line change
Expand Up @@ -90,13 +90,6 @@ public void generateRidesAux(int n, Ride ride) {
this.removeLastGoInGoOutConnections(ride);
}
}
for (CrossRoad cr: this.n.getCrossRoads()) {
if (e.getName().equals(cr.getName())) {
ride.addNextConnection(e.clone());
cr.generateRidesAux(n-1, ride);
this.removeLastGoInGoOutConnections(ride);
}
}
this.removeLastGoInGoOutConnections(ride);

++ laneInt;
Expand Down Expand Up @@ -132,13 +125,6 @@ public void generateRidesAux(int n, Ride ride) {
this.removeLastGoInGoOutConnections(ride);
}
}
for (CrossRoad cr: this.n.getCrossRoads()) {
if (e.getName().equals(cr.getName())) {
ride.addNextConnection(e.clone());
cr.generateRidesAux(n-1, ride);
this.removeLastGoInGoOutConnections(ride);
}
}
this.removeLastGoInGoOutConnections(ride);

++ laneInt;
Expand Down
24 changes: 0 additions & 24 deletions src/elements/Road.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import java.awt.Point;
import java.util.ArrayList;
import java.util.EnumSet;

import data.VehicleCounter;
import network.Network;
Expand All @@ -22,7 +21,6 @@ public class Road {
private ArrayList<Cell> roadCells = new ArrayList<Cell>(); // list of cells that compose the road
private ArrayList<Float> flow = new ArrayList<Float>();
private boolean isTrafficLightRed = false; // if there is a traffic light on road and is red: true
private EnumSet<Direction> directions;
private ArrayList<Point> reorientations = new ArrayList<Point>();
private int maxOutflow = 0; // maximum outflow, in seconds between 2 vehicles
private int outflowCounter = 0; // outflow counter
Expand Down Expand Up @@ -366,22 +364,6 @@ public void generateRidesAux(int n, Ride ride) {
}
}
}
for (CrossRoad cr: this.n.getCrossRoads()) {
if (e.getName().equals(cr.getName())) {
for(Connection c: ride.getNextConnections()) {
if (c.getName().equals(cr.getName())) {
if (!ride.getNextConnections().isEmpty()) {
ride.removeLastConnection();
this.removeLastGoInGoOutConnections(ride);
}
return;
}
}

ride.addNextConnection(e.clone());
cr.generateRidesAux(n-1, ride);
}
}
}
if (this.getRoadCells().get(this.getLength()-1).getNextCell() == null && this.getRoadCells().get(this.getLength()-1).getOutCell() == null) {
this.n.addARideToAllNetworkRides(ride.clone());
Expand Down Expand Up @@ -504,12 +486,6 @@ public boolean isTrafficLightRed() {
public void setTrafficLightRed(boolean isTrafficLightRed) {
this.isTrafficLightRed = isTrafficLightRed;
}
public EnumSet<Direction> getDirections() {
return directions;
}
public void setDirections(EnumSet<Direction> directions) {
this.directions = directions;
}
public String getName() {
return name;
}
Expand Down
6 changes: 0 additions & 6 deletions src/elements/RoundAbout.java
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,6 @@ public void generateRidesAux(int n, Ride ride) {
ra.generateRidesAux(n-1, ride);
}
}
for (CrossRoad cr: this.n.getCrossRoads()) {
if (e.getName().equals(cr.getName())) {
ride.addNextConnection(e.clone());
cr.generateRidesAux(n-1, ride);
}
}
}
if (this.getRoadCells().get(this.getLength()-1).getNextCell() == null && this.getRoadCells().get(this.getLength()-1).getOutCell() == null) {
this.n.addARideToAllNetworkRides(ride.clone());
Expand Down
10 changes: 0 additions & 10 deletions src/network/Network.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

import elements.Cell;
import elements.Connection;
import elements.CrossRoad;
import elements.MaxVehicleOutflow;
import elements.MultiLaneRoundAbout;
import elements.Phase;
Expand All @@ -31,7 +30,6 @@ public class Network {
private ArrayList<Road> roads = new ArrayList<Road>(); // list of all roads
private ArrayList<MultiLaneRoundAbout> multiLaneRoundAbouts = new ArrayList<MultiLaneRoundAbout>(); // list of all multilane round-abouts
private ArrayList<RoundAbout> roundAbouts = new ArrayList<RoundAbout>(); // list of all round-abouts
private ArrayList<CrossRoad> crossRoads = new ArrayList<CrossRoad>(); // list of all cross-roads
private ArrayList<TrafficLightsSystem> trafficLightsSystems = new ArrayList<TrafficLightsSystem>(); // list of all traffic lights
private ArrayList<AllNetworkRides> allNetworkRides = new ArrayList<AllNetworkRides>(); // list of all rides
private ArrayList<Vehicle> vehicles = new ArrayList<Vehicle>(); // list of all vehicles
Expand Down Expand Up @@ -1213,11 +1211,6 @@ public void restart() {
cell.setVehicle(null);
}
}
for (CrossRoad cr: crossRoads) {
for (Cell cell: cr.getMiddleCells()) {
cell.setVehicle(null);
}
}
numberOfVehicles = 0;
}
// Getters & setters ====================================================================================
Expand Down Expand Up @@ -1281,9 +1274,6 @@ public void setyOffset(double yOffset) {
public Simulator getSimulation() {
return this.sim;
}
public ArrayList<CrossRoad> getCrossRoads() {
return this.crossRoads;
}
public ArrayList<Road> getRoads() {
return this.roads;
}
Expand Down
Loading

0 comments on commit fbba9ec

Please # to comment.