From 90562c65d0eb70c77a3447e4186f0b848b00d6ec Mon Sep 17 00:00:00 2001 From: Daniel Kirschten Date: Mon, 30 Sep 2019 18:33:04 +0200 Subject: [PATCH] Introduced getters for executionSpeed --- .../logic/core/timeline/PauseableTimeFunction.java | 5 +++++ .../src/net/mograsim/logic/model/LogicExecuter.java | 5 +++++ .../net/mograsim/plugin/launch/MachineDebugTarget.java | 8 +++++++- 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/plugins/net.mograsim.logic.core/src/net/mograsim/logic/core/timeline/PauseableTimeFunction.java b/plugins/net.mograsim.logic.core/src/net/mograsim/logic/core/timeline/PauseableTimeFunction.java index 94dd5526..04c0fc8e 100644 --- a/plugins/net.mograsim.logic.core/src/net/mograsim/logic/core/timeline/PauseableTimeFunction.java +++ b/plugins/net.mograsim.logic.core/src/net/mograsim/logic/core/timeline/PauseableTimeFunction.java @@ -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) diff --git a/plugins/net.mograsim.logic.model/src/net/mograsim/logic/model/LogicExecuter.java b/plugins/net.mograsim.logic.model/src/net/mograsim/logic/model/LogicExecuter.java index c0cfeb11..1eff4112 100644 --- a/plugins/net.mograsim.logic.model/src/net/mograsim/logic/model/LogicExecuter.java +++ b/plugins/net.mograsim.logic.model/src/net/mograsim/logic/model/LogicExecuter.java @@ -132,6 +132,11 @@ public class LogicExecuter return isPaused.get(); } + public double getSpeedFactor() + { + return tf.getSpeedFactor(); + } + public void setSpeedFactor(double factor) { tf.setSpeedFactor(factor); diff --git a/plugins/net.mograsim.plugin.core/src/net/mograsim/plugin/launch/MachineDebugTarget.java b/plugins/net.mograsim.plugin.core/src/net/mograsim/plugin/launch/MachineDebugTarget.java index 328c5890..a060bd5d 100644 --- a/plugins/net.mograsim.plugin.core/src/net/mograsim/plugin/launch/MachineDebugTarget.java +++ b/plugins/net.mograsim.plugin.core/src/net/mograsim/plugin/launch/MachineDebugTarget.java @@ -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 -- 2.17.1