Class ANodeBuilder

  • All Implemented Interfaces:
    Iterable<ANode>

    public final class ANodeBuilder
    extends ObjectList<ANode,​ANodeBuilder>
    Resizable-array implementation for nodes. The stored nodes will be sorted and duplicates will be removed before they are returned as value or via an iterator.
    Author:
    BaseX Team 2005-24, BSD License, Christian Gruen
    • Constructor Detail

      • ANodeBuilder

        public ANodeBuilder()
        Constructor.
    • Method Detail

      • value

        public Value value​(Expr expr)
        Returns a value with the type of the given expression and invalidates the internal array. Warning: the function must only be called if the builder is discarded afterwards.
        Parameters:
        expr - expression
        Returns:
        the iterator
      • ddo

        public void ddo()
        Sorts the nodes and removes distinct nodes.
      • data

        public Data data()
        Returns the shared database.
        Returns:
        database or null
      • removeAll

        public boolean removeAll​(ANode node)
        Description copied from class: ObjectList
        Removes all occurrences of the specified element from the list.
        Overrides:
        removeAll in class ObjectList<ANode,​ANodeBuilder>
        Parameters:
        node - element to be removed
        Returns:
        flag, indicating if any element was removed
      • contains

        public boolean contains​(ANode node)
        Description copied from class: ObjectList
        Checks if the specified element is found in the list.
        Overrides:
        contains in class ObjectList<ANode,​ANodeBuilder>
        Parameters:
        node - element to be found
        Returns:
        result of check
      • finish

        public ANode[] finish()
        Description copied from class: ObjectList
        Returns an array with all elements and invalidates the internal array. Warning: the function must only be called if the list is discarded afterwards.
        Overrides:
        finish in class ObjectList<ANode,​ANodeBuilder>
        Returns:
        array (internal representation!)
      • binarySearch

        public int binarySearch​(DBNode node,
                                int start,
                                int length)
        Performs a binary search on the given range of this sequence iterator. This works if data is assigned.
        Parameters:
        node - node to find
        start - start of the search interval
        length - length of the search interval
        Returns:
        position of the item or -insertPosition - 1 if not found
      • equals

        public boolean equals​(ANode node1,
                              ANode node2)
        Description copied from class: ObjectList
        Compares two list elements.
        Overrides:
        equals in class ObjectList<ANode,​ANodeBuilder>
        Parameters:
        node1 - first element
        node2 - second element
        Returns:
        result of check