Class AbstractSuffixTree.AbstractNode

    • Constructor Detail

      • AbstractNode

        public AbstractNode​(int index)
        Index constructor. The node defaults to being a leaf node.
        Parameters:
        index - The index of the node.
    • Method Detail

      • getIndex

        public int getIndex()
        Specified by:
        getIndex in interface SuffixTree.Node
        Returns:
        The index of the node.
      • isLeaf

        public boolean isLeaf()
        Specified by:
        isLeaf in interface SuffixTree.Node
        Returns:
        Whether this node is a leaf node in the suffix tree.
      • setLeaf

        protected void setLeaf​(boolean leaf)
        Sets whether this node is a leaf.
        Parameters:
        leaf - Whether this node is a leaf.
      • getParentNode

        public SuffixTree.Node getParentNode()
        Specified by:
        getParentNode in interface SuffixTree.Node
        Returns:
        The parent node of this node, or null if this node has no parent node (i.e. it is the root node).
      • setParentNode

        protected void setParentNode​(SuffixTree.Node parentNode)
        Sets the node indicating this node's parent.
        Parameters:
        parentNode - The node representing the parent of this node.
        Throws:
        java.lang.NullPointerException - if the given node is null.
      • getSuffixNode

        public SuffixTree.Node getSuffixNode()
        Specified by:
        getSuffixNode in interface SuffixTree.Node
        Returns:
        The node representing the next smaller suffix, or null if there is no known smaller suffix node.
      • setSuffixNode

        protected void setSuffixNode​(SuffixTree.Node suffixNode)
        Sets the node representing the next smaller suffix.
        Parameters:
        suffixNode - The node representing the next smaller suffix.
        Throws:
        java.lang.NullPointerException - if the given node is null.
      • hashCode

        public int hashCode()
        This version returns the node index.
        Overrides:
        hashCode in class java.lang.Object
        See Also:
        getIndex()
      • equals

        public boolean equals​(java.lang.Object object)
        This version compares node indexes.
        Overrides:
        equals in class java.lang.Object
        See Also:
        getIndex()
      • toString

        public java.lang.String toString()
        This implementation returns a string in the form (index)*, where '*' indicates a leaf node.
        Overrides:
        toString in class java.lang.Object