Browse Source

Merge branch 'Ohne_Drag_and_Drop' of https://git.tk.informatik.tu-darmstadt.de/carlos.garcia/praktikum-holons into Ohne_Drag_and_Drop

Edgardo Palza 8 years ago
parent
commit
fedd41d54f

BIN
.gradle/2.2.1/taskArtifacts/cache.properties.lock


BIN
.gradle/2.2.1/taskArtifacts/fileHashes.bin


BIN
.gradle/2.2.1/taskArtifacts/fileSnapshots.bin


BIN
.gradle/2.2.1/taskArtifacts/taskArtifacts.bin


+ 6 - 1
build.gradle

@@ -20,7 +20,7 @@ jar {
 sourceSets {
     test{
 		java{
-			srcDir 'src/tests'
+			srcDirs = ["src/tests"]
 		}
 		resources{
 			srcDir 'res'
@@ -36,8 +36,13 @@ sourceSets {
     }
 }
 
+repositories {
+ mavenCentral()
+}
+
  dependencies {   
        compile fileTree(dir: 'jars', include: ['*.jar'])
+       testCompile group: 'junit', name: 'junit', version: '4.+'
 }
 /*
 // In this section you declare where to find the dependencies of your project

+ 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;