diff --git a/de.prob.core/src/de/prob/core/command/ClearMachineCommand.java b/de.prob.core/src/de/prob/core/command/ClearMachineCommand.java index 2cd93def1bbdeb6fb119f9c17651256f0359a017..74b12d911446d7d72e2616bfa8bec529b9461717 100644 --- a/de.prob.core/src/de/prob/core/command/ClearMachineCommand.java +++ b/de.prob.core/src/de/prob/core/command/ClearMachineCommand.java @@ -13,15 +13,7 @@ import de.prob.prolog.output.IPrologTermOutput; import de.prob.prolog.term.PrologTerm; public class ClearMachineCommand implements IComposableCommand { - - private static final ClearCmd CLEAR_CMD = new ClearCmd(); - private final GetPrologRandomSeed getRandomSeed; - private final ComposedCommand cmd; - - public ClearMachineCommand() { - this.getRandomSeed = new GetPrologRandomSeed(); - this.cmd = new ComposedCommand(getRandomSeed, CLEAR_CMD); - } + public ClearMachineCommand() {} public static void clearMachine(final Animator animator) throws ProBException { @@ -30,26 +22,9 @@ public class ClearMachineCommand implements IComposableCommand { public void processResult( final ISimplifiedROMap<String, PrologTerm> bindings) - throws CommandException { - cmd.processResult(bindings); - final Animator animator = Animator.getAnimator(); - animator.setRandomSeed(getRandomSeed.getSeed()); - } + throws CommandException {} - public void writeCommand(final IPrologTermOutput pto) - throws CommandException { - cmd.writeCommand(pto); + public void writeCommand(final IPrologTermOutput pto) { + pto.openTerm("clear_loaded_machines").closeTerm(); } - - private final static class ClearCmd implements IComposableCommand { - public void processResult( - final ISimplifiedROMap<String, PrologTerm> bindings) - throws CommandException { - } - - public void writeCommand(final IPrologTermOutput pto) { - pto.openTerm("clear_loaded_machines").closeTerm(); - } - } - } diff --git a/de.prob.core/src/de/prob/core/command/GetPrologRandomSeed.java b/de.prob.core/src/de/prob/core/command/GetPrologRandomSeed.java deleted file mode 100644 index 53b952d6a228bba79efd3c63faabee41d038b6a0..0000000000000000000000000000000000000000 --- a/de.prob.core/src/de/prob/core/command/GetPrologRandomSeed.java +++ /dev/null @@ -1,58 +0,0 @@ -/** - * (c) 2009 Lehrstuhl fuer Softwaretechnik und Programmiersprachen, Heinrich - * Heine Universitaet Duesseldorf This software is licenced under EPL 1.0 - * (http://www.eclipse.org/org/documents/epl-v10.html) - * */ - -package de.prob.core.command; - -import java.math.BigInteger; - -import de.prob.core.Animator; -import de.prob.core.domainobjects.RandomSeed; -import de.prob.exceptions.ProBException; -import de.prob.parser.BindingGenerator; -import de.prob.parser.ISimplifiedROMap; -import de.prob.parser.ResultParserException; -import de.prob.prolog.output.IPrologTermOutput; -import de.prob.prolog.term.PrologTerm; - -public final class GetPrologRandomSeed implements IComposableCommand { - - private RandomSeed randomSeed; - - public static RandomSeed getSeed(final Animator a) throws ProBException { - final GetPrologRandomSeed cmd = new GetPrologRandomSeed(); - a.execute(cmd); - return cmd.getSeed(); - } - - public RandomSeed getSeed() { - return randomSeed; - } - - public void processResult( - final ISimplifiedROMap<String, PrologTerm> bindings) - throws CommandException { - BigInteger x, y, z, b; - try { - x = BindingGenerator.getInteger(bindings.get("X")).getValue(); - y = BindingGenerator.getInteger(bindings.get("Y")).getValue(); - z = BindingGenerator.getInteger(bindings.get("Z")).getValue(); - b = BindingGenerator.getInteger(bindings.get("B")).getValue(); - } catch (ResultParserException e) { - CommandException commandException = new CommandException( - e.getLocalizedMessage(), e); - commandException.notifyUserOnce(); - throw commandException; - } - - randomSeed = new RandomSeed(x, y, z, b); - } - - public void writeCommand(final IPrologTermOutput pto) { - pto.openTerm("get_rand").printVariable("X").printVariable("Y") - .printVariable("Z").printVariable("B").closeTerm(); - } - -} diff --git a/de.prob.core/src/de/prob/core/command/SetPrologRandomSeed.java b/de.prob.core/src/de/prob/core/command/SetPrologRandomSeed.java deleted file mode 100644 index 3bed4b7297345f0944ada0f505b592c4396e95cf..0000000000000000000000000000000000000000 --- a/de.prob.core/src/de/prob/core/command/SetPrologRandomSeed.java +++ /dev/null @@ -1,44 +0,0 @@ -/** - * (c) 2009 Lehrstuhl fuer Softwaretechnik und Programmiersprachen, Heinrich - * Heine Universitaet Duesseldorf This software is licenced under EPL 1.0 - * (http://www.eclipse.org/org/documents/epl-v10.html) - * */ - -package de.prob.core.command; - -import de.prob.core.Animator; -import de.prob.core.domainobjects.RandomSeed; -import de.prob.exceptions.ProBException; -import de.prob.parser.ISimplifiedROMap; -import de.prob.prolog.output.IPrologTermOutput; -import de.prob.prolog.term.PrologTerm; - -public final class SetPrologRandomSeed implements IComposableCommand { - - private final RandomSeed seed; - - public SetPrologRandomSeed(final RandomSeed seed) { - this.seed = seed; - } - - public static void setSeed(final Animator a, final RandomSeed seed) - throws ProBException { - SetPrologRandomSeed cmd = new SetPrologRandomSeed(seed); - a.execute(cmd); - } - - public void processResult( - final ISimplifiedROMap<String, PrologTerm> bindings) - throws CommandException { - // no result, nothing to do - } - - public void writeCommand(final IPrologTermOutput pto) { - pto.openTerm("set_rand"); - pto.printNumber(seed.getSeedX()); - pto.printNumber(seed.getSeedY()); - pto.printNumber(seed.getSeedZ()); - pto.printNumber(seed.getSeedB()); - pto.closeTerm(); - } -}