/** * Copy an expression. This makes a deep copy. * * @return the copy of the original expression */ public Expression copy() { return new Literal(value); }
/** * Copy an expression. This makes a deep copy. * * @return the copy of the original expression */ public Expression copy() { return new Literal(value); }
/** * Factory method to make an empty-sequence literal * * @return a literal whose value is the empty sequence */ public static Literal makeEmptySequence() { return new Literal(EmptySequence.getInstance()); }
/** * Factory method to make an empty-sequence literal * * @return a literal whose value is the empty sequence */ public static Literal makeEmptySequence() { return new Literal(EmptySequence.getInstance()); }
/** * Create a literal as a wrapper around a Value (factory method) * @param value the value of this literal * @return the Literal */ public static Literal makeLiteral(Value value) { if (value instanceof StringValue) { return new StringLiteral((StringValue)value); } else { return new Literal(value); } }
/** * Make an empty-sequence literal * @return a literal whose value is the empty sequence */ public static Literal makeEmptySequence() { return new Literal(EmptySequence.getInstance()); }
/** * Create a literal as a wrapper around a Value (factory method) * @param value the value of this literal * @return the Literal */ public static Literal makeLiteral(Value value) { if (value instanceof StringValue) { return new StringLiteral((StringValue)value); } else { return new Literal(value); } }
/** * Make an empty-sequence literal * @return a literal whose value is the empty sequence */ public static Literal makeEmptySequence() { return new Literal(EmptySequence.getInstance()); }
/** * Copy an expression. This makes a deep copy. * * @param rebindings variables that need to be re-bound * @return a copy of the original literal. Note that the * underlying value is not copied; the code relies on the caller * treating the underlying value as immutable. */ /*@NotNull*/ public Expression copy(RebindingMap rebindings) { Literal l2 = new Literal(value); ExpressionTool.copyLocationInfo(this, l2); return l2; }
/** * Copy an expression. This makes a deep copy. * * @param rebindings variables that need to be re-bound * @return a copy of the original literal. Note that the * underlying value is not copied; the code relies on the caller * treating the underlying value as immutable. */ /*@NotNull*/ public Expression copy(RebindingMap rebindings) { Literal l2 = new Literal(value); ExpressionTool.copyLocationInfo(this, l2); return l2; }
/** * Factory method to create a literal as a wrapper around a Value (factory method) * * @param value the value of this literal * @return the Literal */ public static <T extends Item<?>> Literal makeLiteral(GroundedValue<T> value) { value = value.reduce(); if (value instanceof StringValue) { return new StringLiteral((StringValue) value); } else { return new Literal(value); } }
/** * Factory method to create a literal as a wrapper around a Value (factory method) * * @param value the value of this literal * @return the Literal */ public static <T extends Item<?>> Literal makeLiteral(GroundedValue<T> value) { value = value.reduce(); if (value instanceof StringValue) { return new StringLiteral((StringValue) value); } else { return new Literal(value); } }
public Expression getRhsExpression() { return new Literal(new Int64Value(comparand)); }
public Expression getRhsExpression() { return new Literal(new Int64Value(comparand)); }
/** * Create an expression that returns the negation of this expression * @return the negated expression */ public Expression negate() { switch (operation) { case BOOLEAN: return SystemFunction.makeSystemFunction("not", getArguments()); case NOT: return SystemFunction.makeSystemFunction("boolean", getArguments()); case TRUE: return new Literal(BooleanValue.FALSE); case FALSE: default: return new Literal(BooleanValue.TRUE); } }
/** * Create an expression that returns the negation of this expression * @return the negated expression */ public Expression negate() { switch (operation) { case BOOLEAN: return SystemFunction.makeSystemFunction("not", getArguments()); case NOT: return SystemFunction.makeSystemFunction("boolean", getArguments()); case TRUE: return new Literal(BooleanValue.FALSE); case FALSE: default: return new Literal(BooleanValue.TRUE); } }
/** * Create a saxon:iterate instruction * @param select the select expression * @param action the body of the saxon:iterate loop * @param finallyExp the expression to be evaluated before final completion, may be null */ public IterateInstr(Expression select, Expression action, Expression finallyExp) { this.select = select; this.action = action; this.finallyExp = (finallyExp == null ? new Literal(EmptySequence.getInstance()) : finallyExp); adoptChildExpression(select); adoptChildExpression(action); adoptChildExpression(finallyExp); }
public Expression optimize(ExpressionVisitor visitor, ItemType contextItemType) throws XPathException { select = visitor.optimize(select, contextItemType); separator = visitor.optimize(separator, contextItemType); if (select instanceof Literal && separator instanceof Literal) { XPathContext c = visitor.getStaticContext().makeEarlyEvaluationContext(); return new Literal(Value.asValue(evaluateItem(c))); } return this; }
private Expression preEvaluate(ExpressionVisitor visitor) throws XPathException { if (Literal.isAtomic(operand)) { return Literal.makeLiteral( BooleanValue.get(effectiveBooleanValue(visitor.getStaticContext().makeEarlyEvaluationContext()))); } if (Literal.isEmptySequence(operand)) { return new Literal(BooleanValue.get(allowEmpty)); } return this; }
private Expression preEvaluate(ExpressionVisitor visitor) throws XPathException { if (Literal.isAtomic(operand)) { return Literal.makeLiteral( BooleanValue.get(effectiveBooleanValue(visitor.getStaticContext().makeEarlyEvaluationContext()))); } if (Literal.isEmptySequence(operand)) { return new Literal(BooleanValue.get(allowEmpty)); } return this; }