/** * Determine whether this pattern matches a given Node within the subtree rooted at a given * anchor node. This method is used when the pattern is used for streaming. * * @param node The NodeInfo representing the Element or other node to be tested against the Pattern * @param anchor The anchor node, which must match any AnchorPattern subpattern * @param context The dynamic context. Only relevant if the pattern * uses variables, or contains calls on functions such as document() or key(). * @return true if the node matches the Pattern, false otherwise */ public boolean matchesBeneathAnchor(NodeInfo node, NodeInfo anchor, XPathContext context) throws XPathException { return p1.matchesBeneathAnchor(node, anchor, context) && !p2.matchesBeneathAnchor(node, anchor, context); }
/** * Determine whether this pattern matches a given Node within the subtree rooted at a given * anchor node. This method is used when the pattern is used for streaming. * * @param node The NodeInfo representing the Element or other node to be tested against the Pattern * @param anchor The anchor node, which must match any AnchorPattern subpattern * @param context The dynamic context. Only relevant if the pattern * uses variables, or contains calls on functions such as document() or key(). * @return true if the node matches the Pattern, false otherwise */ public boolean matchesBeneathAnchor(NodeInfo node, NodeInfo anchor, XPathContext context) throws XPathException { return p1.matchesBeneathAnchor(node, anchor, context) && p2.matchesBeneathAnchor(node, anchor, context); }
/** * Determine whether this pattern matches a given Node within the subtree rooted at a given * anchor node. This method is used when the pattern is used for streaming. * * @param node The NodeInfo representing the Element or other node to be tested against the Pattern * @param anchor The anchor node, which must match any AnchorPattern subpattern * @param context The dynamic context. Only relevant if the pattern * uses variables, or contains calls on functions such as document() or key(). * @return true if the node matches the Pattern, false otherwise */ public boolean matchesBeneathAnchor(NodeInfo node, NodeInfo anchor, XPathContext context) throws XPathException { return p1.matchesBeneathAnchor(node, anchor, context) || p2.matchesBeneathAnchor(node, anchor, context); }
/** * Determine whether this pattern matches a given Node within the subtree rooted at a given * anchor node. This method is used when the pattern is used for streaming. * * @param node The NodeInfo representing the Element or other node to be tested against the Pattern * @param anchor The anchor node, which must match any AnchorPattern subpattern * @param context The dynamic context. Only relevant if the pattern * uses variables, or contains calls on functions such as document() or key(). * @return true if the node matches the Pattern, false otherwise */ public boolean matchesBeneathAnchor(NodeInfo node, NodeInfo anchor, XPathContext context) throws XPathException { return p1.matchesBeneathAnchor(node, anchor, context) && !p2.matchesBeneathAnchor(node, anchor, context); }
/** * Determine whether this pattern matches a given Node within the subtree rooted at a given * anchor node. This method is used when the pattern is used for streaming. * * @param node The NodeInfo representing the Element or other node to be tested against the Pattern * @param anchor The anchor node, which must match any AnchorPattern subpattern * @param context The dynamic context. Only relevant if the pattern * uses variables, or contains calls on functions such as document() or key(). * @return true if the node matches the Pattern, false otherwise */ @Override public boolean matchesBeneathAnchor(NodeInfo node, NodeInfo anchor, XPathContext context) throws XPathException { return wrappedPattern.matchesBeneathAnchor(node, anchor, context); }
/** * Determine whether this pattern matches a given Node within the subtree rooted at a given * anchor node. This method is used when the pattern is used for streaming. * * @param node The NodeInfo representing the Element or other node to be tested against the Pattern * @param anchor The anchor node, which must match any AnchorPattern subpattern * @param context The dynamic context. Only relevant if the pattern * uses variables, or contains calls on functions such as document() or key(). * @return true if the node matches the Pattern, false otherwise */ public boolean matchesBeneathAnchor(NodeInfo node, NodeInfo anchor, XPathContext context) throws XPathException { return p1.matchesBeneathAnchor(node, anchor, context) || p2.matchesBeneathAnchor(node, anchor, context); }
/** * Determine whether this pattern matches a given Node within the subtree rooted at a given * anchor node. This method is used when the pattern is used for streaming. * * @param node The NodeInfo representing the Element or other node to be tested against the Pattern * @param anchor The anchor node, which must match any AnchorPattern subpattern * @param context The dynamic context. Only relevant if the pattern * uses variables, or contains calls on functions such as document() or key(). * @return true if the node matches the Pattern, false otherwise */ @Override public boolean matchesBeneathAnchor(NodeInfo node, NodeInfo anchor, XPathContext context) throws XPathException { return wrappedPattern.matchesBeneathAnchor(node, anchor, context); }
/** * Determine whether this pattern matches a given Node within the subtree rooted at a given * anchor node. This method is used when the pattern is used for streaming. * * @param node The NodeInfo representing the Element or other node to be tested against the Pattern * @param anchor The anchor node, which must match any AnchorPattern subpattern * @param context The dynamic context. Only relevant if the pattern * uses variables, or contains calls on functions such as document() or key(). * @return true if the node matches the Pattern, false otherwise */ public boolean matchesBeneathAnchor(NodeInfo node, NodeInfo anchor, XPathContext context) throws XPathException { return p1.matchesBeneathAnchor(node, anchor, context) && p2.matchesBeneathAnchor(node, anchor, context); }
@Override public boolean matchesBeneathAnchor(NodeInfo node, NodeInfo anchor, XPathContext context) throws XPathException { return getBasePattern().matchesBeneathAnchor(node, anchor, context) && matchesPredicate(node, context); }
private boolean hasMatchingAncestor(NodeInfo anchor, NodeInfo anc, XPathContext context) throws XPathException { while (anc != null) { if (upperPattern.matchesBeneathAnchor(anc, anchor, context)) { return true; } if (anc.equals(anchor)) { return false; } anc = anc.getParent(); } return false; }
@Override public boolean matchesBeneathAnchor(NodeInfo node, NodeInfo anchor, XPathContext context) throws XPathException { return getBasePattern().matchesBeneathAnchor(node, anchor, context) && matchesPredicate(node, context); }
private boolean hasMatchingAncestor(NodeInfo anchor, NodeInfo anc, XPathContext context) throws XPathException { while (anc != null) { if (upperPattern.matchesBeneathAnchor(anc, anchor, context)) { return true; } if (anc.equals(anchor)) { return false; } anc = anc.getParent(); } return false; }
private boolean matchesUpperPattern(NodeInfo node, NodeInfo anchor, XPathContext context) throws XPathException { switch (upwardsAxis) { case AxisInfo.SELF: return upperPattern.matchesBeneathAnchor(node, anchor, context); case AxisInfo.PARENT: NodeInfo par = node.getParent(); return par != null && upperPattern.matchesBeneathAnchor(par, anchor, context); case AxisInfo.ANCESTOR: { NodeInfo anc = node.getParent(); return hasMatchingAncestor(anchor, anc, context); } case AxisInfo.ANCESTOR_OR_SELF: { return hasMatchingAncestor(anchor, node, context); } default: throw new XPathException("Unsupported axis " + AxisInfo.axisName[upwardsAxis] + " in pattern"); } }
private boolean matchesUpperPattern(NodeInfo node, NodeInfo anchor, XPathContext context) throws XPathException { switch (upwardsAxis) { case AxisInfo.SELF: return upperPattern.matchesBeneathAnchor(node, anchor, context); case AxisInfo.PARENT: NodeInfo par = node.getParent(); return par != null && upperPattern.matchesBeneathAnchor(par, anchor, context); case AxisInfo.ANCESTOR: { NodeInfo anc = node.getParent(); return hasMatchingAncestor(anchor, anc, context); } case AxisInfo.ANCESTOR_OR_SELF: { return hasMatchingAncestor(anchor, node, context); } default: throw new XPathException("Unsupported axis " + AxisInfo.axisName[upwardsAxis] + " in pattern"); } }
/** * Determine whether this pattern matches a given Node within the subtree rooted at a given * anchor node. This method is used when the pattern is used for streaming. * * @param node The NodeInfo representing the Element or other node to be tested against the Pattern * @param anchor The anchor node, which must match any AnchorPattern subpattern * @param context The dynamic context. Only relevant if the pattern * uses variables, or contains calls on functions such as document() or key(). * @return true if the node matches the Pattern, false otherwise */ public boolean matchesBeneathAnchor(NodeInfo node, NodeInfo anchor, XPathContext context) throws XPathException { if (testUpperPatternFirst) { return matchesUpperPattern(node, anchor, context) && basePattern.matches(node, context); } else { return basePattern.matchesBeneathAnchor(node, anchor, context) && matchesUpperPattern(node, anchor, context); } }
/** * Determine whether this pattern matches a given Node within the subtree rooted at a given * anchor node. This method is used when the pattern is used for streaming. * * @param node The NodeInfo representing the Element or other node to be tested against the Pattern * @param anchor The anchor node, which must match any AnchorPattern subpattern * @param context The dynamic context. Only relevant if the pattern * uses variables, or contains calls on functions such as document() or key(). * @return true if the node matches the Pattern, false otherwise */ public boolean matchesBeneathAnchor(NodeInfo node, NodeInfo anchor, XPathContext context) throws XPathException { if (testUpperPatternFirst) { return matchesUpperPattern(node, anchor, context) && basePattern.matches(node, context); } else { return basePattern.matchesBeneathAnchor(node, anchor, context) && matchesUpperPattern(node, anchor, context); } }