net.sf.saxon.functions

## Class DeepEqual

- java.lang.Object
- - net.sf.saxon.expr.Expression
  - - net.sf.saxon.expr.FunctionCall
    - - net.sf.saxon.functions.SystemFunctionCall
      - - net.sf.saxon.functions.CollatingFunction
        - - net.sf.saxon.functions.DeepEqual

- All Implemented Interfaces:
    Serializable, SourceLocator, LocationProvider, SaxonLocator, Callable, InstructionInfo, Locator

      public class DeepEqual
      extends CollatingFunction
      implements Callable

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

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static int` | `COMPARE_ANNOTATIONS` Flag indicating that elements and attributes must have the same type annotation to be considered deep-equal
    `static int` | `COMPARE_ID_FLAGS` Flag indicating that the is-id and is-idref flags are to be compared
    `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_VARIETY` Flag indicating that the variety of the type of a node is to be ignored (for example, a mixed content node can compare equal to an element-only content node
    `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

      `staticCollation`

    - ### Fields inherited from class net.sf.saxon.functions.SystemFunctionCall

      `operation`

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

      `argument`

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

      `EFFECTIVE_BOOLEAN_VALUE, EVALUATE_METHOD, EVENT_FEED_METHOD, INHERITED_CONTEXT, INSPECTION_CONTEXT, ITEM_FEED_METHOD, ITERATE_METHOD, locationId, MAX_SEQUENCE_LENGTH, MAX_STRING_LENGTH, NAVIGATION_CONTEXT, NODE_VALUE_CONTEXT, PROCESS_METHOD, PUSH_SELECTION, staticProperties, UNBOUNDED_LOWER, UNBOUNDED_UPPER, W3C_CONSUMING, W3C_FREE_RANGING, W3C_GROUP_CONSUMING, W3C_MOTIONLESS, WATCH_METHOD`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `DeepEqual()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `Sequence` | `call(XPathContext context, Sequence[] arguments)` Execute a dynamic call to the function
    `void` | `checkArguments(ExpressionVisitor visitor)` Method called during static type checking
    `static boolean` | `deepEquals(SequenceIterator op1, SequenceIterator op2, AtomicComparer collator, XPathContext context, int flags)` Determine when two sequences are deep-equal
    `BooleanValue` | `evaluateItem(XPathContext context)` Evaluate the expression
    `protected int` | `getCollationArgument()` Get the argument position (0-based) containing the collation name

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

      `bindStaticContext, copy, equals, expandCollationURI, getAtomicComparer, getCollator, getCollatorFromLastArgument, getExpressionBaseURI, getPreAllocatedAtomicComparer, getStaticCollation, preAllocateComparer`

    - ### Methods inherited from class net.sf.saxon.functions.SystemFunctionCall

      `addContextDocumentArgument, addDocToPathMap, computeCardinality, computeSpecialProperties, equalOrNull, getContextNode, getConvertingCallable, getDefaultArgumentNode, getDetails, getErrorCodeForTypeErrors, getFunctionItemType, getImplementationMethod, getItemType, getOperation, getRequiredType, iterateSubExpressionInfo, makeSystemFunction, optimize, setDetails, useContextItemAsDefault`

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

      `addExternalFunctionCallToPathMap, checkArgumentCount, explain, getArguments, getDisplayName, getExpressionName, getFunctionName, getNumberOfArguments, hashCode, iterateSubExpressions, preEvaluate, promote, replaceSubExpression, setArguments, setFunctionName, simplify, simplifyArguments, toString, typeCheck`

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

      `addToPathMap, adoptChildExpression, checkForUpdatingSubexpressions, checkPermittedContents, computeDependencies, computeStaticProperties, doPromotion, dynamicError, effectiveBooleanValue, evaluateAsString, evaluatePendingUpdates, explain, getCardinality, getColumnNumber, getColumnNumber, getConstructType, getContainer, getDependencies, getEvaluationMethod, getExecutable, getExpressionCompiler, getHostLanguage, getIntegerBounds, getIntrinsicDependencies, getLineNumber, getLineNumber, getLocationId, getLocationProvider, getObjectName, getProperties, getProperty, getPublicId, getSlotsUsed, getSpecialProperties, getStreamability, getStreamingAdjunct, getSystemId, getSystemId, hasVariableBinding, implementsStaticTypeCheck, isSubtreeExpression, isUpdatingExpression, isVacuousExpression, iterate, iterateEvents, markTailFunctionCalls, process, resetLocalStaticProperties, setContainer, setEvaluationMethod, setFiltered, setFlattened, setLocationId, staticTypeCheck, suppressValidation, toPattern, toStreamingPattern, typeError`

    - ### Methods inherited from class java.lang.Object

      `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

