TrackedDataSet.java 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. package classes;
  2. import java.awt.Color;
  3. import com.google.gson.annotations.Expose;
  4. public class TrackedDataSet {
  5. //Property Integers
  6. public static final int CONSUMPTION = 0;
  7. public static final int PRODUCTION = 1;
  8. public static final int ACTIVATED_ELEMENTS = 2;
  9. public static final int ON_OFF = 3;
  10. public static final int TOTAL_PRODUCTION = 4;
  11. public static final int TOTAL_CONSUMPTION = 5;
  12. public static final int PERCENT_SUPPLIED = 6;
  13. public static final int PERCENT_NOT_SUPPLIED = 7;
  14. public static final int PERCENT_PARTIAL_SUPPLIED = 8;
  15. public static final int GROUP_PRODUCTION = 9;
  16. public static final int GROUP_CONSUMPTION = 10;
  17. public static final int AMOUNT_HOLONS = 11;
  18. public static final int AMOUNT_CLOSED_SWITCHES = 12;
  19. public static final int AVG_AMOUNT_OBJECTS_IN_HOLONS = 13;
  20. public static final int AVG_AMOUNT_ELEMENTS_IN_HOLONS = 14;
  21. public static final int AVG_AMOUNT_PRODUCERS_IN_HOLONS = 15;
  22. public static final int AVG_CONSUMED_ENERGY_IN_HOLONS = 16;
  23. public static final int AVG_WASTED_ENERGY_IN_HOLONS = 17;
  24. public static final int AMOUNT_BROKEN_EDGES = 18;
  25. public static final int RATIO_PRODUCERS_CONSUMERS = 19;
  26. public static final int AVG_AMOUNT_CLOSED_SWITCHES_IN_HOLONS = 20;
  27. public static final int AVG_AMOUNT_ACTIVE_ELEMENTS_IN_HOLONS = 21;
  28. public static final int AVG_AMOUNT_INACTIVE_ELEMENTS_IN_HOLONS = 22;
  29. public static final int AVG_PRODUCED_ENERGY_IN_HOLONS = 23;
  30. //Variables of the Data Set
  31. private AbstractCpsObject cps;
  32. @Expose
  33. private int property;
  34. @Expose
  35. private Color color;
  36. //Value for each timeStep
  37. private float values[];
  38. /**
  39. * Data Set for the StatisticGraoh
  40. *
  41. * @param cps
  42. * the cps Object
  43. * @param property
  44. * which value should be tracked
  45. * @param color
  46. * color of the line in the graph
  47. */
  48. public TrackedDataSet(AbstractCpsObject cps, int property, Color color) {
  49. this.cps = cps;
  50. this.property = property;
  51. this.color = color;
  52. this.values = new float[100];
  53. resetValues();
  54. }
  55. public AbstractCpsObject getCpsObject() {
  56. return this.cps;
  57. }
  58. public int getProperty() {
  59. return this.property;
  60. }
  61. public Color getColor() {
  62. return this.color;
  63. }
  64. public float[] getValues() {
  65. return this.values;
  66. }
  67. public void setValAt(float val, int at){
  68. this.values[at] = val;
  69. }
  70. /**
  71. * Resets all values.
  72. */
  73. public void resetValues(){
  74. for (int i = 0; i < values.length; i++) {
  75. values[i] = -1;
  76. }
  77. }
  78. }