Package com.adobe.xfa

Class NodeListFilter

java.lang.Object
com.adobe.xfa.NodeListFilter
Direct Known Subclasses:
TagnameFilter

public class NodeListFilter extends Object
NodeListFilter filters a node and its children to produce a list of nodes that satisfy some filter test.

A derived class will typically override the accept(Node) method, and can further refine the behaviour by overriding init(), checkChildren(Node) or checkFinished().

  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    accept(Node node)
    Determines whether node is to be included in the filtered list of nodes.
    boolean
    Determines whether the filter should search the children of this node.
    boolean
    Determines whether a search should continue or not.
    filterNodes(Node startNode)
    Searches the startNode all descendants of startNode.
    filterNodes(Node startNode, int level)
    Searches the startNode all descendants of startNode down to the level specified.
    filterNodes(Node startNode, int level, List<Node> nodeList)
    Searches the startNode all descendants of startNode down to the level specified.
    void
    This method is called when a search is started.

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • NodeListFilter

      public NodeListFilter()
  • Method Details

    • accept

      public boolean accept(Node node)
      Determines whether node is to be included in the filtered list of nodes. Derived classes will want to override this behaviour.
      Parameters:
      node - the node to test for inclusion
      Returns:
      true if the node is to be included. The default implementation always returns true.
    • checkChildren

      public boolean checkChildren(Node node)
      Determines whether the filter should search the children of this node.
      Parameters:
      node - the node to check
      Returns:
      true if the filter should search children of node.
    • checkFinished

      public boolean checkFinished()
      Determines whether a search should continue or not. We may want to abort the search in cases such as where we're searching for a specific node or the first occurrence of a node and wish to stop searching when we've found it.
      Returns:
      true if we're done, false if we're to keep searching.
    • init

      public void init()
      This method is called when a search is started.
    • filterNodes

      public List<Node> filterNodes(Node startNode)
      Searches the startNode all descendants of startNode.
      Only nodes that are accepted by the filter will be added to the list.
      Parameters:
      startNode - the node to start searching from.
      Returns:
      a list of nodes
    • filterNodes

      public List<Node> filterNodes(Node startNode, int level, List<Node> nodeList)
      Searches the startNode all descendants of startNode down to the level specified.
      Only nodes that are accepted by the filter will be added to nodeList.
      Parameters:
      startNode - the node to start searching from.
      level -

      0 = Exhaustively search all descendants of startNode
      1 = Search immediate children.
      2 = Search immediate children and grandchildren
      n = Search descendants down to the nth level.
      Returns:
      a list of nodes
    • filterNodes

      public List<Node> filterNodes(Node startNode, int level)
      Searches the startNode all descendants of startNode down to the level specified.
      Only nodes that are accepted by the filter will be added to the result list.
      Parameters:
      startNode - the node to start searching from.
      level -

      0 = Exhaustively search all descendants of startNode
      1 = Search immediate children.
      2 = Search immediate children and grandchildren
      n = Search descendants down to the nth level.
      Returns:
      a list of nodes