diff --git a/app/src/main/java/de/hems/trafficsim/Track.java b/app/src/main/java/de/hems/trafficsim/Track.java new file mode 100644 index 0000000..d08685b --- /dev/null +++ b/app/src/main/java/de/hems/trafficsim/Track.java @@ -0,0 +1,16 @@ +package de.hems.trafficsim; + +import java.util.LinkedList; +import java.util.List; + +public class Track { + protected List vehicles; + + public Track() { + this.vehicles = new LinkedList<>(); + } + + public void timeElapse(float timeStep) { + + } +} diff --git a/app/src/main/java/de/hems/trafficsim/Vehicle.java b/app/src/main/java/de/hems/trafficsim/Vehicle.java new file mode 100644 index 0000000..b316f42 --- /dev/null +++ b/app/src/main/java/de/hems/trafficsim/Vehicle.java @@ -0,0 +1,35 @@ +package de.hems.trafficsim; + +public class Vehicle { + protected float position; + protected float curVelocity; + protected float maxVelocity; + + public void setForerunner(Vehicle forerunner) { + this.forerunner = forerunner; + } + + protected Vehicle forerunner; + + public float getPosition() { + return position; + } + + public float getCurVelocity() { + return curVelocity; + } + + protected float brakeProp; + + public Vehicle(float position, float maxVelocity, float brakeProp) { + this.position = position; + this.maxVelocity = maxVelocity; + this.brakeProp = brakeProp; + this.curVelocity = 0; + this.forerunner = null; + } + + public void timeElapse(float timeStep) { + + } +} diff --git a/app/src/main/java/de/hems/trafficsim/VehicleTimeRecord.java b/app/src/main/java/de/hems/trafficsim/VehicleTimeRecord.java new file mode 100644 index 0000000..c3ae160 --- /dev/null +++ b/app/src/main/java/de/hems/trafficsim/VehicleTimeRecord.java @@ -0,0 +1,25 @@ +package de.hems.trafficsim; + +public class VehicleTimeRecord { + public float getPosition() { + return position; + } + + public float getVelocity() { + return velocity; + } + + public float getTimestep() { + return timestep; + } + + protected float position; + protected float velocity; + protected float timestep; + + public VehicleTimeRecord(float position, float velocity, float timestep) { + this.position = position; + this.velocity = velocity; + this.timestep = timestep; + } +} diff --git a/doc/classdiagram.graphml b/doc/classdiagram.graphml index 3e53e8a..b3a2c25 100644 --- a/doc/classdiagram.graphml +++ b/doc/classdiagram.graphml @@ -13,55 +13,52 @@ - + - - + - Vehicle + Vehicle - position: float -curVelocity: float -maxVelocity: float -brakeProp: float - timeElapse(timestep: int): void + # position: float +# curVelocity: float +# maxVelocity: float +# brakeProp: float + + timeElapse(timestep: float): void - - + Track - timeElapse(timestep: int): void + + timeElapse(timestep: float): void - - + VehicleTimeRecord - position: float -velocity: float -timestep: int + # position: float +# velocity: float +# timestep: float @@ -69,7 +66,6 @@ timestep: int - @@ -81,7 +77,6 @@ timestep: int - @@ -91,6 +86,22 @@ timestep: int + + + + + + + + + + + # forerunner + + + +