1
2
3
4
5
6
7
8
9
10
11
12 package sk.uniba.euromath.plugin.views.outline.items;
13
14 import java.util.ArrayList;
15 import java.util.List;
16
17 import org.w3c.dom.Node;
18
19 /***
20 * Base outline item with children.
21 * @author Tomáš Studva
22 * 23.1.2006
23 */
24 public abstract class CompoundOutlineItem extends OutlineItem {
25 /***
26 * List of children.
27 */
28 protected final List<OutlineItem> children;
29
30 protected boolean analyzed;
31
32 /***
33 * Constructor.
34 *
35 * @param model which represents this compound outline item
36 */
37 public CompoundOutlineItem(Node model) {
38 super(model);
39 this.children = new ArrayList<OutlineItem>();
40 setAnalyzed(false);
41 }
42
43 @Override
44 public void addChild(OutlineItem child) {
45 getChildren().add(child);
46 child.setParent(this);
47 setAnalyzed(false);
48 }
49
50 protected abstract void analyze();
51
52
53
54
55
56
57 @Override
58 public List<OutlineItem> getChildren() {
59 return this.children;
60 }
61
62 @Override
63 public void removeChild(OutlineItem child) {
64 getChildren().remove(child);
65 child.setParent(null);
66 setAnalyzed(false);
67 }
68
69 /***
70 * @return Returns the analyzed.
71 */
72 protected boolean isAnalyzed() {
73 return this.analyzed;
74 }
75
76 /***
77 * @param analyzed
78 * The analyzed to set.
79 */
80 protected void setAnalyzed(boolean analyzed) {
81 this.analyzed = analyzed;
82 }
83
84 }