Explorar o código

Small change by HolonSwitch

Edgardo Palza %!s(int64=7) %!d(string=hai) anos
pai
achega
b3023c893f
Modificáronse 2 ficheiros con 14 adicións e 22 borrados
  1. 13 21
      src/classes/CpsEdge.java
  2. 1 1
      src/ui/view/GUI.java

+ 13 - 21
src/classes/CpsEdge.java

@@ -5,10 +5,10 @@ public class CpsEdge {
 	float maxCapacity;
 	float flow;
 	boolean isWorking;
-	//State represents the real status of the edge
-	//If it breaks --> stay ruin no matter the actual scenario
-	//The only way to repair it is through manual change (setStateEdge) 
-	boolean state = true;
+	// State represents the real status of the edge
+	// If it breaks --> stay ruin no matter the actual scenario
+	// The only way to repair it is through manual change (setStateEdge)
+	// boolean state = true;
 
 	CpsObject A;
 	CpsObject B;
@@ -55,10 +55,6 @@ public class CpsEdge {
 		return flow;
 	}
 
-	public boolean getStateEdge() {
-		return state;
-	}
-
 	/**
 	 * @param flow
 	 *            the flow to set
@@ -66,27 +62,23 @@ public class CpsEdge {
 	public void setFlow(float flow) {
 		this.flow = flow;
 		/**
-		if (flow <= maxCapacity || flow == -1) {
-			isWorking = true;
-		} else {
-			isWorking = false;
-			state = false;
-		}
-		**/
+		 * if (flow <= maxCapacity || flow == -1) { isWorking = true; } else {
+		 * isWorking = false; state = false; }
+		 **/
 	}
-	
-	public void calculateState(boolean simMode){
-		if(flow > maxCapacity && maxCapacity != -1){
+
+	public void calculateState(boolean simMode) {
+		if (flow > maxCapacity && maxCapacity != -1) {
 			isWorking = false;
-		}else {
-			if(!simMode && flow <= maxCapacity){
+		} else {
+			if (!simMode && flow <= maxCapacity) {
 				isWorking = true;
 			}
 		}
 	}
 
 	public void setState(boolean isActive) {
-		state = isActive;
+		isWorking = isActive;
 	}
 
 	/**

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

@@ -1183,7 +1183,7 @@ public class GUI<E> implements CategoryListener {
 					Object[] tempCapacity = { "Max. Capacity", model.getSelectedEdge().getCapacity() };
 					tableModelProperties.addRow(tempCapacity);
 					// Status displayed
-					Object[] tempStatus = { "Status", model.getSelectedEdge().getStateEdge() };
+					Object[] tempStatus = { "Status", model.getSelectedEdge().getState() };
 					tableModelProperties.addRow(tempStatus);
 					// For edges, the only possible editable cell is the max
 					// flow