diff --git a/AlgebraicDataflowArchitectureModel/msrc/Acceleration.java b/AlgebraicDataflowArchitectureModel/msrc/Acceleration.java new file mode 100644 index 0000000..c99c0dc --- /dev/null +++ b/AlgebraicDataflowArchitectureModel/msrc/Acceleration.java @@ -0,0 +1,37 @@ +import java.util.*; + +public class Acceleration { + private Map.Entry force; + private double mass; + private Velocity velocity; + private Onground onground; + private Map.Entry value; + public void updateForce(Map.Entry force) { + this.force = force; + Map.Entry temp_l4; + if(this.onground.getValue()) { + temp_l4 = new AbstractMap.SimpleEntry<>((force.getKey()/mass), 0.0); + } else { + temp_l4 = new AbstractMap.SimpleEntry<>((force.getKey()/mass), (force.getValue()/mass)); + } + acceleration = temp_l4; + velocity.updateAcceleration(value); + } + public void updateMass(double mass) { + this.mass = mass; + Map.Entry temp_l5; + if(this.onground.getValue()) { + temp_l5 = new AbstractMap.SimpleEntry<>((force.getKey()/mass), 0.0); + } else { + temp_l5 = new AbstractMap.SimpleEntry<>((force.getKey()/mass), (force.getValue()/mass)); + } + acceleration = temp_l5; + velocity.updateAcceleration(value); + } + public Acceleration(Velocity velocity, Onground onground) { + this.onground = onground; + } + public Map.Entry getValue() { + return value; + } +} \ No newline at end of file