/** * Ask whether the pattern is anchored on a call on current-group() * * @return true if calls on matchesBeneathAnchor should test with all nodes in the * current group as anchor nodes. If false, only the first node in a group is * treated as the anchor node */ public boolean matchesCurrentGroup() { return getBasePattern().matchesCurrentGroup(); }
/** * Get a UType indicating which kinds of items this Pattern can match. * * @return a UType indicating all the primitive types of item that the pattern can match. */ @Override public UType getUType() { return getBasePattern().getUType(); }
/** * Determine the name fingerprint of nodes to which this pattern applies. Used for * optimisation. * * @return A fingerprint that the nodes must match, or -1 if it can match multiple fingerprints, * or it if matches atomic values */ @Override public int getFingerprint() { return getBasePattern().getFingerprint(); }
/** * Get an ItemType that all the items matching this pattern must satisfy * * @return an ItemType, as specific as possible, which all the matching items satisfy */ /*@Nullable*/ @Override public ItemType getItemType() { return getBasePattern().getItemType(); }
/** * Display the pattern for diagnostics */ public String toString() { return getBasePattern() + "[" + getPredicate() + "]"; }
/** * Display the pattern for diagnostics */ public String toString() { return getBasePattern() + "[" + getPredicate() + "]"; }
/** * Get a UType indicating which kinds of items this Pattern can match. * * @return a UType indicating all the primitive types of item that the pattern can match. */ @Override public UType getUType() { return getBasePattern().getUType(); }
/** * Get an ItemType that all the items matching this pattern must satisfy * * @return an ItemType, as specific as possible, which all the matching items satisfy */ /*@Nullable*/ @Override public ItemType getItemType() { return getBasePattern().getItemType(); }
/** * Ask whether the pattern is anchored on a call on current-group() * * @return true if calls on matchesBeneathAnchor should test with all nodes in the * current group as anchor nodes. If false, only the first node in a group is * treated as the anchor node */ public boolean matchesCurrentGroup() { return getBasePattern().matchesCurrentGroup(); }
/** * Determine the name fingerprint of nodes to which this pattern applies. Used for * optimisation. * * @return A fingerprint that the nodes must match, or -1 if it can match multiple fingerprints, * or it if matches atomic values */ @Override public int getFingerprint() { return getBasePattern().getFingerprint(); }
@Override public boolean matchesBeneathAnchor(NodeInfo node, NodeInfo anchor, XPathContext context) throws XPathException { return getBasePattern().matchesBeneathAnchor(node, anchor, context) && matchesPredicate(node, context); }
@Override public boolean matchesBeneathAnchor(NodeInfo node, NodeInfo anchor, XPathContext context) throws XPathException { return getBasePattern().matchesBeneathAnchor(node, anchor, context) && matchesPredicate(node, context); }
@Override public boolean equals(Object obj) { return obj instanceof BasePatternWithPredicate && ((BasePatternWithPredicate)obj).getBasePattern().isEqual(getBasePattern()) && ((BasePatternWithPredicate) obj).getPredicate().isEqual(getPredicate()); }
@Override public boolean equals(Object obj) { return obj instanceof BasePatternWithPredicate && ((BasePatternWithPredicate)obj).getBasePattern().isEqual(getBasePattern()) && ((BasePatternWithPredicate) obj).getPredicate().isEqual(getPredicate()); }
/** * Allocate slots to any variables used within the pattern * * @param slotManager holds details of the allocated slots * @param nextFree the next slot that is free to be allocated @return the next slot that is free to be allocated */ public int allocateSlots(SlotManager slotManager, int nextFree) { int n = ExpressionTool.allocateSlots(getPredicate(), nextFree, slotManager); return getBasePattern().allocateSlots(slotManager, n); }
@Override public String toShortString() { return getBasePattern().toShortString() + "[" + getPredicate().toShortString() + "]"; }
public void export(ExpressionPresenter presenter) throws XPathException { presenter.startElement("p.withPredicate"); getBasePattern().export(presenter); getPredicate().export(presenter); presenter.endElement(); }
public void export(ExpressionPresenter presenter) throws XPathException { presenter.startElement("p.withPredicate"); getBasePattern().export(presenter); getPredicate().export(presenter); presenter.endElement(); }
public BasePatternWithPredicate(Pattern basePattern, Expression predicate) { basePatternOp = new Operand(this, basePattern, OperandRole.ATOMIC_SEQUENCE); predicateOp = new Operand(this, predicate, OperandRole.FOCUS_CONTROLLED_ACTION); adoptChildExpression(getBasePattern()); adoptChildExpression(getPredicate()); }
/** * Replace any calls on current() by a variable reference bound to the supplied binding */ @Override public void bindCurrent(LocalBinding binding) { Expression predicate = getPredicate(); if (predicate.isCallOn(Current.class)) { predicateOp.setChildExpression(new LocalVariableReference(binding)); } else if (ExpressionTool.callsFunction(predicate, Current.FN_CURRENT, false)) { replaceCurrent(predicate, binding); } getBasePattern().bindCurrent(binding); }