/** * The toString() method for an expression attempts to give a representation of the expression * in an XPath-like form, but there is no guarantee that the syntax will actually be true XPath. * In the case of XSLT instructions, the toString() method gives an abstracted view of the syntax * * @return a representation of the expression as a string */ public String toString() { return (operator == Token.SOME ? "some" : "every") + " $" + getVariableEQName() + " in " + getSequence() + " satisfies " + ExpressionTool.parenthesize(getAction()); }
Expression ebv = BooleanFn.rewriteEffectiveBooleanValue(getAction(), visitor, contextItemType); if (ebv != null) { setAction(ebv); return e2; } else if (len == 1) { if (getAction() instanceof VariableReference && ((VariableReference) getAction()).getBinding() == this) { return SystemFunction.makeCall("boolean", getRetainedStaticContext(), getSequence()); } else { replaceVariable(getSequence()); return getAction();
/** * The toString() method for an expression attempts to give a representation of the expression * in an XPath-like form, but there is no guarantee that the syntax will actually be true XPath. * In the case of XSLT instructions, the toString() method gives an abstracted view of the syntax * * @return a representation of the expression as a string */ public String toString() { return (operator == Token.SOME ? "some" : "every") + " $" + getVariableEQName() + " in " + getSequence() + " satisfies " + ExpressionTool.parenthesize(getAction()); }
Expression ebv = BooleanFn.rewriteEffectiveBooleanValue(getAction(), visitor, contextItemType); if (ebv != null) { setAction(ebv); return e2; } else if (len == 1) { if (getAction() instanceof VariableReference && ((VariableReference) getAction()).getBinding() == this) { return SystemFunction.makeCall("boolean", getRetainedStaticContext(), getSequence()); } else { replaceVariable(getSequence()); return getAction();
/** * Check to ensure that this expression does not contain any updating subexpressions. * This check is overridden for those expressions that permit updating subexpressions. * * @throws net.sf.saxon.trans.XPathException * if the expression has a non-permitted updateing subexpression */ public void checkForUpdatingSubexpressions() throws XPathException { getSequence().checkForUpdatingSubexpressions(); getAction().checkForUpdatingSubexpressions(); }
XPathException err = TypeChecker.ebvError(getAction(), visitor.getConfiguration().getTypeHierarchy()); if (err != null) { err.setLocation(getLocation());
/** * Check to ensure that this expression does not contain any updating subexpressions. * This check is overridden for those expressions that permit updating subexpressions. * * @throws net.sf.saxon.trans.XPathException * if the expression has a non-permitted updateing subexpression */ public void checkForUpdatingSubexpressions() throws XPathException { getSequence().checkForUpdatingSubexpressions(); getAction().checkForUpdatingSubexpressions(); }
XPathException err = TypeChecker.ebvError(getAction(), visitor.getConfiguration().getTypeHierarchy()); if (err != null) { err.setLocation(getLocation());
/** * Diagnostic print of expression structure. The abstract expression tree * is written to the supplied output destination. */ public void export(ExpressionPresenter out) throws XPathException { out.startElement(Token.tokens[operator], this); out.emitAttribute("var", getVariableQName()); out.emitAttribute("slot", ""+slotNumber); getSequence().export(out); getAction().export(out); out.endElement(); }
/** * Diagnostic print of expression structure. The abstract expression tree * is written to the supplied output destination. */ public void export(ExpressionPresenter out) throws XPathException { out.startElement(Token.tokens[operator], this); out.emitAttribute("var", getVariableQName()); out.emitAttribute("slot", ""+slotNumber); getSequence().export(out); getAction().export(out); out.endElement(); }
/** * Get the result as a boolean */ public boolean effectiveBooleanValue(XPathContext context) throws XPathException { // First create an iteration of the base sequence. SequenceIterator<?> base = getSequence().iterate(context); // Now test to see if some or all of the tests are true. The same // logic is used for the SOME and EVERY operators final boolean some = operator == Token.SOME; int slot = getLocalSlotNumber(); Item<?> it; while ((it = base.next()) != null) { context.setLocalVariable(slot, it); if (some == getAction().effectiveBooleanValue(context)) { base.close(); return some; } } return !some; }
/** * Get the result as a boolean */ public boolean effectiveBooleanValue(XPathContext context) throws XPathException { // First create an iteration of the base sequence. SequenceIterator<?> base = getSequence().iterate(context); // Now test to see if some or all of the tests are true. The same // logic is used for the SOME and EVERY operators final boolean some = operator == Token.SOME; int slot = getLocalSlotNumber(); Item<?> it; while ((it = base.next()) != null) { context.setLocalVariable(slot, it); if (some == getAction().effectiveBooleanValue(context)) { base.close(); return some; } } return !some; }
public AbstractExpression exprFor (QuantifiedExpression expr) { Satisfies.Quantifier quantifier = expr.getOperator() == Token.SOME ? Quantifier.SOME : Quantifier.EVERY; return new Satisfies(quantifier, new Variable(qnameFor(expr.getVariableQName())), exprFor(expr.getSequence()), exprFor (expr.getAction())); }
/** * Copy an expression. This makes a deep copy. * * @return the copy of the original expression * @param rebindings variables that need to be re-bound */ /*@NotNull*/ public Expression copy(RebindingMap rebindings) { QuantifiedExpression qe = new QuantifiedExpression(); ExpressionTool.copyLocationInfo(this, qe); qe.setOperator(operator); qe.setVariableQName(variableName); qe.setRequiredType(requiredType); qe.setSequence(getSequence().copy(rebindings)); Expression newAction = getAction().copy(rebindings); qe.setAction(newAction); qe.variableName = variableName; qe.slotNumber = slotNumber; ExpressionTool.rebindVariableReferences(newAction, this, qe); return qe; }
/** * Copy an expression. This makes a deep copy. * * @return the copy of the original expression * @param rebindings variables that need to be re-bound */ /*@NotNull*/ public Expression copy(RebindingMap rebindings) { QuantifiedExpression qe = new QuantifiedExpression(); ExpressionTool.copyLocationInfo(this, qe); qe.setOperator(operator); qe.setVariableQName(variableName); qe.setRequiredType(requiredType); qe.setSequence(getSequence().copy(rebindings)); Expression newAction = getAction().copy(rebindings); qe.setAction(newAction); qe.variableName = variableName; qe.slotNumber = slotNumber; ExpressionTool.rebindVariableReferences(newAction, this, qe); return qe; }
QuantifiedExpression q0 = (QuantifiedExpression)term; Expression sequence = q0.getSequence(); Expression action = q0.getAction(); Binding[] thisVar = {this}; if (positionVariable == null &&
QuantifiedExpression q0 = (QuantifiedExpression)term; Expression sequence = q0.getSequence(); Expression action = q0.getAction(); Binding[] thisVar = {this}; if (positionVariable == null &&
QuantifiedExpression q0 = (QuantifiedExpression)term; Expression sequence = q0.getSequence(); Expression action = q0.getAction(); Binding[] thisVar = {this}; if (positionVariable == null &&