|
@@ -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) {
|