/** * Test whether a node conforms to the node type and name constraints. * Note that this returns true if the supplied node is null, this is a way of * terminating a loop. * * @param node the node to be tested * @return true if the node matches the requested node type and name */ protected boolean conforms(/*@Nullable*/ NodeImpl node) { return node == null || nodeTest == null || nodeTest.matchesNode(node); }
/** * Determine whether this Pattern matches the given Node. This is the main external interface * for matching patterns: it sets current() to the node being tested * * @param item The item to be tested against the Pattern * @param context The context in which the match is to take place. * @return true if the item matches the Pattern, false otherwise */ public boolean matches(Item<?> item, XPathContext context) { return item instanceof NodeInfo && nodeTest.matchesNode((NodeInfo)item); }
/** * Determine whether this Pattern matches the given Node. This is the main external interface * for matching patterns: it sets current() to the node being tested * * @param item The item to be tested against the Pattern * @param context The context in which the match is to take place. * @return true if the item matches the Pattern, false otherwise */ public boolean matches(Item<?> item, XPathContext context) { return item instanceof NodeInfo && nodeTest.matchesNode((NodeInfo)item); }
/** * Test whether a node conforms to the node type and name constraints. * Note that this returns true if the supplied node is null, this is a way of * terminating a loop. * * @param node the node to be tested * @return true if the node matches the requested node type and name */ protected boolean conforms(/*@Nullable*/ NodeImpl node) { return node == null || nodeTest == null || nodeTest.matchesNode(node); }
public boolean matches(Item item, TypeHierarchy th) { return item instanceof NodeInfo && matchesNode((NodeInfo) item); }
public boolean matches(Item item, TypeHierarchy th) { return item instanceof NodeInfo && matchesNode((NodeInfo) item); }
public N step(N node) { do { node = getFollowingNode(node, anchor); } while (node != null && !test.matchesNode(node)); return node; } }
public N step(N node) { do { node = getFollowingNode(node, anchor); } while (node != null && !test.matchesNode(node)); return node; } }
/** * Get a matching function that can be used to test whether numbered nodes in a TinyTree * or DominoTree satisfy the node test. (Calling this matcher must give the same result * as calling <code>matchesNode(tree.getNode(nodeNr))</code>, but it may well be faster). * @param tree the tree against which the returned function will operate * @return an IntPredicate; the matches() method of this predicate takes a node number * as input, and returns true if and only if the node identified by this node number * matches the node test. */ public IntPredicate getMatcher(final NodeVectorTree tree) { return nodeNr -> matchesNode(tree.getNode(nodeNr)); }
public NodeInfo next() { while (true) { NodeInfo next = base.next(); if (next == null) { return null; } if (nodeTest.matchesNode(next)) { return next; } } }
public NodeInfo next() { while (true) { NodeInfo next = base.next(); if (next == null) { return null; } if (nodeTest.matchesNode(next)) { return next; } } }
public NodeInfo next() { NodeInfo curr; do { // until we find a match curr = advance(); } while (curr != null && nodeTest != null && (!nodeTest.matchesNode(curr))); return curr; }
public NodeInfo next() { NodeInfo curr; do { // until we find a match curr = advance(); } while (curr != null && nodeTest != null && (!nodeTest.matchesNode(curr))); return curr; }
public NodeInfo next() { NodeInfo curr; do { // until we find a match curr = advance(); } while (curr != null && nodeTest != null && (!nodeTest.matchesNode(curr))); return curr; }
public NodeInfo next() { NodeInfo curr; do { // until we find a match curr = advance(); } while (curr != null && nodeTest != null && (!nodeTest.matchesNode(curr))); return curr; }
/** * Get a matching function that can be used to test whether numbered nodes in a TinyTree * or DominoTree satisfy the node test. (Calling this matcher must give the same result * as calling <code>matchesNode(tree.getNode(nodeNr))</code>, but it may well be faster). * @param tree the tree against which the returned function will operate * @return an IntPredicate; the matches() method of this predicate takes a node number * as input, and returns true if and only if the node identified by this node number * matches the node test. */ public IntPredicate getMatcher(final NodeVectorTree tree) { return nodeNr -> matchesNode(tree.getNode(nodeNr)); }
private static Predicate<XdmNode> nodeTestPredicate (NodeTest test) { return item -> test.matchesNode(item.getUnderlyingNode()); }
private static Predicate<XdmNode> nodeTestPredicate (NodeTest test) { return item -> test.matchesNode(item.getUnderlyingNode()); }
public NodeInfo next() { if (current == null) { return null; } NodeInfo node = current.getParent(); while (node != null && !test.matchesNode(node)) { node = node.getParent(); } return current = node; }
public NodeInfo next() { if (current == null) { return null; } NodeInfo node = current.getParent(); while (node != null && !test.matchesNode(node)) { node = node.getParent(); } return current = node; }