Browse Source

Manual Mode for Switch works now

dominik.rieder 8 years ago
parent
commit
3c9767b574
2 changed files with 10 additions and 2 deletions
  1. 8 0
      src/classes/HolonSwitch.java
  2. 2 2
      src/ui/controller/SimulationManager.java

+ 8 - 0
src/classes/HolonSwitch.java

@@ -65,6 +65,14 @@ public class HolonSwitch extends CpsObject {
 			this.manualActive = !manualActive;
 		}
 	}
+	
+	public boolean getState(int timeStep){
+		if(manualMode){
+			return this.manualActive;
+		} else {
+			return getActiveAt()[timeStep];
+		}
+	}
 
 	public boolean getState() {
 		if (manualMode) {

+ 2 - 2
src/ui/controller/SimulationManager.java

@@ -306,9 +306,9 @@ public class SimulationManager {
 	
 	public boolean legitState(CpsObject neighbor, CpsObject current){
 		if(current instanceof HolonSwitch){
-			if(((HolonSwitch) current).getActiveAt()[timeStep]){
+			if(((HolonSwitch) current).getState(timeStep)){
 				if(neighbor instanceof HolonSwitch){
-					if(((HolonSwitch) neighbor).getActiveAt()[timeStep]){
+					if(((HolonSwitch) neighbor).getState(timeStep)){
 						return true;
 					}else{
 						return false;