public String toShortString() { return (operator == Token.SOME ? "some" : "every") + " $" + getVariableName() + " in " + getSequence().toShortString() + " satisfies ..."; }
if (Literal.isEmptySequence(getSequence())) { return Literal.makeLiteral(BooleanValue.get(operator != Token.SOME), this); setSequence(getSequence().unordered(false, false)); getSequence(), sequenceType, role, visitor.getStaticContext())); ItemType actualItemType = getSequence().getItemType(); refineTypeInformation(actualItemType, StaticProperty.EXACTLY_ONE, null, getSequence().getSpecialProperties(), this);
public String toShortString() { return (operator == Token.SOME ? "some" : "every") + " $" + getVariableName() + " in " + getSequence().toShortString() + " satisfies ..."; }
if (Literal.isEmptySequence(getSequence())) { return Literal.makeLiteral(BooleanValue.get(operator != Token.SOME), this); setSequence(getSequence().unordered(false, false)); getSequence(), sequenceType, role, visitor.getStaticContext())); ItemType actualItemType = getSequence().getItemType(); refineTypeInformation(actualItemType, StaticProperty.EXACTLY_ONE, null, getSequence().getSpecialProperties(), this);
/** * 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()); }
return SystemFunction.makeCall("exists", getRetainedStaticContext(), getSequence()); } else { Expression e2 = new Literal(BooleanValue.TRUE); return e2; } else { return SystemFunction.makeCall("empty", getRetainedStaticContext(), getSequence()); if (getSequence() instanceof Literal) { GroundedValue seq = ((Literal)getSequence()).getValue(); int len = seq.getLength(); if (len == 0) { } 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(); }
return SystemFunction.makeCall("exists", getRetainedStaticContext(), getSequence()); } else { Expression e2 = new Literal(BooleanValue.TRUE); return e2; } else { return SystemFunction.makeCall("empty", getRetainedStaticContext(), getSequence()); if (getSequence() instanceof Literal) { GroundedValue seq = ((Literal)getSequence()).getValue(); int len = seq.getLength(); if (len == 0) { } 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()); }
/** * 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(); }
/** * 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; }
Expression sequence = q0.getSequence(); Expression action = q0.getAction(); Binding[] thisVar = {this};
Expression sequence = q0.getSequence(); Expression action = q0.getAction(); Binding[] thisVar = {this};
Expression sequence = q0.getSequence(); Expression action = q0.getAction(); Binding[] thisVar = {this};