GlobalController.java 3.2 KB

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