Compare commits

..

No commits in common. "58054d6eea47989c8b44e02b8d3b077541775dd2" and "bffcddf6e2c55fbcb71b880720dc0464410ed8e4" have entirely different histories.

2 changed files with 4 additions and 11 deletions

View File

@ -1,13 +1,11 @@
package de.hems.trafficsim;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
import java.util.Observable;
public class Track extends Observable {
protected List<Vehicle> vehicles;
protected List<List<VehicleTimeRecord>> vtr_list;
protected float trackLength;
public List<Vehicle> getVehicles() {
@ -21,7 +19,7 @@ public class Track extends Observable {
public Track(int numberVehicles, float trackLength) {
this.trackLength = trackLength;
this.vehicles = createVehiclesList(numberVehicles);
this.vtr_list = new LinkedList<>();
}
protected List<Vehicle> createVehiclesList(int numberVehicles){
@ -48,12 +46,9 @@ public class Track extends Observable {
}
v.updateVelocity(distanceForerunner);
}
List <VehicleTimeRecord> records = new ArrayList<>(vehicles.size());
this.vtr_list.add(records);
for(Vehicle v: vehicles){
v.timeElapse(50);
VehicleTimeRecord vtr = new VehicleTimeRecord(v.id, v.position, v.curVelocity, timeStep);
records.add(vtr);
}
this.setChanged();

View File

@ -13,14 +13,12 @@ public class VehicleTimeRecord {
return timestep;
}
protected int id;
protected float position;
protected float velocity;
protected float timestep;
public VehicleTimeRecord(int id, float position, float velocity, float timestep) {
this.id = id;
this.position = position; //needed???
public VehicleTimeRecord(float position, float velocity, float timestep) {
this.position = position;
this.velocity = velocity;
this.timestep = timestep;
}