Category.java 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. package holeg.ui.view.main;
  2. import java.util.ArrayList;
  3. import java.util.HashMap;
  4. import com.google.gson.annotations.Expose;
  5. import holeg.model.AbstractCanvasObject;
  6. /**
  7. * Class "Category" performs the functionality of listing elements into groups.
  8. * Each Category contains an ArrayList of CpsObjects, a name and a HashMap of
  9. * ObjIdx.
  10. *
  11. * @author Gruppe14
  12. *
  13. */
  14. public class Category {
  15. // objects: is a ArrayList of all Objects that belongs to the Category
  16. private ArrayList<AbstractCanvasObject> objects;
  17. // name: is a String chosen by the User
  18. @Expose
  19. private String name;
  20. // ObjIdx: Index of each Category that corresponds to the order in the tree
  21. private HashMap<String, Integer> objIdx;
  22. /**
  23. * Category Constructor.
  24. *
  25. * @param name name of the Category
  26. */
  27. public Category(String name) {
  28. setObjects(new ArrayList<AbstractCanvasObject>());
  29. setName(name);
  30. setObjIdx(new HashMap<String, Integer>());
  31. }
  32. /**
  33. * Getter for all CpsObjects.
  34. *
  35. * @return the objects
  36. */
  37. public ArrayList<AbstractCanvasObject> getObjects() {
  38. return objects;
  39. }
  40. /**
  41. * Set a new ArrayList of CpsObjects.
  42. *
  43. * @param objects
  44. * the objects to set
  45. */
  46. public void setObjects(ArrayList<AbstractCanvasObject> objects) {
  47. this.objects = objects;
  48. }
  49. /**
  50. * Getter the name of the Category.
  51. *
  52. * @return the name
  53. */
  54. public String getName() {
  55. return name;
  56. }
  57. /**
  58. * Set the name of the Category to a new one.
  59. *
  60. * @param name
  61. * the name to set
  62. */
  63. public void setName(String name) {
  64. this.name = name;
  65. }
  66. /**
  67. * Getter of the Objects in the Tree with their respective order.
  68. *
  69. * @return the objIdx
  70. */
  71. public HashMap<String, Integer> getObjIdx() {
  72. return objIdx;
  73. }
  74. /**
  75. * Set a new sequence of Objects in the tree.
  76. *
  77. * @param objIdx
  78. * the objIdx to set
  79. */
  80. public void setObjIdx(HashMap<String, Integer> objIdx) {
  81. this.objIdx = objIdx;
  82. }
  83. }