- - ### Field Detail

    - #### 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
      See Also:
        Constant Field Values

    - #### 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
      See Also:
        Constant Field Values

    - #### INCLUDE_COMMENTS

          public static final int INCLUDE_COMMENTS

      Flag indicating that comment children are taken into account when comparing element or document nodes
      See Also:
        Constant Field Values

    - #### 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
      See Also:
        Constant Field Values

    - #### EXCLUDE_WHITESPACE_TEXT_NODES

          public static final int EXCLUDE_WHITESPACE_TEXT_NODES

      Flag indicating that whitespace text nodes are ignored when comparing element nodes
      See Also:
        Constant Field Values

    - #### 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
      See Also:
        Constant Field Values

    - #### 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
      See Also:
        Constant Field Values

    - #### 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
      See Also:
        Constant Field Values

    - #### 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
      See Also:
        Constant Field Values

    - #### COMPARE_ID_FLAGS

          public static final int COMPARE_ID_FLAGS

      Flag indicating that the is-id and is-idref flags are to be compared
      See Also:
        Constant Field Values

    - #### EXCLUDE_VARIETY

          public static final int EXCLUDE_VARIETY

      Flag indicating that the variety of the type of a node is to be ignored (for example, a mixed content node can compare equal to an element-only content node
      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### DeepEqual

          public DeepEqual()

  - ### Method Detail

    - #### checkArguments

          public void checkArguments(ExpressionVisitor visitor)
                              throws XPathException

      Description copied from class: `SystemFunctionCall`
      Method called during static type checking
      Overrides:
        `checkArguments` in class `CollatingFunction`
      Parameters:
        `visitor` - the expression visitor
      Throws:
        `XPathException` - if the arguments are incorrect

    - #### getCollationArgument

          protected int getCollationArgument()

      Get the argument position (0-based) containing the collation name
      Specified by:
        `getCollationArgument` in class `CollatingFunction`
      Returns:
        the position of the argument containing the collation URI

    - #### evaluateItem

          public BooleanValue evaluateItem(XPathContext context)
                                    throws XPathException

      Evaluate the expression
      Overrides:
        `evaluateItem` in 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

    - #### deepEquals

          public static boolean deepEquals(SequenceIterator op1,
                           SequenceIterator op2,
                           AtomicComparer collator,
                           XPathContext context,
                           int flags)
                                    throws XPathException

      Determine when two sequences are deep-equal
      Parameters:
        `op1` - the first sequence
        `op2` - the second sequence
        `collator` - the collator to be used
        `context` - the XPathContext item
        `flags` - bit-significant integer giving comparison options. Always zero for standard F+O deep-equals comparison.
      Returns:
        true if the sequences are deep-equal
      Throws:
        `XPathException` - if either sequence contains a function item

    - #### call

          public Sequence call(XPathContext context,
                      Sequence[] arguments)
                        throws XPathException

      Execute a dynamic call to the function
      Specified by:
        `call` in interface `Callable`
      Parameters:
        `context` - the dynamic evaluation context
        `arguments` - the values of the arguments, supplied as Sequences.
      Returns:
        the result of the evaluation, in the form of a Sequence. It is the responsibility of the callee to ensure that the type of result conforms to the expected result type.
      Throws:
        `XPathException`

Copyright (c) 2004-2013 Saxonica Limited. All rights reserved.