Package net.sf.saxon.expr
Class NegateExpression
- java.lang.Object
- 
- net.sf.saxon.expr.Expression
- 
- net.sf.saxon.expr.UnaryExpression
- 
- net.sf.saxon.expr.NegateExpression
 
 
 
- 
- All Implemented Interfaces:
- ExportAgent,- Locatable,- IdentityComparable,- Traceable
 
 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.
- 
- 
Field Summary- 
Fields inherited from class net.sf.saxon.expr.ExpressionEFFECTIVE_BOOLEAN_VALUE, EVALUATE_METHOD, ITEM_FEED_METHOD, ITERATE_METHOD, MAX_COST, MAX_SEQUENCE_LENGTH, MAX_STRING_LENGTH, PROCESS_METHOD, staticProperties, UNBOUNDED_LOWER, UNBOUNDED_UPPER, UPDATE_METHOD, WATCH_METHOD
 
- 
 - 
Constructor SummaryConstructors Constructor Description NegateExpression(Expression base)Create a NegateExpression
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description protected intcomputeCardinality()Determine the static cardinality.Expressioncopy(RebindingMap rebindings)Copy an expression.protected java.lang.StringdisplayOperator(Configuration config)Give a string representation of the operator for use in diagnosticsNumericValueevaluateItem(XPathContext context)Evaluate the expression.voidexport(ExpressionPresenter out)Diagnostic print of expression structure.java.lang.StringgetExpressionName()Get a name identifying the kind of expression, in terms meaningful to a user.intgetImplementationMethod()An implementation of Expression must provide at least one of the methods evaluateItem(), iterate(), or process().ItemTypegetItemType()Determine the data type of the expression, if this is known staticallyprotected OperandRolegetOperandRole()Get the usage (in terms of streamability analysis) of the single operandbooleanisBackwardsCompatible()Ask whether the expression is to be evaluated in XPath 1.0 compatibility modevoidsetBackwardsCompatible(boolean compatible)Set whether the expression is to be evaluated in XPath 1.0 compatibility modeExpressiontypeCheck(ExpressionVisitor visitor, ContextItemStaticInfo contextInfo)Type-check the expression.- 
Methods inherited from class net.sf.saxon.expr.UnaryExpressioncomputeHashCode, computeSpecialProperties, emitExtraAttributes, equals, getBaseExpression, getOperand, operands, optimize, setBaseExpression, toShortString, toString
 - 
Methods inherited from class net.sf.saxon.expr.ExpressionaddToPathMap, adoptChildExpression, allowExtractingCommonSubexpressions, checkedOperands, checkForUpdatingSubexpressions, checkPermittedContents, computeDependencies, computeStaticProperties, dynamicError, effectiveBooleanValue, evaluateAsString, evaluatePendingUpdates, explain, getCardinality, getConfiguration, getCost, getDependencies, getEvaluationMethod, getExtraProperty, getIntegerBounds, getInterpretedExpression, getIntrinsicDependencies, getLocalRetainedStaticContext, getLocation, getNetCost, getObjectName, getPackageData, getParentExpression, getProperties, getProperty, getRetainedStaticContext, getScopingExpression, getSlotsUsed, getSpecialProperties, getStaticBaseURI, getStaticBaseURIString, getStaticType, getStaticUType, getStreamerName, getTracingTag, hasCompatibleStaticContext, hashCode, hasSpecialProperty, hasVariableBinding, identityHashCode, implementsStaticTypeCheck, isCallOn, isEqual, isIdentical, isInstruction, isLiftable, isMultiThreaded, isStaticPropertiesKnown, isSubtreeExpression, isUpdatingExpression, isVacuousExpression, iterate, markTailFunctionCalls, operandList, operandSparseList, optimizeChildren, prepareForStreaming, process, resetLocalStaticProperties, restoreParentPointers, setEvaluationMethod, setExtraProperty, setFiltered, setFlattened, setLocation, setParentExpression, setRetainedStaticContext, setRetainedStaticContextLocally, setRetainedStaticContextThoroughly, setStaticProperty, simplify, simplifyChildren, staticTypeCheck, suppressValidation, toPattern, typeCheckChildren, typeError, unordered, verifyParentPointers
 - 
Methods inherited from class java.lang.Objectclone, finalize, getClass, notify, notifyAll, wait, wait, wait
 - 
Methods inherited from interface net.sf.saxon.trace.TraceablegatherProperties
 
- 
 
- 
- 
- 
Constructor Detail- 
NegateExpressionpublic NegateExpression(Expression base) Create a NegateExpression- Parameters:
- base- the expression that computes the value whose sign is to be reversed
 
 
- 
 - 
