net.sf.saxon.expr

Class NegateExpression

public class NegateExpression extends UnaryExpression

Negate Expression: implements the unary minus operator. This expression is initially created as an ArithmeticExpression (or in backwards compatibility mode, an ArithmeticExpression10) to take advantage of the type checking code. So we don't need to worry about type checking or argument conversion.
Constructor Summary
NegateExpression(Expression base)
Create a NegateExpression
Method Summary
Expressioncopy()
Copy an expression.
protected StringdisplayOperator(Configuration config)
ItemevaluateItem(XPathContext context)
Evaluate the expression.
ItemTypegetItemType(TypeHierarchy th)
Determine the data type of the expression, if this is known statically
voidsetBackwardsCompatible(boolean compatible)
Set whether the expression is to be evaluated in XPath 1.0 compatibility mode
ExpressiontypeCheck(ExpressionVisitor visitor, ItemType contextItemType)

Constructor Detail

NegateExpression

public NegateExpression(Expression base)
Create a NegateExpression

Parameters: base the expression that computes the value whose sign is to be reversed

Method Detail

copy

public Expression copy()
Copy an expression. This makes a deep copy.

Returns: the copy of the original expression

displayOperator

protected String displayOperator(Configuration config)

evaluateItem

public Item evaluateItem(XPathContext context)
Evaluate the expression.

getItemType

public ItemType getItemType(TypeHierarchy th)
Determine the data type of the expression, if this is known statically

Parameters: th the type hierarchy cache

setBackwardsCompatible

public void setBackwardsCompatible(boolean compatible)
Set whether the expression is to be evaluated in XPath 1.0 compatibility mode

Parameters: compatible true if XPath 1.0 compatibility mode is enabled

typeCheck

public Expression typeCheck(ExpressionVisitor visitor, ItemType contextItemType)