import java.util.*; public class Velocity { private Pair<Double> move; private Pair<Double> acceleration; private Position position; private Onground onground; private Pair<Double> value; public void updateMove(Pair<Double> move) { this.move = move; Pair<Double> temp_l0; if((this.onground.getOnground()&&(move.getSecond()>=0.0))) { temp_l0 = move; } else { temp_l0 = this.value; } value = temp_l0; position.updateVelocity(value); } public void updateAcceleration(Pair<Double> acceleration) { this.acceleration = acceleration; Pair<Double> temp_l2; if((this.onground.getOnground()&&(this.value.getSecond()<0.0))) { temp_l2 = new Pair<>((this.value.getFirst()+(0.01*acceleration.getFirst())), 0.0); } else { temp_l2 = new Pair<>((this.value.getFirst()+(0.01*acceleration.getFirst())), (this.value.getSecond()+(0.01*acceleration.getSecond()))); } value = temp_l2; position.updateVelocity(value); } public Velocity(Position position, Onground onground) { this.onground = onground; } public Pair<Double> getValue() { return value; } }