| | 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 updateMass(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<Double, Double> 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 Acceleration(Velocity velocity, Onground onground) { |
---|
| | this.onground = onground; |
---|
| | } |
---|
| | public Map.Entry<Double, Double> getAcceleration() { |
---|
| | return acceleration; |
---|
| | } |
---|
| | } |
---|
| | |