Method Detail- 
setBackwardsCompatiblepublic 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
 
 - 
isBackwardsCompatiblepublic boolean isBackwardsCompatible() Ask whether the expression is to be evaluated in XPath 1.0 compatibility mode- Returns:
- true if XPath 1.0 compatibility mode is enabled
 
 - 
getOperandRoleprotected OperandRole getOperandRole() Description copied from class:UnaryExpressionGet the usage (in terms of streamability analysis) of the single operand- Specified by:
- getOperandRolein class- UnaryExpression
- Returns:
- the operand usage
 
 - 
typeCheckpublic Expression typeCheck(ExpressionVisitor visitor, ContextItemStaticInfo contextInfo) throws XPathException Description copied from class:UnaryExpressionType-check the expression. Default implementation for unary operators that accept any kind of operand- Overrides:
- typeCheckin class- UnaryExpression
- Parameters:
- visitor- an expression visitor
- contextInfo- Information available statically about the context item: whether it is (possibly) absent; its static type; its streaming posture.
- Returns:
- the original expression, rewritten to perform necessary run-time type checks, and to perform other type-related optimizations
- Throws:
- XPathException- if an error is discovered during this phase (typically a type error)
 
 - 
getItemTypepublic ItemType getItemType() Determine the data type of the expression, if this is known statically- Overrides:
- getItemTypein class- UnaryExpression
- Returns:
- the item type of the items in the result sequence, insofar as this is known statically.
 
 - 
computeCardinalityprotected int computeCardinality() Description copied from class:UnaryExpressionDetermine the static cardinality. Default implementation returns the cardinality of the operand- Overrides:
- computeCardinalityin class- UnaryExpression
- Returns:
- the computed cardinality, as one of the values StaticProperty.ALLOWS_ZERO_OR_ONE,StaticProperty.EXACTLY_ONE,StaticProperty.ALLOWS_ONE_OR_MORE,StaticProperty.ALLOWS_ZERO_OR_MORE. May also returnStaticProperty.ALLOWS_ZEROif the result is known to be an empty sequence, orStaticProperty.ALLOWS_MANYif if is known to return a sequence of length two or more.
 
 - 
getImplementationMethodpublic int getImplementationMethod() An implementation of Expression must provide at least one of the methods evaluateItem(), iterate(), or process(). This method indicates which of these methods is provided directly. The other methods will always be available indirectly, using an implementation that relies on one of the other methods.- Specified by:
- getImplementationMethodin class- Expression
- Returns:
- the implementation method, for example Expression.ITERATE_METHODorExpression.EVALUATE_METHODorExpression.PROCESS_METHOD
 
 - 
evaluateItempublic NumericValue evaluateItem(XPathContext context) throws XPathException Evaluate the expression.- Overrides:
- evaluateItemin class- Expression
- Parameters:
- context- The context in which the expression is to be evaluated
- Returns:
- the node or atomic value that results from evaluating the expression; or null to indicate that the result is an empty sequence
- Throws:
- XPathException- if any dynamic error occurs evaluating the expression
 
 - 
copypublic Expression copy(RebindingMap rebindings) Copy an expression. This makes a deep copy.- Specified by:
- copyin class- Expression
- Parameters:
- rebindings- variables that need to be re-bound
- Returns:
- the copy of the original expression
 
 - 
displayOperatorprotected java.lang.String displayOperator(Configuration config) Description copied from class:UnaryExpressionGive a string representation of the operator for use in diagnostics- Overrides:
- displayOperatorin class- UnaryExpression
- Parameters:
- config- the Saxon configuration
- Returns:
- the operator, as a string
 
 - 
getExpressionNamepublic java.lang.String getExpressionName() Get a name identifying the kind of expression, in terms meaningful to a user.- Overrides:
- getExpressionNamein class- Expression
- Returns:
- a name identifying the kind of expression, in terms meaningful to a user. The name will always be in the form of a lexical XML QName, and should match the name used in explain() output displaying the expression.
 
 - 
exportpublic void export(ExpressionPresenter out) throws XPathException Description copied from class:UnaryExpressionDiagnostic print of expression structure. The abstract expression tree is written to the supplied output destination.- Specified by:
- exportin interface- ExportAgent
- Overrides:
- exportin class- UnaryExpression
- Parameters:
- out- the expression presenter used to display the structure
- Throws:
- XPathException- if the export fails, for example if an expression is found that won't work in the target environment.
 
 
- 
 
-