01: package com.jamonapi.utils;
02:
03: /**
04: * A CompositeNode works with NodeTrees and LeafNodes to create heirarchical object trees. An example is a file system where directories
05: * can be viewed LeafNodes and directories can be viewed as CompositeNodes. TreeNodes can be viewed as the top level of the tree structures.
06: *
07: **/
08: public interface CompositeNode {
09: /** Return the NodeTrees root CompositeNode i.e. the root of the heirarchy. **/
10: public CompositeNode getRootNode();
11:
12: /** Return the composite node pointed to by the node name **/
13: public CompositeNode getCompositeNode(String childNodeName);
14:
15: /** Return the leaf node pointed to by the node name. childNodeType allows us to return different node types with the same interface **/
16: public LeafNode getLeafNode(String childNodeName,
17: String childNodeType);
18:
19: /** Returns true if the leafNodeExists **/
20: public boolean leafNodeExists(String childNodeName);
21:
22: /** Returns true if the compositeNodeExists **/
23: public boolean compositeNodeExists(String childNodeName);
24:
25: public void addCompositeNode(String childNodeName,
26: CompositeNode addNode);
27:
28: public void addLeafNode(String childNodeName, LeafNode addNode);
29:
30: public String getCompositeNodeKey(String nodeName);
31:
32: public String getLeafNodeKey(String nodeName);
33:
34: }
|