import java.util.*;
public class Velocity {
private Map.Entry<Double, Double> moveValue;
private Map.Entry<Double, Double> accelerationValue;
private Position position;
private Onground onground;
private Map.Entry<Double, Double> value;
public void updateByMove(Map.Entry<Double, Double> move) {
this.moveValue = move;
Map.Entry<Double, Double> temp_l2;
if ((this.onground.getOnground() && (move.getValue() >= 0.0))) {
temp_l2 = move;
} else {
temp_l2 = this.value;
}
value = temp_l2;
position.updateByVelocity(value);
}
public void updateByAcceleration(Map.Entry<Double, Double> acceleration) {
this.accelerationValue = acceleration;
Map.Entry<Double, Double> temp_l5;
if ((this.onground.getOnground() && (this.value.getValue() < 0.0))) {
temp_l5 = new AbstractMap.SimpleEntry<>((this.value.getKey() + (0.01 * acceleration.getKey())), 0.0);
} else {
temp_l5 = new AbstractMap.SimpleEntry<>((this.value.getKey() + (0.01 * acceleration.getKey())), (this.value.getValue() + (0.01 * acceleration.getValue())));
}
value = temp_l5;
position.updateByVelocity(value);
}
public Velocity(Position position, Onground onground) {
this.position = position;
this.onground = onground;
}
public Map.Entry<Double, Double> getValue() {
return value;
}
}