Model.java 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. package ui.model;
  2. import Interfaces.CategoryListener;
  3. import java.util.ArrayList;
  4. import java.util.LinkedList;
  5. import java.util.List;
  6. import classes.Category;
  7. import classes.CpsObject;
  8. import ui.controller.*;
  9. public class Model {
  10. // eventuell wenn Canvasgröße gewählt werden kann
  11. private int HEIGHT;
  12. private int WIDTH;
  13. /*
  14. * Array of all categories in the model. It is set by default with the categories ENERGY, BUILDINGS and COMPONENTS
  15. */
  16. private ArrayList<Category> categories;
  17. private ArrayList<CpsObject> objectsOnCanvas;
  18. private List<CategoryListener> categoryListeners;
  19. public Model(){
  20. setCategories(new ArrayList<Category>());
  21. setObjectsOnCanvas(new ArrayList<CpsObject>());
  22. setCategoryListeners(new LinkedList<CategoryListener>());
  23. }
  24. /**
  25. * @return the categories
  26. */
  27. public ArrayList<Category> getCategories() {
  28. return categories;
  29. }
  30. /**
  31. * @param categories
  32. * the categories to set
  33. */
  34. public void setCategories(ArrayList<Category> categories) {
  35. this.categories = categories;
  36. }
  37. /**
  38. * @return the objectsOnCanvas
  39. */
  40. public ArrayList<CpsObject> getObjectsOnCanvas() {
  41. return objectsOnCanvas;
  42. }
  43. /**
  44. * @param objectsOnCanvas
  45. * the objectsOnCanvas to set
  46. */
  47. public void setObjectsOnCanvas(ArrayList<CpsObject> objectsOnCanvas) {
  48. System.out.println(objectsOnCanvas);
  49. this.objectsOnCanvas = objectsOnCanvas;
  50. }
  51. /**
  52. * @return the categoryListeners
  53. */
  54. public List<CategoryListener> getCategoryListeners() {
  55. return categoryListeners;
  56. }
  57. /**
  58. * @param linkedList
  59. * the categoryListeners to set
  60. */
  61. public void setCategoryListeners(LinkedList<CategoryListener> linkedList) {
  62. this.categoryListeners = linkedList;
  63. }
  64. }