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 before removed before they are returned as value or via an iterator.
Author:
BaseX Team 2005-21, BSD License, Christian Gruen
  • Constructor Details

    • ANodeBuilder

      public ANodeBuilder()
      Constructor.
  • Method Details

    • add

      public ANodeBuilder add(ANode node)
      Description copied from class: ObjectList
      Adds an element to the array.
      Overrides:
      add in class ObjectList<ANode,ANodeBuilder>
      Parameters:
      node - element to be added
      Returns:
      self reference
    • 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
    • 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
    • iterator

      public Iterator<ANode> iterator()
      Specified by:
      iterator in interface Iterable<ANode>
      Overrides:
      iterator in class ObjectList<ANode,ANodeBuilder>
    • newArray

      protected ANode[] newArray(int s)
      Description copied from class: ObjectList
      Creates a resized array.
      Specified by:
      newArray in class ObjectList<ANode,ANodeBuilder>
      Parameters:
      s - size
      Returns:
      array
    • 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
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class ObjectList<ANode,ANodeBuilder>