Skip to content
Snippets Groups Projects
Commit b50117c6 authored by dgelessus's avatar dgelessus
Browse files

Remove unused RandomSeed and related code

parent adf629b0
No related branches found
No related tags found
No related merge requests found
......@@ -14,7 +14,6 @@ import de.prob.core.command.IComposableCommand;
import de.prob.core.domainobjects.History;
import de.prob.core.domainobjects.MachineDescription;
import de.prob.core.domainobjects.Operation;
import de.prob.core.domainobjects.RandomSeed;
import de.prob.core.domainobjects.State;
import de.prob.core.internal.Activator;
import de.prob.core.internal.AnimatorImpl;
......@@ -206,14 +205,6 @@ public final class Animator {
return implementation;
}
public final synchronized RandomSeed getRandomSeed() {
return getImplementation().getSeed();
}
public final synchronized void setRandomSeed(final RandomSeed seed) {
getImplementation().setSeed(seed);
}
// just for testing
private Preferences customConfiguration;
......
/**
* (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.domainobjects;
import java.math.BigInteger;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class RandomSeed {
private final BigInteger[] seed;
public RandomSeed(final BigInteger x, final BigInteger y,
final BigInteger z, final BigInteger b) {
seed = new BigInteger[] { x, y, z, b };
}
public BigInteger getSeedX() {
return seed[0];
}
public BigInteger getSeedY() {
return seed[1];
}
public BigInteger getSeedZ() {
return seed[2];
}
public BigInteger getSeedB() {
return seed[3];
}
@Override
public String toString() {
return getSeedX() + ":" + getSeedY() + ":" + getSeedZ() + ":"
+ getSeedB();
}
public static RandomSeed fromString(final String seed) {
Pattern p = Pattern.compile("(\\d*):(\\d*):(\\d*):(\\d*)");
Matcher m = p.matcher(seed);
if (!m.matches()) {
throw new IllegalArgumentException("Wrong format");
}
String[] splitSeed = seed.split(":");
BigInteger x = new BigInteger(splitSeed[0]);
BigInteger y = new BigInteger(splitSeed[1]);
BigInteger z = new BigInteger(splitSeed[2]);
BigInteger b = new BigInteger(splitSeed[3]);
return new RandomSeed(x, y, z, b);
}
@Override
public boolean equals(final Object obj) {
if (obj instanceof RandomSeed) {
RandomSeed seed = (RandomSeed) obj;
if (!(seed.getSeedX().equals(this.getSeedX()))) {
return false;
}
if (!(seed.getSeedY().equals(this.getSeedY()))) {
return false;
}
if (!(seed.getSeedZ().equals(this.getSeedZ()))) {
return false;
}
if (!(seed.getSeedB().equals(this.getSeedB()))) {
return false;
}
return true;
}
return false;
}
@Override
public int hashCode() {
final int xHash = getSeedX().hashCode();
final int yHash = getSeedY().hashCode();
final int zHash = getSeedZ().hashCode();
final int bHash = getSeedB().hashCode();
return xHash + 11 * yHash + 37 * zHash + 43 * bHash;
}
}
......@@ -21,7 +21,6 @@ import de.prob.core.command.IComposableCommand;
import de.prob.core.domainobjects.History;
import de.prob.core.domainobjects.HistoryItem;
import de.prob.core.domainobjects.MachineDescription;
import de.prob.core.domainobjects.RandomSeed;
import de.prob.core.domainobjects.State;
import de.prob.core.sablecc.node.Start;
import de.prob.exceptions.ProBException;
......@@ -41,8 +40,6 @@ public class AnimatorImpl {
private IServerConnection connector;
private RandomSeed seed;
private MachineDescription description;
private final File file;
......@@ -111,14 +108,6 @@ public class AnimatorImpl {
return true;
}
public void setSeed(final RandomSeed seed) {
this.seed = seed;
}
public RandomSeed getSeed() {
return seed;
}
public synchronized void setMachineDescription(
final MachineDescription machineDescription) {
this.description = machineDescription;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment