| | import java.util.*; |
---|
| | |
---|
| | public class Acceleration { |
---|
| | private Map.Entry<Double, Double> force; |
---|
| | private double mass; |
---|
| | private Velocity velocity; |
---|
| | private Onground onground; |
---|
| | private Map.Entry<Double, Double> value; |
---|
| | public void updateForce(Map.Entry<Double, Double> force) { |
---|
| | this.force = force; |
---|
| | Map.Entry<Double, Double> temp_l4; |
---|
| | if(this.onground.getValue()) { |
---|
| | temp_l4 = new AbstractMap.SimpleEntry<>((force.getKey()/mass), 0.0); |
---|
| | } else { |
---|
| | temp_l4 = new AbstractMap.SimpleEntry<>((force.getKey()/mass), (force.getValue()/mass)); |
---|
| | } |
---|
| | acceleration = temp_l4; |
---|
| | velocity.updateAcceleration(value); |
---|
| | } |
---|
| | public void updateMass(double mass) { |
---|
| | this.mass = mass; |
---|
| | Map.Entry<Double, Double> temp_l5; |
---|
| | if(this.onground.getValue()) { |
---|
| | temp_l5 = new AbstractMap.SimpleEntry<>((force.getKey()/mass), 0.0); |
---|
| | } else { |
---|
| | temp_l5 = new AbstractMap.SimpleEntry<>((force.getKey()/mass), (force.getValue()/mass)); |
---|
| | } |
---|
| | acceleration = temp_l5; |
---|
| | velocity.updateAcceleration(value); |
---|
| | } |
---|
| | public Acceleration(Velocity velocity, Onground onground) { |
---|
| | this.onground = onground; |
---|
| | } |
---|
| | public Map.Entry<Double, Double> getValue() { |
---|
| | return value; |
---|
| | } |
---|
| | } |
---|
| | |