diff --git a/src/Acceleration.java b/src/Acceleration.java index 882c0d8..181922b 100644 --- a/src/Acceleration.java +++ b/src/Acceleration.java @@ -1,4 +1,5 @@ -import java.util.*; +import java.util.AbstractMap; +import java.util.Map; public class Acceleration { private double mass; @@ -9,15 +10,21 @@ public void updateMass(double mass) { this.mass = mass; - acceleration = (getOnground() ? new AbstractMap.SimpleEntry<>((force.getKey() / mass), 0.0) - : new AbstractMap.SimpleEntry<>((force.getKey() / mass), (force.getValue() / mass))); + + if (getOnground()) + acceleration = new AbstractMap.SimpleEntry<>((force.getKey() / mass), 0.0); + else + acceleration = new AbstractMap.SimpleEntry<>((force.getKey() / mass), (force.getValue() / mass)); velocity.updateAcceleration(acceleration); } public void updateForce(Map.Entry force) { this.force = force; - acceleration = (getOnground() ? new AbstractMap.SimpleEntry<>((force.getKey() / mass), 0.0) - : new AbstractMap.SimpleEntry<>((force.getKey() / mass), (force.getValue() / mass))); + + if (getOnground()) + acceleration = new AbstractMap.SimpleEntry<>((force.getKey() / mass), 0.0); + else + acceleration = new AbstractMap.SimpleEntry<>((force.getKey() / mass), (force.getValue() / mass)); velocity.updateAcceleration(acceleration); }