ソースを参照

Fixed a bug where HolonSwitches with altered period behaved incorrectly

Ludwig Tietze 6 年 前
コミット
cb50c4b6f5

+ 3 - 3
src/classes/HolonSwitch.java

@@ -36,7 +36,7 @@ public class HolonSwitch extends AbstractCpsObject implements IGraphedElement {
 	 * electricity), else false
 	 */
 	@Expose
-	boolean autoActive;
+	private boolean autoActive;
 
 	/*
 	 * true if switch has to be used manually
@@ -139,7 +139,7 @@ public class HolonSwitch extends AbstractCpsObject implements IGraphedElement {
 	 * 
 	 * @return boolean the State
 	 */
-	public boolean getState() {
+	public boolean getState() {//TODO: not really necessary
 		if (manualMode) {
 			return this.manualActive;
 		} else {
@@ -165,7 +165,7 @@ public class HolonSwitch extends AbstractCpsObject implements IGraphedElement {
 	 * @param state
 	 *            the State
 	 */
-	public void setAutoState(boolean state) {
+	public void setAutoState(boolean state) {//TODO: This should probably not be public
 		this.autoActive = state;
 		setImage();
 	}

+ 1 - 1
src/classes/SubNet.java

@@ -75,7 +75,7 @@ public class SubNet {
         sb.append("  Switches:");
         for (int j = 0; j < getSwitches().size(); j++) {
             HolonSwitch sw = getSwitches().get(j);
-            sb.append("    " + sw.getName() + " " + sw.getId() + " State:" + sw.getValueArray());//TODO: Value or array???
+            sb.append("    " + sw.getName() + " " + sw.getId() + " State:" + sw.getState(timeStep));
         }
 
         return sb.toString();

+ 1 - 1
src/ui/view/AbstractCanvas.java

@@ -279,7 +279,7 @@ public abstract class AbstractCanvas extends JPanel {
 				|| model.getSelectedCpsObjects().contains(cps) || tempSelected.contains(cps))) {
 			img = Util.loadImage(this, "/Images/node_selected.png");
 		} else {
-			if (cps instanceof HolonSwitch) {
+			if (cps instanceof HolonSwitch) {//TODO. What the hell are thes ecalls doing here?
 				if (((HolonSwitch) cps).getState(model.getCurIteration())) {
 					((HolonSwitch) cps).setAutoState(true);
 				} else {

+ 1 - 1
src/ui/view/UnitGraph.java

@@ -269,7 +269,7 @@ public class UnitGraph extends JPanel implements MouseListener, MouseMotionListe
                 this.getHeight());
 
         // algorithmus
-        controller.calculateStateForTimeStep(effectiveX);
+        controller.calculateStateForTimeStep(model.getCurIteration());
     }
 
     @Override