浏览代码

Just Some Comments

Teh-Hai Julian Zheng 8 年之前
父节点
当前提交
2197b15f91

+ 1 - 3
src/classes/CpsObject.java

@@ -19,9 +19,7 @@ public abstract class CpsObject {
 	/* Position with a X and Y value */
 	Position position;
 	/* Energy input and output of each object in the grid */
-
-
-	
+	/* Where the Object is Stored */
 	String sav;
 	
 	float energyIn;

+ 2 - 2
src/classes/HolonElement.java

@@ -19,9 +19,9 @@ public class HolonElement {
 	String image;
 	/* +: for Consumers and -: Producers */
 	char sign;
-	
+	/* Place where the Object is Stored*/
 	String sav;
-	
+	/* Object where the Element is Stored*/
 	String obj;
 	/*
 	 * Energy at each point of the graph with 50 predefined points. At the

+ 8 - 3
src/classes/HolonObject.java

@@ -10,9 +10,11 @@ public class HolonObject extends CpsObject {
 
 	/* Array of all consumers */
 	private ArrayList<HolonElement> elements;
+	/* Array of all Indices of Elements*/
+	private HashMap<String, Integer> EleIdx;
 	/* Total of consumption */
 	private float currentEnergy;
-	private HashMap<String, Integer> EleIdx;
+
 	/**
 	 * State of the building: 0 = fully supplied (currentEnergy == 0) 1 = not
 	 * enough energy (currentEnergy > 0) 2 = oversupplied (currentEnergy < 0)
@@ -25,7 +27,6 @@ public class HolonObject extends CpsObject {
 	 */
 	public HolonObject(String ObjName) {
 		super(ObjName);
-
 		setElements(new ArrayList<HolonElement>());
 		setEleIdx(new HashMap<>());
 
@@ -132,7 +133,11 @@ public class HolonObject extends CpsObject {
 	public void setEleIdx(HashMap<String, Integer> eleIdx) {
 		EleIdx = eleIdx;
 	}
-	
+	/**
+	 * Copy all Elements into a New Array
+	 * @param arr
+	 * @return
+	 */
 	public ArrayList<HolonElement> copyElements(ArrayList<HolonElement> arr) {
 		ArrayList<HolonElement> newArr = new ArrayList<>();
 		for (HolonElement t : arr) {

+ 0 - 4
src/ui/controller/Control.java

@@ -53,10 +53,6 @@ public class Control {
 		return multiPurposeController.searchCategoryObject(multiPurposeController.searchCategory(category), object);
 	}
 
-	public CpsObject searchCanvasObject(int ID) {
-		return multiPurposeController.searchByID(ID);
-	}
-
 	/* Operations for Categories and Objects */
 	public void addCategory(String cat) {
 		categoryController.addNewCategory(cat);

+ 1 - 6
src/ui/controller/MultiPurposeController.java

@@ -116,12 +116,7 @@ public class MultiPurposeController {
 			if (i.getValue() > map.get(key))
 				i.setValue(i.getValue() - 1);
 		}
-
-	}
-
-
-	
-
+	}	
 
 	/**
 	 * Copies a HashMap into a new One