public class Acceleration { private double mass; private Pair<Double> force; private Velocity velocity; private Onground onground; private Pair<Double> acceleration; public void updateMass(double mass) { this.mass = mass; acceleration = (this.onground.getOnground() ? new Pair<>((force.getX() / mass), 0.0) : new Pair<>((force.getX() / mass), (force.getY() / mass))); velocity.updateAcceleration(acceleration); } public void updateForce(Pair<Double> force) { this.force = force; acceleration = (this.onground.getOnground() ? new Pair<>((force.getX() / mass), 0.0) : new Pair<>((force.getX() / mass), (force.getY() / mass))); velocity.updateAcceleration(acceleration); } public Acceleration(Velocity velocity, Onground onground) { this.velocity = velocity; this.onground = onground; } public Pair<Double> getAcceleration() { return acceleration; } }