Class BranchNode

java.lang.Object
org.apache.directory.api.ldap.model.filter.AbstractExprNode
org.apache.directory.api.ldap.model.filter.BranchNode
All Implemented Interfaces:
Cloneable, ExprNode
Direct Known Subclasses:
AndNode, NotNode, OrNode

public abstract class BranchNode extends AbstractExprNode
Node representing branches within the expression tree corresponding to logical operators within the filter expression.
Author:
Apache Directory Project
  • Field Details

    • children

      protected List<ExprNode> children
      child node list for this branch node
  • Constructor Details

    • BranchNode

      protected BranchNode(AssertionType assertionType, List<ExprNode> childList)
      Creates a BranchNode using a logical operator and a list of children.
      Parameters:
      assertionType - the node's type
      childList - the child nodes under this branch node.
    • BranchNode

      protected BranchNode(AssertionType assertionType, ExprNode... childList)
      Creates a BranchNode using a logical operator and a list of children.
      Parameters:
      assertionType - the node's type
      childList - the child nodes under this branch node.
    • BranchNode

      protected BranchNode(AssertionType assertionType)
      Creates a BranchNode using a logical operator.
      Parameters:
      assertionType - the node's type
  • Method Details

    • isLeaf

      public final boolean isLeaf()
      Description copied from interface: ExprNode
      Tests to see if this node is a leaf or branch node.
      Returns:
      false all the time.
      See Also:
    • clone

      public ExprNode clone()
      Makes a full clone in new memory space of the current node and children
      Specified by:
      clone in interface ExprNode
      Overrides:
      clone in class AbstractExprNode
      Returns:
      the clone
    • addNode

      public void addNode(ExprNode node)
      Adds a child node to this branch node node
      Parameters:
      node - the child expression to add to this branch node
    • addNodeToHead

      public void addNodeToHead(ExprNode node)
      Adds a child node to this branch node at the head rather than the tail.
      Parameters:
      node - the child expression to add to this branch node
    • getChildren

      public List<ExprNode> getChildren()
      Gets the children below this BranchNode. We purposefully do not clone the array list so that backends can sort the order of children using their own search optimization algorithms. We want backends and other parts of the system to be able to induce side effects on the tree structure.
      Returns:
      the list of child nodes under this branch node.
    • setChildren

      public void setChildren(List<ExprNode> list)
      Sets the list of children under this node.
      Parameters:
      list - the list of children to set.
    • getFirstChild

      public ExprNode getFirstChild()
      Convenience method that gets the first child in the children array. Its very useful for NOT nodes since they only have one child by avoiding code that looks like: ( ExprNode ) m_children.get( 0 )
      Returns:
      the first child
    • accept

      public final Object accept(FilterVisitor visitor)
      Description copied from interface: ExprNode
      Element/node accept method for visitor pattern.
      Parameters:
      visitor - the filter expression tree structure visitor
      Returns:
      The modified element
      See Also:
    • isSchemaAware

      public boolean isSchemaAware()
      Tells if this Node is Schema aware.
      Returns:
      true if the Node is SchemaAware
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class AbstractExprNode
      Returns:
      the instance's hash code
      See Also:
    • equals

      public boolean equals(Object other)
      Overrides:
      equals in class AbstractExprNode
      Returns:
      true if both objects are equal
      See Also: