Merge pull request #2 from nitta-lab/update_resources
Update resources
commit e7b2ea64d1793baf5f5c2d0d0159cdfec352af34
2 parents 7bed4b4 + 09838bb
fujii kouta authored on 11 Nov 2021
Showing 12 changed files
View
74
src/Acceleration.java
import java.util.*;
 
public class Acceleration {
private double mass;
private Map.Entry<Double, Double> force;
private Velocity velocity;
private Onground onground;
private Map.Entry<Double, Double> acceleration;
public void updateMass(double mass) {
this.mass = mass;
acceleration = (this.onground.getOnground() ? new AbstractMap.SimpleEntry<>((force.getKey()/mass), 0.0) : new AbstractMap.SimpleEntry<>((force.getKey()/mass), (force.getValue()/mass)));
velocity.updateAcceleration(acceleration);
}
public void updateForce(Map.Entry<Double, Double> force) {
this.force = force;
acceleration = (this.onground.getOnground() ? new AbstractMap.SimpleEntry<>((force.getKey()/mass), 0.0) : new AbstractMap.SimpleEntry<>((force.getKey()/mass), (force.getValue()/mass)));
velocity.updateAcceleration(acceleration);
}
public Acceleration(Velocity velocity, Onground onground) {
this.onground = onground;
}
public Map.Entry<Double, Double> getAcceleration() {
return acceleration;
}
private double massValue;
private Map.Entry<Double, Double> forceValue;
private Velocity velocity;
private Onground onground;
private Map.Entry<Double, Double> value;
 
public void updateByMass(double mass) {
this.massValue = mass;
Map.Entry<Double, Double> temp_l0;
if (this.onground.getOnground()) {
temp_l0 = new AbstractMap.SimpleEntry<>((forceValue.getKey() / mass), 0.0);
} else {
temp_l0 = new AbstractMap.SimpleEntry<>((forceValue.getKey() / mass), (forceValue.getValue() / mass));
}
value = temp_l0;
velocity.updateByAcceleration(value);
}
 
public void updateByForce(Map.Entry<Double, Double> force) {
this.forceValue = force;
Map.Entry<Double, Double> temp_l1;
if (this.onground.getOnground()) {
temp_l1 = new AbstractMap.SimpleEntry<>((force.getKey() / massValue), 0.0);
} else {
temp_l1 = new AbstractMap.SimpleEntry<>((force.getKey() / massValue), (force.getValue() / massValue));
}
value = temp_l1;
velocity.updateByAcceleration(value);
}
 
public Acceleration(Velocity velocity, Onground onground) {
this.onground = onground;
}
 
public Map.Entry<Double, Double> getValue() {
return value;
}
}
View
30
src/Clear.java
import java.util.*;
public class Clear {
private Position position;
 
public class Clear {
private Position position;
public Clear(Position position) {
this.position = position;
}
public boolean getClear() {
return ((this.position.getPosition().getKey()>100.0) ? true : false);
}
public Clear(Position position) {
this.position = position;
}
 
public boolean getClear() {
boolean temp_l4;
if ((this.position.getValue().getKey() > 100.0)) {
temp_l4 = true;
} else {
temp_l4 = false;
}
return temp_l4;
}
}
View
30
src/Force.java
import java.util.*;
 
public class Force {
private Acceleration acceleration;
private Map.Entry<Double, Double> force;
public Force(Acceleration acceleration) {
this.acceleration = acceleration;
}
public void gravity(double y) {
this.force = new AbstractMap.SimpleEntry<>(0.0, y);
acceleration.updateForce(force);
}
public Map.Entry<Double, Double> getForce() {
return force;
}
private Acceleration acceleration;
private Map.Entry<Double, Double> value;
 
public Force(Acceleration acceleration) {
this.acceleration = acceleration;
}
 
public void gravity(double y) {
this.value = new AbstractMap.SimpleEntry<>(0.0, y);
acceleration.updateByForce(value);
}
 
public Map.Entry<Double, Double> getValue() {
return value;
}
}
View
30
src/Gameover.java
import java.util.*;
public class Gameover {
private Position position;
 
public class Gameover {
private Position position;
public Gameover(Position position) {
this.position = position;
}
public boolean getGameover() {
return ((this.position.getPosition().getValue()<-(1.0)) ? true : false);
}
public Gameover(Position position) {
this.position = position;
}
 
public boolean getGameover() {
boolean temp_l6;
if ((this.position.getValue().getValue() < -(1.0))) {
temp_l6 = true;
} else {
temp_l6 = false;
}
return temp_l6;
}
}
View
22
src/Ground.java
import java.util.*;
public class Ground {
private boolean value;
 
public class Ground {
private Position position;
private boolean ground;
public Ground(Position position) {
this.position = position;
}
public boolean getGround() {
return ground;
}
public boolean getValue() {
return value;
}
}
View
144
src/JumpGame.java
import java.util.*;
 
public class JumpGame {
private Time time = new Time();
private Position position = new Position();
private Gameover gameover = new Gameover(position);
private Ground ground = new Ground(position);
private Onground onground = new Onground(ground,position);
private Velocity velocity = new Velocity(position,onground);
private Clear clear = new Clear(position);
private Move move = new Move(velocity);
private Acceleration acceleration = new Acceleration(velocity,onground);
private Force force = new Force(acceleration);
private Mass mass = new Mass(acceleration);
public void gravity(double y) {
this.force.gravity(y);
this.time.gravity(y);
}
public void moveY(double y) {
this.move.moveY(y);
}
public void moveX(double x) {
this.move.moveX(x);
}
public void setMass(double x) {
this.mass.setMass(x);
}
public Map.Entry<Double, Double> getAcceleration() {
return acceleration.getAcceleration();
}
public Map.Entry<Double, Double> getMove() {
return move.getMove();
}
public double getMass() {
return mass.getMass();
}
public boolean getClear() {
return clear.getClear();
}
public boolean getGround() {
return ground.getGround();
}
public Map.Entry<Double, Double> getForce() {
return force.getForce();
}
public Map.Entry<Double, Double> getVelocity() {
return velocity.getVelocity();
}
public Map.Entry<Double, Double> getPosition() {
return position.getPosition();
}
public boolean getOnground() {
return onground.getOnground();
}
public double getTime() {
return time.getTime();
}
public boolean getGameover() {
return gameover.getGameover();
}
private Time time = new Time();
private Ground ground = new Ground();
private Position position = new Position(ground);
private Gameover gameover = new Gameover(position);
private Onground onground = new Onground(ground, position);
private Velocity velocity = new Velocity(position, onground);
private Clear clear = new Clear(position);
private Move move = new Move(velocity);
private Acceleration acceleration = new Acceleration(velocity, onground);
private Force force = new Force(acceleration);
private Mass mass = new Mass(acceleration);
 
public void gravity(double y) {
this.force.gravity(y);
this.time.gravity(y);
}
 
public void moveX(double x) {
this.move.moveX(x);
}
 
public void moveY(double y) {
this.move.moveY(y);
}
 
public void setMass(double x) {
this.mass.setValue(x);
}
 
public Map.Entry<Double, Double> getAcceleration() {
return acceleration.getValue();
}
 
public Map.Entry<Double, Double> getMove() {
return move.getValue();
}
 
public double getMass() {
return mass.getValue();
}
 
public boolean getClear() {
return clear.getClear();
}
 
public boolean getGround() {
return ground.getValue();
}
 
public Map.Entry<Double, Double> getForce() {
return force.getValue();
}
 
public Map.Entry<Double, Double> getVelocity() {
return velocity.getValue();
}
 
public Map.Entry<Double, Double> getPosition() {
return position.getValue();
}
 
public boolean getOnground() {
return onground.getOnground();
}
 
public double getTime() {
return time.getValue();
}
 
public boolean getGameover() {
return gameover.getGameover();
}
}
View
32
src/Mass.java
import java.util.*;
public class Mass {
private Acceleration acceleration;
private double value;
 
public class Mass {
private Acceleration acceleration;
private double mass;
public Mass(Acceleration acceleration) {
this.acceleration = acceleration;
}
public void setMass(double x) {
this.mass = x;
acceleration.updateMass(mass);
}
public double getMass() {
return mass;
}
public Mass(Acceleration acceleration) {
this.acceleration = acceleration;
}
 
public void setValue(double x) {
this.value = x;
acceleration.updateByMass(value);
}
 
public double getValue() {
return value;
}
}
View
38
src/Move.java
import java.util.*;
 
public class Move {
private Velocity velocity;
private Map.Entry<Double, Double> move;
public Move(Velocity velocity) {
this.velocity = velocity;
}
public void moveY(double y) {
this.move = new AbstractMap.SimpleEntry<>(this.move.getKey(), y);
velocity.updateMove(move);
}
public void moveX(double x) {
this.move = new AbstractMap.SimpleEntry<>(x, this.move.getValue());
}
public Map.Entry<Double, Double> getMove() {
return move;
}
private Velocity velocity;
private Map.Entry<Double, Double> value;
 
public Move(Velocity velocity) {
this.velocity = velocity;
}
 
public void moveX(double x) {
this.value = new AbstractMap.SimpleEntry<>(x, this.value.getValue());
velocity.updateByMove(value);
}
 
public void moveY(double y) {
this.value = new AbstractMap.SimpleEntry<>(this.value.getKey(), y);
}
 
public Map.Entry<Double, Double> getValue() {
return value;
}
}
View
26
src/Onground.java
import java.util.*;
public class Onground {
private Ground ground;
private Position position;
 
public class Onground {
private Ground ground;
private Position position;
public Onground(Ground ground, Position position) {
this.ground = ground;
this.position = position;
}
public boolean getOnground() {
return ((this.ground.getGround()==true)&&(this.position.getPosition().getValue()<=0.0));
}
public Onground(Ground ground, Position position) {
this.ground = ground;
this.position = position;
}
 
public boolean getOnground() {
return ((this.ground.getValue() == true) && (this.position.getValue().getValue() <= 0.0));
}
}
View
40
src/Position.java
import java.util.*;
 
public class Position {
private Map.Entry<Double, Double> velocity;
private boolean ground;
private Map.Entry<Double, Double> position;
public void updateVelocity(Map.Entry<Double, Double> velocity) {
this.velocity = velocity;
position = (((ground==true)&&((this.position.getValue()+(0.01*velocity.getValue()))<0.0)) ? new AbstractMap.SimpleEntry<>((this.position.getKey()+(0.01*velocity.getKey())), 0.0) : new AbstractMap.SimpleEntry<>((this.position.getKey()+(0.01*velocity.getKey())), (this.position.getValue()+(0.01*velocity.getValue()))));
}
public void updateGround(boolean ground) {
this.ground = ground;
position = (((ground==true)&&((this.position.getValue()+(0.01*velocity.getValue()))<0.0)) ? new AbstractMap.SimpleEntry<>((this.position.getKey()+(0.01*velocity.getKey())), 0.0) : new AbstractMap.SimpleEntry<>((this.position.getKey()+(0.01*velocity.getKey())), (this.position.getValue()+(0.01*velocity.getValue()))));
}
public Map.Entry<Double, Double> getPosition() {
return position;
}
private Ground ground;
private Map.Entry<Double, Double> value;
 
public void updateByVelocity(Map.Entry<Double, Double> velocity) {
Map.Entry<Double, Double> temp_l3;
if (((this.ground.getValue() == true) && ((this.value.getValue() + (0.01 * velocity.getValue())) < 0.0))) {
temp_l3 = new AbstractMap.SimpleEntry<>((this.value.getKey() + (0.01 * velocity.getKey())), 0.0);
} else {
temp_l3 = new AbstractMap.SimpleEntry<>((this.value.getKey() + (0.01 * velocity.getKey())), (this.value.getValue() + (0.01 * velocity.getValue())));
}
value = temp_l3;
}
 
public Position(Ground ground) {
this.ground = ground;
}
 
public Map.Entry<Double, Double> getValue() {
return value;
}
}
View
20
src/Time.java
import java.util.*;
public class Time {
private double value;
 
public class Time {
private double time;
public void gravity(double y) {
this.time = (this.time+0.01);
}
public double getTime() {
return time;
}
public void gravity(double y) {
this.value = (this.value + 0.01);
}
 
public double getValue() {
return value;
}
}
View
76
src/Velocity.java
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;
}
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;
}
}