package org.argeo.slc.core.structure.tree;\r
\r
-import java.util.List;\r
-import java.util.Vector;\r
-\r
import org.argeo.slc.core.structure.StructureElement;\r
-import org.argeo.slc.core.structure.StructurePath;\r
\r
/**\r
* Implementation of <code>StructureElement</code> for tree based registries,\r
*/\r
public class TreeSElement implements StructureElement {\r
private String description;\r
- private TreeSPath path;\r
-\r
- private List<TreeSElement> children = new Vector<TreeSElement>();\r
\r
+ public TreeSElement(String description){\r
+ this.description = description;\r
+ }\r
+ \r
+ public TreeSElement(String description, String defaultDescription){\r
+ this(description!=null?description:defaultDescription);\r
+ }\r
+ \r
public String getDescription() {\r
return description;\r
}\r
this.description = description;\r
}\r
\r
- public StructurePath getPath() {\r
- return path;\r
- }\r
-\r
- public List<TreeSElement> getChildren() {\r
- return children;\r
- }\r
-\r
- public TreeSElement createChild(String name, String description) {\r
- TreeSElement element = new TreeSElement();\r
- element.path = TreeSPath.createChild((TreeSPath) this.getPath(), name);\r
- element.description = description;\r
- children.add(element);\r
- return element;\r
- }\r
-\r
- public static TreeSElement createRootElelment(String name,\r
- String description) {\r
- TreeSElement element = new TreeSElement();\r
- element.path = TreeSPath.createChild(null, name);\r
- element.description = description;\r
- return element;\r
- }\r
-\r
- @Override\r
- public boolean equals(Object obj) {\r
- if (obj instanceof StructureElement) {\r
- StructureElement element = (StructureElement) obj;\r
- return getPath().equals(element.getPath());\r
- }\r
- return false;\r
- }\r
-\r
}\r