Package org.gcube.informationsystem.tree
Class Tree<T>
- java.lang.Object
-
- org.gcube.informationsystem.tree.Tree<T>
-
public class Tree<T> extends Object
- Author:
- Luca Frosini (ISTI - CNR)
-
-
Constructor Summary
Constructors Constructor Description Tree()Tree(NodeInformation<T> ni)Tree(T root, NodeInformation<T> ni)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Node<T>addNode(T t)voidelaborate(NodeElaborator<T> nodeElaborator)Node<T>getNodeByIdentifier(String identifier)NodeInformation<T>getNodeInformation()Node<T>getRootNode()booleanisChildOf(String referenceIdentifier, String requiredChild)Checks if the node identified by the given reference identifier is a parent of the node identified by the required child identifier.booleanisParentOf(String referenceIdentifier, String requiredParent)Checks if the node identified by the given reference identifier is a parent of the node identified by the required parent identifier.voidsetAllowMultipleInheritance(boolean allowMultipleInheritance)voidsetNodeInformation(NodeInformation<T> ni)Set the NodeInformation if and only if it was not previously set.voidsetRoot(T root)Set the root if and only if it was not previously set.StringtoString()
-
-
-
Constructor Detail
-
Tree
public Tree()
-
Tree
public Tree(NodeInformation<T> ni)
-
Tree
public Tree(T root, NodeInformation<T> ni)
-
-
Method Detail
-
setNodeInformation
public void setNodeInformation(NodeInformation<T> ni)
Set the NodeInformation if and only if it was not previously set. Otherwise this function has no effect.- Parameters:
ni- the NodeInformation to set
-
setRoot
public void setRoot(T root) throws RuntimeException
Set the root if and only if it was not previously set. Otherwise this function has no effect. This function raises a RuntimeException is the NodeInformation was not previously set.- Parameters:
root- the root to set- Throws:
RuntimeException
-
setAllowMultipleInheritance
public void setAllowMultipleInheritance(boolean allowMultipleInheritance)
-
getNodeInformation
public NodeInformation<T> getNodeInformation()
-
elaborate
public void elaborate(NodeElaborator<T> nodeElaborator) throws Exception
- Throws:
Exception
-
isChildOf
public boolean isChildOf(String referenceIdentifier, String requiredChild)
Checks if the node identified by the given reference identifier is a parent of the node identified by the required child identifier.- Parameters:
referenceIdentifier- the identifier of the reference noderequiredChild- the identifier of the node to check if it is a child of the reference node- Returns:
- true if the reference node is a parent of the required child node, false otherwise
-
isParentOf
public boolean isParentOf(String referenceIdentifier, String requiredParent)
Checks if the node identified by the given reference identifier is a parent of the node identified by the required parent identifier.- Parameters:
referenceIdentifier- the identifier of the reference noderequiredParent- the identifier of the required parent node- Returns:
trueif the reference node is a parent of the required parent node,falseotherwise
-
-