import java.util.*; public class Position { private Ground ground; private Pair<Double> position; public void updateVelocity(Pair<Double> velocity) { Pair<Double> temp_l4; if(((this.ground.getGround()==true)&&((this.position.getSecond()+(0.01*velocity.getSecond()))<0.0))) { temp_l4 = new Pair<>((this.position.getFirst()+(0.01*velocity.getFirst())), 0.0); } else { temp_l4 = new Pair<>((this.position.getFirst()+(0.01*velocity.getFirst())), (this.position.getSecond()+(0.01*velocity.getSecond()))); } position = temp_l4; } public Position(Ground ground) { this.ground = ground; } public Pair<Double> getPosition() { return position; } }