GlobalController.java 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178
  1. package ui.controller;
  2. import java.awt.Color;
  3. import ui.model.Model;
  4. import ui.model.Model.FairnessModel;
  5. import ui.view.StatisticGraphPanel;
  6. /**
  7. * Controller for the Global Variables.
  8. *
  9. * @author Gruppe14
  10. */
  11. public class GlobalController {
  12. private Model model;
  13. /**
  14. * Constructor.
  15. *
  16. * @param model
  17. * the Model
  18. */
  19. public GlobalController(Model model) {
  20. this.model = model;
  21. }
  22. /**
  23. * Returns SCALE.
  24. *
  25. * @return SCALE
  26. */
  27. public int getScale() {
  28. return model.getScale();
  29. }
  30. /**
  31. * Returns SCALE Divided by 2.
  32. *
  33. * @return SCALE Divided by 2
  34. */
  35. public int getScaleDiv2() {
  36. return model.getScaleDiv2();
  37. }
  38. /**
  39. * Changes the value of SCALE and SCALEDIV2.
  40. *
  41. * @param s
  42. * Scale
  43. */
  44. public void setScale(int s) {
  45. model.setScale(s);
  46. }
  47. /**
  48. * sets the current Iteration.
  49. *
  50. * @param curit
  51. * the current Iteration
  52. */
  53. public void setCurIteration(int curit) {
  54. model.setCurIteration(curit);
  55. }
  56. /**
  57. * Returns numberOfSaves.
  58. *
  59. * @return numberOfSaves
  60. */
  61. public int getNumbersOfSaves() {
  62. return model.getNumberOfSaves();
  63. }
  64. /**
  65. * sets the max number of autosaves.
  66. *
  67. * @param numberofSaves
  68. * the max number of autosaves
  69. */
  70. public void setNumberOfSaves(int numberofSaves) {
  71. model.setNumberOfSaves(numberofSaves);
  72. ;
  73. }
  74. /**
  75. * Set the timerSpeed.
  76. * @param t
  77. * Interval in ms
  78. */
  79. public void setTimerSpeed(int t) {
  80. model.setTimerSpeed(t);
  81. }
  82. /**
  83. * Set the Canvas X Size.
  84. *
  85. * @param canvasX the cANVAS_X to set
  86. */
  87. public void setCanvasX(int canvasX) {
  88. model.setCanvasX(canvasX);
  89. }
  90. /**
  91. * Set the Canvas Y Size.
  92. *
  93. * @param canvasY the cANVAS_Y to set
  94. */
  95. public void setCanvasY(int canvasY) {
  96. model.setCanvasY(canvasY);
  97. }
  98. /**
  99. * Add a SubNetColor.
  100. *
  101. * @param c
  102. * the Color
  103. */
  104. public void addSubNetColor(Color c) {
  105. model.addSubNetColor(c);
  106. }
  107. public void setMaxCapacity(float cap) {
  108. model.setMaxCapacity(cap);
  109. }
  110. /**
  111. * Changes the value of HolonBodySCALE
  112. *
  113. * @param s
  114. * HolonBodyScale
  115. */
  116. public void setHolonBodyScale(int s) {
  117. model.setHolonBodyScale(s);
  118. }
  119. /**
  120. * Returns HolonBodySCALE.
  121. *
  122. * @return HolonBodySCALE
  123. */
  124. public int getHolonBodyScale() {
  125. return model.getHolonBodyScale();
  126. }
  127. /**
  128. * Sets if the Simulation is running
  129. */
  130. public void setIsSimRunning(boolean isRunning){
  131. model.setIsSimRunning(isRunning);
  132. //Reset the Graph if isRunning == true
  133. if (isRunning) {
  134. for (StatisticGraphPanel sg : model.getGraphTable().values()) {
  135. sg.resetGraph();
  136. }
  137. }
  138. }
  139. /**
  140. * sets showSupplyBars
  141. * @param showSupplyBars
  142. */
  143. public void setShowSupplyBars(boolean showSupplyBars) {
  144. model.setShowSupplyBars(showSupplyBars);
  145. }
  146. /**
  147. * sets showSupplyBars
  148. * @param showSupplyBars
  149. */
  150. public void setFairnessModel(FairnessModel fairnessModel) {
  151. model.setFairnessModel(fairnessModel);
  152. }
  153. }