diff --git a/src/Acceleration.java b/src/Acceleration.java new file mode 100644 index 0000000..8a8aef6 --- /dev/null +++ b/src/Acceleration.java @@ -0,0 +1,37 @@ +import java.util.*; + +public class Acceleration { + private Map.Entry force; + private double mass; + private Velocity velocity; + private Onground onground; + private Map.Entry acceleration; + public void updateForce(Map.Entry force) { + this.force = force; + Map.Entry temp_l3; + if(this.onground.getOnground()) { + temp_l3 = new AbstractMap.SimpleEntry<>((force.getKey()/mass), 0.0); + } else { + temp_l3 = new AbstractMap.SimpleEntry<>((force.getKey()/mass), (force.getValue()/mass)); + } + acceleration = temp_l3; + velocity.updateAcceleration(acceleration); + } + public void updateMass(double mass) { + this.mass = mass; + Map.Entry temp_l6; + if(this.onground.getOnground()) { + temp_l6 = new AbstractMap.SimpleEntry<>((force.getKey()/mass), 0.0); + } else { + temp_l6 = new AbstractMap.SimpleEntry<>((force.getKey()/mass), (force.getValue()/mass)); + } + acceleration = temp_l6; + velocity.updateAcceleration(acceleration); + } + public Acceleration(Velocity velocity, Onground onground) { + this.onground = onground; + } + public Map.Entry getAcceleration() { + return acceleration; + } +} \ No newline at end of file