Feature/definition of pair #1

Merged k-fujii merged 4 commits into k-fujii:master from k-fujii:feature/definition_of_pair on 7 Dec 2021
Showing 13 changed files
View
74
src/Acceleration.java
import java.util.*;
 
public class Acceleration {
private Map.Entry<Double, Double> force;
private double mass;
private Velocity velocity;
private Onground onground;
private Map.Entry<Double, Double> acceleration;
public void updateForce(Map.Entry<Double, Double> force) {
this.force = force;
Map.Entry<Double, Double> temp_l3;
if(this.onground.getOnground()) {
temp_l3 = new AbstractMap.SimpleEntry<>((force.getKey()/mass), 0.0);
} else {
temp_l3 = new AbstractMap.SimpleEntry<>((force.getKey()/mass), (force.getValue()/mass));
}
acceleration = temp_l3;
velocity.updateAcceleration(acceleration);
}
public void updateMass(double mass) {
this.mass = mass;
Map.Entry<Double, Double> temp_l6;
if(this.onground.getOnground()) {
temp_l6 = new AbstractMap.SimpleEntry<>((force.getKey()/mass), 0.0);
} else {
temp_l6 = new AbstractMap.SimpleEntry<>((force.getKey()/mass), (force.getValue()/mass));
}
acceleration = temp_l6;
velocity.updateAcceleration(acceleration);
}
public Acceleration(Velocity velocity, Onground onground) {
this.onground = onground;
}
public Map.Entry<Double, Double> getAcceleration() {
return acceleration;
}
private Pair<Double> force;
private double mass;
private Velocity velocity;
private Onground onground;
private Pair<Double> value;
 
public void updateForce(Pair<Double> force) {
this.force = force;
Pari<Double> temp_l3;
if (this.onground.getOnground()) {
temp_l3 = new Pair<>((force.getFirst() / mass), 0.0);
} else {
temp_l3 = new Pair<>((force.getFirst() / mass), (force.getSecond() / mass));
}
value = temp_l3;
velocity.updateAcceleration(value);
}
 
public void updateMass(double mass) {
this.mass = mass;
Pair<Double> temp_l6;
if (this.onground.getOnground()) {
temp_l6 = new Pair<>((force.getFirst() / mass), 0.0);
} else {
temp_l6 = new Pair<>((force.getFirst() / mass), (force.getSecond() / mass));
}
value = temp_l6;
velocity.updateAcceleration(value);
}
 
public Acceleration(Velocity velocity, Onground onground) {
this.onground = onground;
}
 
public Pair<Double> getValue() {
return value;
}
}
View
2
■■■
src/Clear.java
this.position = position;
}
public boolean getClear() {
boolean temp_l1;
if((this.position.getPosition().getKey()>100.0)) {
if((this.position.getPosition().getFirst()>100.0)) {
temp_l1 = true;
} else {
temp_l1 = false;
}
View
10
src/Force.java
import java.util.*;
 
public class Force {
private Acceleration acceleration;
private Map.Entry<Double, Double> force;
private Pair<Double> value;
public Force(Acceleration acceleration) {
this.acceleration = acceleration;
}
public void gravity(double y) {
this.force = new AbstractMap.SimpleEntry<>(0.0, y);
acceleration.updateForce(force);
this.value = new Pair<>(0.0, y);
acceleration.updateForce(value);
}
public Map.Entry<Double, Double> getForce() {
return force;
public Pair<Double> getValue() {
return value;
}
}
View
src/Gameover.java
View
src/Ground.java
View
src/JumpGame.java
View
src/Mass.java
View
src/Move.java
View
src/Onground.java
View
src/Pair.java 0 → 100644
View
src/Position.java
View
src/Time.java
View
src/Velocity.java