import java.util.*; public class Velocity { private Map.Entry<Double, Double> move; private Map.Entry<Double, Double> acceleration; private Position position; private Onground onground; private Map.Entry<Double, Double> velocity; public void updateMove(Map.Entry<Double, Double> move) { this.move = move; Map.Entry<Double, Double> temp_l0; if((this.onground.getOnground()&&(move.getValue()>=0.0))) { temp_l0 = move; } else { temp_l0 = this.velocity; } velocity = temp_l0; position.updateVelocity(velocity); } public void updateAcceleration(Map.Entry<Double, Double> acceleration) { this.acceleration = acceleration; Map.Entry<Double, Double> temp_l2; if((this.onground.getOnground()&&(this.velocity.getValue()<0.0))) { temp_l2 = new AbstractMap.SimpleEntry<>((this.velocity.getKey()+(0.01*acceleration.getKey())), 0.0); } else { temp_l2 = new AbstractMap.SimpleEntry<>((this.velocity.getKey()+(0.01*acceleration.getKey())), (this.velocity.getValue()+(0.01*acceleration.getValue()))); } velocity = temp_l2; position.updateVelocity(velocity); } public Velocity(Position position, Onground onground) { this.onground = onground; } public Map.Entry<Double, Double> getVelocity() { return velocity; } }