]> git.argeo.org Git - gpl/argeo-slc.git/blob - org.argeo.slc/src/main/java/org/argeo/slc/core/structure/tree/TreeSElement.java
Rename Ant sources
[gpl/argeo-slc.git] / org.argeo.slc / src / main / java / org / argeo / slc / core / structure / tree / TreeSElement.java
1 package org.argeo.slc.core.structure.tree;
2
3 import java.util.List;
4 import java.util.Vector;
5
6 import org.argeo.slc.core.structure.StructureElement;
7 import org.argeo.slc.core.structure.StructurePath;
8
9 public class TreeSElement implements StructureElement {
10 private String description;
11 private TreeSPath path;
12
13 private List<TreeSElement> children = new Vector<TreeSElement>();
14
15 public String getDescription() {
16 return description;
17 }
18
19 public void setDescription(String description) {
20 this.description = description;
21 }
22
23 public StructurePath getPath() {
24 return path;
25 }
26
27 public List<TreeSElement> getChildren() {
28 return children;
29 }
30
31 public TreeSElement createChild(String name, String description) {
32 TreeSElement element = new TreeSElement();
33 element.path = TreeSPath.createChild((TreeSPath) this.getPath(), name);
34 element.description = description;
35 children.add(element);
36 return element;
37 }
38
39 public static TreeSElement createRootElelment(String name,
40 String description) {
41 TreeSElement element = new TreeSElement();
42 element.path = TreeSPath.createChild(null, name);
43 element.description = description;
44 return element;
45 }
46
47 @Override
48 public boolean equals(Object obj) {
49 if (obj instanceof StructureElement) {
50 StructureElement element = (StructureElement) obj;
51 return getPath().equals(element.getPath());
52 }
53 return false;
54 }
55
56 }