Переглянути джерело

Remove Old Tracking System

Tom Troppmann 3 роки тому
батько
коміт
52d628a521

+ 0 - 1
src/classes/HolonElement.java

@@ -71,7 +71,6 @@ public class HolonElement implements LocalMode, GraphEditable{
     /*
      * Energy at each point of the graph with 100 predefined points. At the
      * beginning, it starts with all values at energyPerElement.
-     * If switched to flexible, this represents the maximum of usable energy
      */
     private float[] curveSample;
     

+ 1 - 85
src/classes/HolonObject.java

@@ -16,13 +16,7 @@ import java.util.ArrayList;
  */
 public class HolonObject extends AbstractCanvasObject { 
     /* 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
@@ -32,9 +26,6 @@ public class HolonObject extends AbstractCanvasObject {
      */
     public HolonObject(String 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) {
         super(obj);
         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() {
         StringBuilder sb = new StringBuilder();
 

+ 0 - 15
src/ui/controller/LoadController.java

@@ -172,8 +172,6 @@ public class LoadController {
                 loadUnitGraph(GRAPHTYPE.ELEMENT, json.get(key), null, eleDispatch);
             if (key.contains("ELETESTUNITGRAPH"))
                 loadUnitGraph(GRAPHTYPE.TESTELEMENT, json.get(key), null, eleDispatch);
-            if (key.contains("TRACKED"))
-                loadTracked(json.get(key), objDispatch);
         }
 
     }
@@ -380,19 +378,6 @@ public class LoadController {
         }
     }
 
-    private void loadTracked(JsonElement jsonElement, HashMap<Integer, AbstractCanvasObject> objDispatch) {
-        JsonObject object = jsonElement.getAsJsonObject();
-        List<String> keys = getKeys(object);
-
-        for (String k : keys) {
-            int id = object.get(k).getAsInt();
-            if (objDispatch.get(id) instanceof HolonObject) {
-                ((HolonObject) objDispatch.get(id)).updateTrackingInfo();
-            }
-        }
-
-    }
-
     private File readArchive(File src) throws IOException, ArchiveException {
         File tmp = Files.createTempDirectory("tmpHolon").toFile();
         tmp.deleteOnExit();

+ 0 - 5
src/ui/controller/UpdateController.java

@@ -47,9 +47,6 @@ public class UpdateController {
 					table.removeRow(2);
 					Object[] tempEnergy = { "Total Energy", ((HolonObject) tempCps).getEnergyNeededFromConsumingElements(model.getCurIteration()) };
 					table.insertRow(2, tempEnergy);
-					table.removeRow(3);
-					Object[] tempFlex = { "Flexibility", ((HolonObject) tempCps).getTotalFlex() };
-					table.insertRow(3, tempFlex);
 				}
 			}
 		}
@@ -295,9 +292,7 @@ public class UpdateController {
 			if (obj instanceof HolonObject) {
 				refreshTableHolonElement(model.getMultiTable(), model.getSingleTable());
 				Object[] tempEnergy = { "Total Energy", ((HolonObject) obj).getEnergyNeededFromConsumingElements(model.getCurIteration()) };
-				Object[] tempFlex = { "Flexibility", ((HolonObject) obj).getTotalFlex() };
 				model.getPropertyTable().addRow(tempEnergy);
-				model.getPropertyTable().addRow(tempFlex);
 				model.getPropertyTable().setCellEditable(0, 1, false);
 				model.getPropertyTable().setCellEditable(2, 1, false);
 				model.getPropertyTable().setCellEditable(3, 1, false);