|
@@ -16,13 +16,7 @@ import java.util.ArrayList;
|
|
*/
|
|
*/
|
|
public class HolonObject extends AbstractCanvasObject {
|
|
public class HolonObject extends AbstractCanvasObject {
|
|
/* Array of all consumers */
|
|
/* Array of all consumers */
|
|
- private ArrayList<HolonElement> elements;
|
|
|
|
- /* Array for tracking Production */
|
|
|
|
- private float[] trackingProd;
|
|
|
|
- /* Array for tracking Consumption */
|
|
|
|
- private float[] trackingCons;
|
|
|
|
- /* Total Flexibility */
|
|
|
|
- private float totalFlex;
|
|
|
|
|
|
+ private ArrayList<HolonElement> elements = new ArrayList<HolonElement>();
|
|
|
|
|
|
/**
|
|
/**
|
|
* Constructor Set by default the name of the object equals to the category
|
|
* Constructor Set by default the name of the object equals to the category
|
|
@@ -32,9 +26,6 @@ public class HolonObject extends AbstractCanvasObject {
|
|
*/
|
|
*/
|
|
public HolonObject(String objName) {
|
|
public HolonObject(String objName) {
|
|
super(objName);
|
|
super(objName);
|
|
- setElements(new ArrayList<>());
|
|
|
|
- setTrackingProd(new float[100]);
|
|
|
|
- setTrackingCons(new float[100]);
|
|
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -45,8 +36,6 @@ public class HolonObject extends AbstractCanvasObject {
|
|
public HolonObject(AbstractCanvasObject obj) {
|
|
public HolonObject(AbstractCanvasObject obj) {
|
|
super(obj);
|
|
super(obj);
|
|
setElements(copyElements(((HolonObject) obj).getElements()));
|
|
setElements(copyElements(((HolonObject) obj).getElements()));
|
|
- setTrackingProd(new float[100]);
|
|
|
|
- setTrackingCons(new float[100]);
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -267,79 +256,6 @@ public class HolonObject extends AbstractCanvasObject {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- /**
|
|
|
|
- * Get the Array Production
|
|
|
|
- */
|
|
|
|
- public float[] getTrackingProd() {
|
|
|
|
- return this.trackingProd;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- /**
|
|
|
|
- * Set the Array Production
|
|
|
|
- */
|
|
|
|
- public void setTrackingProd(float[] arr) {
|
|
|
|
- this.trackingProd = arr;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- /**
|
|
|
|
- * Get the Array Consumption
|
|
|
|
- */
|
|
|
|
- public float[] getTrackingCons() {
|
|
|
|
- return this.trackingCons;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- /**
|
|
|
|
- * Set the Array Consumption
|
|
|
|
- */
|
|
|
|
- public void setTrackingCons(float[] arr) {
|
|
|
|
- this.trackingCons = arr;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- /**
|
|
|
|
- * Get the Array Consumption
|
|
|
|
- */
|
|
|
|
- public float getTotalFlex() {
|
|
|
|
- return totalFlex;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- /**
|
|
|
|
- * Set the Array Consumption
|
|
|
|
- */
|
|
|
|
- public void setTotalFlex(float totalFlex) {
|
|
|
|
- this.totalFlex = totalFlex;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- /**
|
|
|
|
- * If the user track any HolonObject the tracking information will be
|
|
|
|
- * updated. (If the HolonObject enters into the untracked state, the array
|
|
|
|
- * will be reseted)
|
|
|
|
- */
|
|
|
|
-
|
|
|
|
- public void updateTrackingInfo() {
|
|
|
|
- float[] tempProd = new float[100];
|
|
|
|
- float[] tempCons = new float[100];
|
|
|
|
- for (int i = 0; i < 100; i++) {
|
|
|
|
- float valueProd = 0;
|
|
|
|
- float valueCons = 0;
|
|
|
|
- for (HolonElement e : getElements()) {
|
|
|
|
- if (e.isActive() && e.isProducer()) {
|
|
|
|
- valueProd += e.getOverallEnergyAtTimeStep(i);
|
|
|
|
- }
|
|
|
|
- if (e.isActive() && e.isConsumer()) {
|
|
|
|
- valueCons += e.getOverallEnergyAtTimeStep(i);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- tempProd[i] = valueProd;
|
|
|
|
- tempCons[i] = valueCons;
|
|
|
|
- }
|
|
|
|
- this.trackingProd = tempProd;
|
|
|
|
- this.trackingCons = tempCons;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
-
|
|
|
|
public String toString() {
|
|
public String toString() {
|
|
StringBuilder sb = new StringBuilder();
|
|
StringBuilder sb = new StringBuilder();
|
|
|
|
|