com.sun.tdk.specdiff.html

## Class SmartAssertionDiffer

- java.lang.Object
- - org.outerj.daisy.diff.html.HTMLDiffer
  - - com.sun.tdk.specdiff.html.SmartAssertionDiffer

-     public class SmartAssertionDiffer
      extends org.outerj.daisy.diff.html.HTMLDiffer

  Differ that tries to match assertions regardless the contextID they belong to.

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from class org.outerj.daisy.diff.html.HTMLDiffer

      `org.outerj.daisy.diff.html.HTMLDiffer.ContextHistory`

  - ### Field Summary

    - ### Fields inherited from class org.outerj.daisy.diff.html.HTMLDiffer

      `COMPARE_TEXT_PARAM, CONTEXT_FINDER, CONTEXT_FINDER_PARAM, DIFFER_FILTER, DIFFER_FILTER_PARAM, LCS_SETTINGS_PARAM`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `SmartAssertionDiffer(java.util.Map<java.lang.String,java.lang.Object> parameters)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `Analyzer` | `createAnalyzer()`
    `DocumentMatcher` | `createDocumentMatcher()`
    `java.util.List<org.outerj.daisy.diff.html.HTMLDiffer.ContextHistory>` | `diff(org.outerj.daisy.diff.html.dom.DomTreeBuilder oldDoc, org.outerj.daisy.diff.html.dom.DomTreeBuilder newDoc)` Compares two given documents.
    `protected org.eclipse.compare.rangedifferencer.RangeDifference` | `findAdded(com.sun.tdk.specdiff.html.AssertionHTMLDiffer.AssertComparator added)`
    `protected void` | `findAndApplyDifferences(org.eclipse.compare.internal.LCSSettings settings, boolean compareText, org.outerj.daisy.diff.html.TextNodeComparator leftComparator, org.outerj.daisy.diff.html.TextNodeComparator rightComparator)` Overrides default implementation.
    `protected org.eclipse.compare.rangedifferencer.RangeDifference` | `findDeleted(com.sun.tdk.specdiff.html.AssertionHTMLDiffer.AssertComparator del, org.outerj.daisy.diff.html.TextNodeComparator tnc)`
    `protected java.lang.String` | `getOldContextId(java.lang.String newCtxID)` Overrides default behavior to use section mapping data.
    `protected boolean` | `isMovedContextAlloweded()` It's ok,if left ctx is not equal to the right one
    `protected void` | `markAddedContext(ContextTree addedCtx)` Does necessary update to mark up added context as added.
    `protected void` | `markDeletedContext(ContextTree deletedCtx, ContextTree toInsertAfterCtx)` Does necessary update to insert deleted context into new doc and mark it up as deleted.
    `protected org.outerj.daisy.diff.html.TextNodeComparator` | `toTextNodeComparator(ContextTree ctxTree)` Overrides to take comparator from hash if already available.

    - ### Methods inherited from class org.outerj.daisy.diff.html.HTMLDiffer

      `applyDifferences, diff, diffCtx, getLCSSettings, getParameter, initLCSSettings, markAsDeleted, markAsNew, mergeAttributes, toContextHistory, toContextHistoryList`

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

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### SmartAssertionDiffer

          public SmartAssertionDiffer(java.util.Map<java.lang.String,java.lang.Object> parameters)

  - ### Method Detail

    - #### diff

          public java.util.List<org.outerj.daisy.diff.html.HTMLDiffer.ContextHistory> diff(org.outerj.daisy.diff.html.dom.DomTreeBuilder oldDoc,
                                                                                           org.outerj.daisy.diff.html.dom.DomTreeBuilder newDoc)
                                                                                    throws org.xml.sax.SAXException

      Compares two given documents. It uses com.sun.tdk.specdiff.assertdiff package to find matching assertions.
      Overrides:
        `diff` in class `org.outerj.daisy.diff.html.HTMLDiffer`
      Parameters:
        `oldDoc` -
        `newDoc` -
      Returns:
      Throws:
        `org.xml.sax.SAXException`

    - #### markAddedContext

          protected void markAddedContext(ContextTree addedCtx)

      Description copied from class: `org.outerj.daisy.diff.html.HTMLDiffer`
      Does necessary update to mark up added context as added.
      Overrides:
        `markAddedContext` in class `org.outerj.daisy.diff.html.HTMLDiffer`
      Parameters:
        `addedCtx` - context to mark up

    - #### markDeletedContext

          protected void markDeletedContext(ContextTree deletedCtx,
                                            ContextTree toInsertAfterCtx)

      Description copied from class: `org.outerj.daisy.diff.html.HTMLDiffer`
      Does necessary update to insert deleted context into new doc and mark it up as deleted.
      Overrides:
        `markDeletedContext` in class `org.outerj.daisy.diff.html.HTMLDiffer`
      Parameters:
        `deletedCtx` - context to insert and mark up (from the left)
        `toInsertAfterCtx` - context to insert after (from the right

    - #### createAnalyzer

          public Analyzer createAnalyzer()

    - #### createDocumentMatcher

          public DocumentMatcher createDocumentMatcher()

    - #### findAndApplyDifferences

          protected void findAndApplyDifferences(org.eclipse.compare.internal.LCSSettings settings,
                                                 boolean compareText,
                                                 org.outerj.daisy.diff.html.TextNodeComparator leftComparator,
                                                 org.outerj.daisy.diff.html.TextNodeComparator rightComparator)

      Overrides default implementation. Divides left and right on areas by assertions. And then compares areas having the same id.

    - #### getOldContextId

          protected java.lang.String getOldContextId(java.lang.String newCtxID)

      Overrides default behavior to use section mapping data.
      Overrides:
        `getOldContextId` in class `org.outerj.daisy.diff.html.HTMLDiffer`
      Parameters:
        `newCtxID` - The context ID in the new document
      Returns:
        context ID from the old document newCtxID is mapped to, or the same ID, if no mapping found.
      See Also:
        `HTMLDiffer.isMovedContextAlloweded()`

    - #### isMovedContextAlloweded

          protected boolean isMovedContextAlloweded()

      It's ok,if left ctx is not equal to the right one
      Overrides:
        `isMovedContextAlloweded` in class `org.outerj.daisy.diff.html.HTMLDiffer`
      Returns:
        true
      See Also:
        `HTMLDiffer.getOldContextId(java.lang.String)`

    - #### toTextNodeComparator

          protected org.outerj.daisy.diff.html.TextNodeComparator toTextNodeComparator(ContextTree ctxTree)

      Overrides to take comparator from hash if already available.
      Overrides:
        `toTextNodeComparator` in class `org.outerj.daisy.diff.html.HTMLDiffer`
      Parameters:
        `ctxTree` -
      Returns:

    - #### findAdded

          protected org.eclipse.compare.rangedifferencer.RangeDifference findAdded(com.sun.tdk.specdiff.html.AssertionHTMLDiffer.AssertComparator added)

      Parameters:
        `added` -
      Returns:
        RangeDifference to be applied to mark added text

    - #### findDeleted

          protected org.eclipse.compare.rangedifferencer.RangeDifference findDeleted(com.sun.tdk.specdiff.html.AssertionHTMLDiffer.AssertComparator del,
                                                                                     org.outerj.daisy.diff.html.TextNodeComparator tnc)

      Parameters:
        `del` -
        `tnc` -
      Returns:
        RangeDifference to be applied to mark text as deleted