Class BaseNode

    • Constructor Detail

      • BaseNode

        public BaseNode()
    • Method Detail

      • getEscapeStringFor

        public static java.lang.String getEscapeStringFor​(java.lang.String string)
        Parameters:
        string -
        Returns:
        an escape String for the given string.
      • getOriginStringFromEscapeString

        public static java.lang.String getOriginStringFromEscapeString​(java.lang.String escapeString)
        Parameters:
        escapeString -
        Returns:
        an origin String from the given escapeString.
      • addAttribute

        public abstract BaseNode addAttribute​(BaseNode attribute)
        Adds the given attribute to the current BaseNode.
        Parameters:
        attribute -
        Returns:
        the current BaseNode
      • addAttribute

        public BaseNode addAttribute​(BaseNode... attributes)
        Adds the given attributes to the current BaseNode.
        Parameters:
        attributes -
        Returns:
        the current BaseNode
      • addAttribute

        public void addAttribute​(java.lang.String attribute)
        Adds the given attribute to the current BaseNode.
        Parameters:
        attribute -
        Throws:
        UnrepresentingArgumentException - if the given attribute does not represent a Node.
      • addAttributes

        public <BN extends BaseNodeBaseNode addAttributes​(java.lang.Iterable<BN> attributes)
        Adds the given attributes to the current BaseNode.
        Type Parameters:
        BN - is the type of the given attributes.
        Parameters:
        attributes -
        Returns:
        the current BaseNode
      • addPostfixToHeader

        public void addPostfixToHeader​(java.lang.String postfix)
        Adds the given postfix to the header of the current BaseNode. Sets the given postfix as header to the current BaseNode if it does not have a header.
        Parameters:
        postfix -
        Throws:
        ArgumentIsNullException - if the given postfix is null.
        InvalidArgumentException - if the given postfix is blank.
      • addPrefixToHeader

        public void addPrefixToHeader​(java.lang.String prefix)
        Adds the given prefix to the header of the current BaseNode. Sets the given prefix as header to the current BaseNode if it does not have a header.
        Parameters:
        prefix -
        Throws:
        ArgumentIsNullException - if the given prefix is null.
        InvalidArgumentException - if the given prefix is blank.
      • containsAttribute

        public boolean containsAttribute​(IElementTakerBooleanGetter<BaseNode> selector)
        Parameters:
        selector -
        Returns:
        true if the current BaseNode contains an attribute the given selector selects.
      • containsAttributes

        public boolean containsAttributes()
        Returns:
        true if the current BaseNode contains attributes.
      • containsOneAttribute

        public boolean containsOneAttribute()
        Returns:
        true if the current BaseNode contains exactly 1 attribute.
      • containsOneAttributeWithHeader

        public boolean containsOneAttributeWithHeader()
        Returns:
        true if the current BaseNode contains exactly 1 attribute, that has a header.
      • getCopy

        public Node getCopy()
        Returns:
        a new copy of the current BaseNode.
      • equals

        public boolean equals​(java.lang.Object object)
        Overrides:
        equals in class java.lang.Object
      • getAttributeCount

        public abstract int getAttributeCount()
        Returns:
        the number of attributes of the current BaseNode.
      • getAttributesAsStrings

        public LinkedList<java.lang.String> getAttributesAsStrings()
        Returns:
        a String representations of the attributes of the current BaseNode.
      • getRefAttributes

        public IContainer<BaseNode> getRefAttributes​(java.lang.String header)
        Parameters:
        header -
        Returns:
        the attributes of the current BaseNode that have the given header.
      • getRefAttributesOfFirstAttribute

        public IContainer<BaseNode> getRefAttributesOfFirstAttribute​(java.lang.String header)
        Parameters:
        header -
        Returns:
        the attributes of the first attribute with the given header
        Throws:
        ArgumentDoesNotHaveAttributeException - if the current Node does not contain an attribute with the given header
      • getRefOneAttributeOfFirstAttribute

        public BaseNode getRefOneAttributeOfFirstAttribute​(java.lang.String header)
        Parameters:
        header -
        Returns:
        the one attribute of the first attribute with the given header
        Throws:
        ArgumentDoesNotHaveAttributeException - if the current Node does not contain an attribute with the given header.
        EmptyArgumentException - if the first attribute of the current Node with the given header does not contain an attribute.
        InvalidArgumentException - if the first attribute of the current Node with the given header contains several attributes.
      • getRefOneAttributeOfFirstAttributeAsString

        public java.lang.String getRefOneAttributeOfFirstAttributeAsString​(java.lang.String header)
        Parameters:
        header -
        Returns:
        a string representation of the one attribute of the first attribute with the given header of the current Node.
      • getRefFirstAttribute

        public BaseNode getRefFirstAttribute​(java.lang.String header)
        Parameters:
        header -
        Returns:
        the first attribute of the current BaseNode with the given header.
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • removeAttributes

        public abstract void removeAttributes()
        Removes the attributes of the current BaseNode.
      • removeFirstAttribute

        public abstract void removeFirstAttribute​(IElementTakerBooleanGetter<BaseNode> selector)
        Removes the first attribute the given selector selects from the current BaseNode.
        Parameters:
        selector -
      • removeFirstAttribute

        public void removeFirstAttribute​(java.lang.String header)
        Removes the first attribute with the given header from the current BaseNode.
        Parameters:
        header -
      • reset

        public void reset()
        Removes the header and the attributes of the current BaseNode.
      • resetAttributes

        public <BN extends BaseNode> void resetAttributes​(java.lang.Iterable<BN> attributes)
        Resets the attributes of the current BaseNode with the given attributes.
        Type Parameters:
        BN - is the type of the given attributes.
        Parameters:
        attributes -
      • resetFromFile

        public void resetFromFile​(java.lang.String filePath)
        Resets the current BaseNode from the file with the given file path.
        Parameters:
        filePath -
      • resetFromString

        public void resetFromString​(java.lang.String string)
        Resets the current BaseNode from the given string.
        Parameters:
        string -
        Throws:
        InvalidArgumentException - if the given string is not valid.
      • toFormatedString

        public java.lang.String toFormatedString()
        Returns:
        a formated string representation of the current BaseNode.
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
        Returns:
        a string representation of the current BaseNode.