diff --git a/src/Acceleration.java b/src/Acceleration.java index 3bccc68..7201f71 100644 --- a/src/Acceleration.java +++ b/src/Acceleration.java @@ -6,19 +6,30 @@ private Velocity velocity; private Onground onground; private Map.Entry acceleration; - public void updateMass(double mass) { + + public void setMass(double mass) { this.mass = mass; - acceleration = (this.onground.getOnground() ? new AbstractMap.SimpleEntry<>((force.getKey()/mass), 0.0) : new AbstractMap.SimpleEntry<>((force.getKey()/mass), (force.getValue()/mass))); - velocity.updateAcceleration(acceleration); } - public void updateForce(Map.Entry force) { + + public void setForce(Map.Entry force) { this.force = force; - acceleration = (this.onground.getOnground() ? new AbstractMap.SimpleEntry<>((force.getKey()/mass), 0.0) : new AbstractMap.SimpleEntry<>((force.getKey()/mass), (force.getValue()/mass))); - velocity.updateAcceleration(acceleration); } + + 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 getAcceleration() { return acceleration; }