package entities; import java.util.*; public class Acceleration { private Pair<Double> force = new Pair<>(0.0,0.0); private double mass = 1.0; private Velocity velocity; private Onground onground; private Pair<Double> value = new Pair<>(0.0,0.0); public void updateForce(Pair<Double> force) { this.force = force; Pair<Double> temp_if0; if (this.onground.getValue()) { temp_if0 = new Pair<>((force.getLeft()/mass),0.0); } else { temp_if0 = new Pair<>((force.getLeft()/mass),(force.getRight()/mass)); } value = temp_if0; velocity.updateAcceleration(value); } public void updateMass(double mass) { this.mass = mass; Pair<Double> temp_if2; if (this.onground.getValue()) { temp_if2 = new Pair<>((force.getLeft()/mass),0.0); } else { temp_if2 = new Pair<>((force.getLeft()/mass),(force.getRight()/mass)); } value = temp_if2; velocity.updateAcceleration(value); } public Acceleration(Velocity velocity, Onground onground) { this.velocity = velocity; this.onground = onground; } public Pair<Double> getValue() { return value; } }