Class Tree<T>


  • public class Tree<T>
    extends Object
    Author:
    Luca Frosini (ISTI - CNR)
    • 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)
      • addNode

        public Node<T> addNode​(T t)
      • getRootNode

        public Node<T> getRootNode()
      • getNodeByIdentifier

        public Node<T> getNodeByIdentifier​(String identifier)
      • 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 node
        requiredChild - 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 node
        requiredParent - the identifier of the required parent node
        Returns:
        true if the reference node is a parent of the required parent node, false otherwise