Introduced getters for executionSpeed
authorDaniel Kirschten <daniel.kirschten@gmx.de>
Mon, 30 Sep 2019 16:33:04 +0000 (18:33 +0200)
committerDaniel Kirschten <daniel.kirschten@gmx.de>
Mon, 30 Sep 2019 16:35:28 +0000 (18:35 +0200)
plugins/net.mograsim.logic.core/src/net/mograsim/logic/core/timeline/PauseableTimeFunction.java
plugins/net.mograsim.logic.model/src/net/mograsim/logic/model/LogicExecuter.java
plugins/net.mograsim.plugin.core/src/net/mograsim/plugin/launch/MachineDebugTarget.java

index 94dd552..04c0fc8 100644 (file)
@@ -51,6 +51,11 @@ public class PauseableTimeFunction implements TimeFunction
                return 1 / 1000d / speedFactor;
        }
 
+       public double getSpeedFactor()
+       {
+               return speedFactor;
+       }
+
        public void setSpeedFactor(double factor)
        {
                if (factor <= 0)
index c0cfeb1..1eff411 100644 (file)
@@ -132,6 +132,11 @@ public class LogicExecuter
                return isPaused.get();
        }
 
+       public double getSpeedFactor()
+       {
+               return tf.getSpeedFactor();
+       }
+
        public void setSpeedFactor(double factor)
        {
                tf.setSpeedFactor(factor);
index 328c589..a060bd5 100644 (file)
@@ -74,9 +74,15 @@ public class MachineDebugTarget extends PlatformObject implements IDebugTarget,
                return launch;
        }
 
+       public double getExecutionSpeed()
+       {
+               return exec.getSpeedFactor();
+       }
+
        public void setExecutionSpeed(double speed)
        {
-               exec.setSpeedFactor(speed);
+               if (getExecutionSpeed() != speed)
+                       exec.setSpeedFactor(speed);
        }
 
        @Override