|
@@ -16,10 +16,6 @@ import ui.controller.Control;
|
|
|
public class TestAlgo implements AddOn {
|
|
|
private boolean cancel = false;
|
|
|
|
|
|
- // Parameter defined by Algo
|
|
|
- private HashMap<Integer, AccessWrapper> access;
|
|
|
- private List<Boolean> initialState;
|
|
|
-
|
|
|
// Gui Part:
|
|
|
private Control control;
|
|
|
private JTextArea textArea;
|
|
@@ -186,13 +182,7 @@ public class TestAlgo implements AddOn {
|
|
|
}
|
|
|
|
|
|
private void reset() {
|
|
|
- if (initialState != null) {
|
|
|
- println("Resetting..");
|
|
|
- resetState();
|
|
|
- updateVisual();
|
|
|
- } else {
|
|
|
- println("No run inistialized.");
|
|
|
- }
|
|
|
+ println("RESET DOES NOTHING platzhalter");
|
|
|
}
|
|
|
|
|
|
private void disableGuiInput(boolean bool) {
|
|
@@ -646,74 +636,4 @@ public class TestAlgo implements AddOn {
|
|
|
control.updateCanvas();
|
|
|
System.out.println("Finish updateVisual in Iteration: " + control.getModel().getCurIteration());
|
|
|
}
|
|
|
-
|
|
|
- /**
|
|
|
- * Sets the Model back to its original State before the LAST run.
|
|
|
- */
|
|
|
- private void resetState() {
|
|
|
- setState(initialState);
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * Sets the State out of the given position for calculation or to show the user.
|
|
|
- *
|
|
|
- * @param position
|
|
|
- */
|
|
|
- private void setState(List<Boolean> position) {
|
|
|
- for (int i = 0; i < position.size(); i++) {
|
|
|
- access.get(i).setState(position.get(i));
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * A Wrapper Class for Access HolonElement and HolonSwitch in one Element and
|
|
|
- * not have to split the List.
|
|
|
- */
|
|
|
- private class AccessWrapper {
|
|
|
- public static final int HOLONELEMENT = 0;
|
|
|
- public static final int SWITCH = 1;
|
|
|
- private int type;
|
|
|
- private HolonSwitch hSwitch;
|
|
|
- private HolonElement hElement;
|
|
|
-
|
|
|
- public AccessWrapper(HolonSwitch hSwitch) {
|
|
|
- type = SWITCH;
|
|
|
- this.hSwitch = hSwitch;
|
|
|
- }
|
|
|
-
|
|
|
- public AccessWrapper(HolonElement hElement) {
|
|
|
- type = HOLONELEMENT;
|
|
|
- this.hElement = hElement;
|
|
|
- }
|
|
|
-
|
|
|
- public void setState(boolean state) {
|
|
|
- if (type == HOLONELEMENT) {
|
|
|
- hElement.setActive(state);
|
|
|
- } else {// is switch
|
|
|
- hSwitch.setManualMode(true);
|
|
|
- hSwitch.setManualState(state);
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- public boolean getState(int timeStep) {
|
|
|
- return (type == HOLONELEMENT) ? hElement.isActive() : hSwitch.getState(timeStep);
|
|
|
- }
|
|
|
-
|
|
|
- public int getType() {
|
|
|
- return type;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- private class Handle<T> {
|
|
|
- public T object;
|
|
|
-
|
|
|
- Handle(T object) {
|
|
|
- this.object = object;
|
|
|
- }
|
|
|
-
|
|
|
- public String toString() {
|
|
|
- return object.toString();
|
|
|
- }
|
|
|
- }
|
|
|
}
|