| | 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> acceleration; |
---|
| | public void updateForce(Map.Entry<Double, Double> force) { |
---|
| | this.force = force; |
---|
| | Map.Entry<Double, Double> temp_l3; |
---|
| | if(this.onground.getOnground()) { |
---|
| | temp_l3 = new AbstractMap.SimpleEntry<>((force.getKey()/mass), 0.0); |
---|
| | } else { |
---|
| | temp_l3 = new AbstractMap.SimpleEntry<>((force.getKey()/mass), (force.getValue()/mass)); |
---|
| | } |
---|
| | acceleration = temp_l3; |
---|
| | velocity.updateAcceleration(acceleration); |
---|
| | } |
---|
| | public void updateMass(double mass) { |
---|
| | this.mass = mass; |
---|
| | Map.Entry<Double, Double> temp_l6; |
---|
| | if(this.onground.getOnground()) { |
---|
| | temp_l6 = new AbstractMap.SimpleEntry<>((force.getKey()/mass), 0.0); |
---|
| | } else { |
---|
| | temp_l6 = new AbstractMap.SimpleEntry<>((force.getKey()/mass), (force.getValue()/mass)); |
---|
| | } |
---|
| | acceleration = temp_l6; |
---|
| | velocity.updateAcceleration(acceleration); |
---|
| | } |
---|
| | public Acceleration(Velocity velocity, Onground onground) { |
---|
| | this.onground = onground; |
---|
| | } |
---|
| | public Map.Entry<Double, Double> getAcceleration() { |
---|
| | return acceleration; |
---|
| | } |
---|
| | private Pair<Double> force; |
---|
| | private double mass; |
---|
| | private Velocity velocity; |
---|
| | private Onground onground; |
---|
| | private Pair<Double> value; |
---|
| | |
---|
| | public void updateForce(Pair<Double> force) { |
---|
| | this.force = force; |
---|
| | Pari<Double> temp_l3; |
---|
| | if (this.onground.getOnground()) { |
---|
| | temp_l3 = new Pair<>((force.getFirst() / mass), 0.0); |
---|
| | } else { |
---|
| | temp_l3 = new Pair<>((force.getFirst() / mass), (force.getSecond() / mass)); |
---|
| | } |
---|
| | value = temp_l3; |
---|
| | velocity.updateAcceleration(value); |
---|
| | } |
---|
| | |
---|
| | public void updateMass(double mass) { |
---|
| | this.mass = mass; |
---|
| | Pair<Double> temp_l6; |
---|
| | if (this.onground.getOnground()) { |
---|
| | temp_l6 = new Pair<>((force.getFirst() / mass), 0.0); |
---|
| | } else { |
---|
| | temp_l6 = new Pair<>((force.getFirst() / mass), (force.getSecond() / mass)); |
---|
| | } |
---|
| | value = temp_l6; |
---|
| | velocity.updateAcceleration(value); |
---|
| | } |
---|
| | |
---|
| | public Acceleration(Velocity velocity, Onground onground) { |
---|
| | this.onground = onground; |
---|
| | } |
---|
| | |
---|
| | public Pair<Double> getValue() { |
---|
| | return value; |
---|
| | } |
---|
| | } |
---|
| | |
No description provided.
Feature/definition of pair
1f06d7b
intomaster
fromfeature/definition_of_pair
on 7 Dec 2021