Package com.adobe.xfa
Class NodeListFilter
java.lang.Object
com.adobe.xfa.NodeListFilter
- Direct Known Subclasses:
TagnameFilter
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 -
Method Summary
Modifier and TypeMethodDescriptionbooleanDetermines whether node is to be included in the filtered list of nodes.booleancheckChildren(Node node) Determines whether the filter should search the children of this node.booleanDetermines 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.voidinit()This method is called when a search is started.
-
Constructor Details
-
NodeListFilter
public NodeListFilter()
-
-
Method Details
-
accept
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:
trueif the node is to be included. The default implementation always returnstrue.
-
checkChildren
Determines whether the filter should search the children of this node.- Parameters:
node- the node to check- Returns:
trueif the filter should search children ofnode.
-
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:
trueif we're done,falseif we're to keep searching.
-
init
public void init()This method is called when a search is started. -
filterNodes
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
Searches the startNode all descendants of startNode down to the level specified.
Only nodes that are accepted by the filter will be added tonodeList.- 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
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
-