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