net.sf.saxon.functions

Class DeepEqual

Implemented Interfaces:
EvaluableItem, InstructionInfoProvider, SequenceIterable, Serializable, SourceLocator

public class DeepEqual
extends CollatingFunction

XSLT 2.0 deep-equal() function. Supports deep comparison of two sequences (of nodes and/or atomic values) optionally using a collation

Field Summary

static int
COMPARE_ANNOTATIONS
Flag indicating that elements and attributes must have the same type annotation to be considered deep-equal
static int
COMPARE_STRING_VALUES
Flag indicating that elements and attributes should always be compared according to their string value, not their typed value
static int
EXCLUDE_WHITESPACE_TEXT_NODES
Flag indicating that whitespace text nodes are ignored when comparing element nodes
static int
INCLUDE_COMMENTS
Flag indicating that comment children are taken into account when comparing element or document nodes
static int
INCLUDE_NAMESPACES
Flag indicating that two elements should only be considered equal if they have the same in-scope namespaces
static int
INCLUDE_PREFIXES
Flag indicating that two element or attribute nodes are considered equal only if their names use the same namespace prefix
static int
INCLUDE_PROCESSING_INSTRUCTIONS
Flag indicating that processing instruction nodes are taken into account when comparing element or document nodes
static int
JOIN_ADJACENT_TEXT_NODES
Flag indicating that adjacent text nodes in the top-level sequence are to be merged
static int
WARNING_IF_FALSE
Flag indicating that a warning message explaining the reason why the sequences were deemed non-equal should be sent to the ErrorListener

Fields inherited from class net.sf.saxon.functions.CollatingFunction

stringCollator

Fields inherited from class net.sf.saxon.functions.SystemFunction

operation

Fields inherited from class net.sf.saxon.expr.FunctionCall

argument

Fields inherited from class net.sf.saxon.expr.Expression

EVALUATE_METHOD, ITERATE_METHOD, PROCESS_METHOD, locationId, staticProperties

Method Summary

static boolean
deepEquals(SequenceIterator op1, SequenceIterator op2, GenericAtomicComparer collator, Configuration config, int flags)
Determine when two sequences are deep-equal
Item
evaluateItem(XPathContext context)
Evaluate the expression
Expression
preEvaluate(ExpressionVisitor visitor)
preEvaluate: if all arguments are known statically, evaluate early

Methods inherited from class net.sf.saxon.functions.CollatingFunction

checkArguments, copy, getAtomicComparer, getCollator, getExpressionBaseURI, getStringCollator

Methods inherited from class net.sf.saxon.functions.SystemFunction

addContextDocumentArgument, addDocToPathMap, checkArguments, computeCardinality, computeSpecialProperties, copy, getDetails, getErrorCodeForTypeErrors, getItemType, getRequiredType, makeSystemFunction, optimize, setDetails, useContextItemAsDefault

Methods inherited from class net.sf.saxon.expr.FunctionCall

addExternalFunctionCallToPathMap, checkArgumentCount, checkArguments, equals, explain, getArguments, getDisplayName, getFunctionName, getNumberOfArguments, hashCode, iterateSubExpressions, optimize, preEvaluate, promote, replaceSubExpression, setArguments, setFunctionName, simplify, simplifyArguments, toString, typeCheck

Methods inherited from class net.sf.saxon.expr.Expression

addToPathMap, adoptChildExpression, checkPermittedContents, computeCardinality, computeDependencies, computeSpecialProperties, computeStaticProperties, copy, display, doPromotion, dynamicError, effectiveBooleanValue, evaluateAsString, evaluateItem, explain, explain, findParentOf, getCardinality, getColumnNumber, getConstructType, getContainer, getDependencies, getExecutable, getHostLanguage, getImplementationMethod, getInstructionInfo, getIntrinsicDependencies, getItemType, getLineNumber, getLocationId, getLocationProvider, getPublicId, getSlotsUsed, getSpecialProperties, getSystemId, hasLoopingSubexpression, implementsStaticTypeCheck, iterate, iterateEvents, iterateSubExpressions, markTailFunctionCalls, optimize, process, promote, replaceSubExpression, resetLocalStaticProperties, setContainer, setFiltered, setFlattened, setLocationId, simplify, staticTypeCheck, suppressValidation, toString, typeCheck, typeError

Field Details

COMPARE_ANNOTATIONS

public static final int COMPARE_ANNOTATIONS
Flag indicating that elements and attributes must have the same type annotation to be considered deep-equal
Field Value:
64

COMPARE_STRING_VALUES

public static final int COMPARE_STRING_VALUES
Flag indicating that elements and attributes should always be compared according to their string value, not their typed value
Field Value:
32

EXCLUDE_WHITESPACE_TEXT_NODES

public static final int EXCLUDE_WHITESPACE_TEXT_NODES
Flag indicating that whitespace text nodes are ignored when comparing element nodes
Field Value:
16

INCLUDE_COMMENTS

public static final int INCLUDE_COMMENTS
Flag indicating that comment children are taken into account when comparing element or document nodes
Field Value:
4

INCLUDE_NAMESPACES

public static final int INCLUDE_NAMESPACES
Flag indicating that two elements should only be considered equal if they have the same in-scope namespaces
Field Value:
1

INCLUDE_PREFIXES

public static final int INCLUDE_PREFIXES
Flag indicating that two element or attribute nodes are considered equal only if their names use the same namespace prefix
Field Value:
2

INCLUDE_PROCESSING_INSTRUCTIONS

public static final int INCLUDE_PROCESSING_INSTRUCTIONS
Flag indicating that processing instruction nodes are taken into account when comparing element or document nodes
Field Value:
8

JOIN_ADJACENT_TEXT_NODES

public static final int JOIN_ADJACENT_TEXT_NODES
Flag indicating that adjacent text nodes in the top-level sequence are to be merged
Field Value:
256

WARNING_IF_FALSE

public static final int WARNING_IF_FALSE
Flag indicating that a warning message explaining the reason why the sequences were deemed non-equal should be sent to the ErrorListener
Field Value:
128

Method Details

deepEquals

public static boolean deepEquals(SequenceIterator op1,
                                 SequenceIterator op2,
                                 GenericAtomicComparer collator,
                                 Configuration config,
                                 int flags)
Determine when two sequences are deep-equal
Parameters:
op1 - the first sequence
op2 - the second sequence
collator - the collator to be used
config - the configuration (gives access to the NamePool)
flags - bit-significant integer giving comparison options. Always zero for standard F+O deep-equals comparison.
Returns:
true if the sequences are deep-equal

evaluateItem

public Item evaluateItem(XPathContext context)
            throws XPathException
Evaluate the expression
Specified by:
evaluateItem in interface EvaluableItem
Overrides:
evaluateItem in interface Expression

preEvaluate

public Expression preEvaluate(ExpressionVisitor visitor)
            throws XPathException
preEvaluate: if all arguments are known statically, evaluate early
Overrides:
preEvaluate in interface FunctionCall
Parameters:
visitor - an expression visitor