package classes; import com.google.gson.annotations.Expose; import ui.controller.SingletonControl; import java.awt.*; public class TrackedDataSet { //Property Integers public static final int CONSUMPTION = 0; public static final int PRODUCTION = 1; public static final int ACTIVATED_ELEMENTS = 2; public static final int ON_OFF = 3; public static final int TOTAL_PRODUCTION = 4; public static final int TOTAL_CONSUMPTION = 5; public static final int PERCENT_SUPPLIED = 6; public static final int PERCENT_NOT_SUPPLIED = 7; public static final int PERCENT_PARTIAL_SUPPLIED = 8; public static final int GROUP_PRODUCTION = 9; public static final int GROUP_CONSUMPTION = 10; public static final int AMOUNT_HOLONS = 11; public static final int AMOUNT_CLOSED_SWITCHES = 12; public static final int AVG_AMOUNT_OBJECTS_IN_HOLONS = 13; public static final int AVG_AMOUNT_ELEMENTS_IN_HOLONS = 14; public static final int AVG_AMOUNT_PRODUCERS_IN_HOLONS = 15; public static final int AVG_CONSUMED_ENERGY_IN_HOLONS = 16; public static final int AVG_WASTED_ENERGY_IN_HOLONS = 17; public static final int AMOUNT_BROKEN_EDGES = 18; public static final int RATIO_PRODUCERS_CONSUMERS = 19; public static final int AVG_AMOUNT_CLOSED_SWITCHES_IN_HOLONS = 20; public static final int AVG_AMOUNT_ACTIVE_ELEMENTS_IN_HOLONS = 21; public static final int AVG_AMOUNT_INACTIVE_ELEMENTS_IN_HOLONS = 22; public static final int AVG_PRODUCED_ENERGY_IN_HOLONS = 23; public static final int WASTED_ENERGY = 24; //Variables of the Data Set private AbstractCpsObject cps; @Expose private int property; @Expose private Color color; //Value for each timeStep private float values[]; /** * Data Set for the StatisticGraoh * * @param cps * the cps Object * @param property * which value should be tracked * @param color * color of the line in the graph * @param timeStep * The time steps at the moment this object is created */ public TrackedDataSet(AbstractCpsObject cps, int property, Color color, int timeSteps) { this.cps = cps; this.property = property; this.color = color; this.values = new float[timeSteps]; resetValues(); } public AbstractCpsObject getCpsObject() { return this.cps; } public int getProperty() { return this.property; } public Color getColor() { return this.color; } public float[] getValues() { return this.values; } public void setValAt(float val, int at){ this.values[at] = val; } /** * Resets all values. */ public void resetValues(){ for (int i = 0; i < values.length; i++) { values[i] = -1; } } public void updateIterations() { float[] tmp=new float[ SingletonControl.getInstance().getControl().getModel().getIterations() ]; for(int i=0;i