import java.util.*; public class Acceleration { private double mass; private Map.Entry<Double, Double> force; private Velocity velocity; private Onground onground; private Map.Entry<Double, Double> acceleration; public void setMass(double mass) { this.mass = mass; } public void setForce(Map.Entry<Double, Double> force) { this.force = force; } public void updateAcceleration() { this.acceleration = (this.onground.getOnground() ? new AbstractMap.SimpleEntry<>((this.force.getKey() / this.mass), 0.0) : new AbstractMap.SimpleEntry<>((this.force.getKey() / this.mass), (this.force.getValue() / this.mass))); velocity.setAcceleration(acceleration); velocity.updateAcceleration(); } public Acceleration(Velocity velocity, Onground onground) { this.velocity = velocity; this.onground = onground; } public Map.Entry<Double, Double> getAcceleration() { return acceleration; } }