com.sun.tdk.specdiff.html.dom

## Class ContextTree

- java.lang.Object
- - com.sun.tdk.specdiff.html.dom.ContextTree

- All Implemented Interfaces:
    java.io.Serializable

      public final class ContextTree
      extends java.lang.Object
      implements java.io.Serializable

  Represents a tree of nodes inside context ContextNode (including ContextNode(s)). Not thread safe!
  See Also:
    Serialized Form

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `ContextTree` | `matchingCtx` The context from the another document the current one is matching to.
    `ContextTree` | `prevCtx` The previous context in the document.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `ContextTree(org.outerj.daisy.diff.html.dom.BodyNode bodyNode)`
    `ContextTree(ContextNode c, ContextTree parent)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addTextNode(org.outerj.daisy.diff.html.dom.TextNode textNode)` Appends `textNode` to the `textNodes` list If `textNode` 'closed' ContextNode -> re-calculates context boundaries Call this method only from org.outerj.daisy.diff.html.TextNodeComparator
    `boolean` | `equals(java.lang.Object o)`
    `java.util.List<org.outerj.daisy.diff.html.dom.TextNode>` | `findEnclosedAssertionTextNodes(AssertionNode openNode)` Returns a list of TextNode enclosed between open AssertionNode `openNode` and following closed AssertionNode
    `org.outerj.daisy.diff.html.dom.BodyNode` | `getBodyNode()`
    `ContextNode` | `getCloseContextNode()`
    `java.lang.String` | `getContextId()`
    `int` | `getEnd()`
    `ContextNode` | `getOpenContextNode()`
    `int` | `getSize()`
    `int` | `getStart()`
    `org.outerj.daisy.diff.html.dom.TextNode` | `getTextNode(int relPos)`
    `long` | `getUniqueHashCode()` This method returns a unique long value for each instance.
    `int` | `hashCode()`
    `boolean` | `isAssertOrCtx(org.outerj.daisy.diff.html.dom.Node node)` Returns true if `node` is AssertionNode or ContextNode
    `java.util.Set<java.lang.String>` | `stripAssertions()` Removes assertion nodes from the list of text nodes
    `void` | `sync()` Re-calculates `startPos` and `endPos` on `bodyNode` change
    `org.outerj.daisy.diff.html.dom.BodyNode` | `toBodyNode()`
    `java.lang.String` | `toString()`

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

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

- - ### Field Detail

    - #### prevCtx

          public ContextTree prevCtx

      The previous context in the document. Is used to identify the right place to insert deleted context, not used by this class.

    - #### matchingCtx

          public ContextTree matchingCtx

      The context from the another document the current one is matching to. Is used to identify the right place to insert deleted context, not used by this this class.

  - ### Constructor Detail

    - #### ContextTree

          public ContextTree(org.outerj.daisy.diff.html.dom.BodyNode bodyNode)

    - #### ContextTree

          public ContextTree(ContextNode c,
                             ContextTree parent)

  - ### Method Detail

    - #### getContextId

          public java.lang.String getContextId()

    - #### getBodyNode

          public org.outerj.daisy.diff.html.dom.BodyNode getBodyNode()

    - #### sync

          public void sync()

      Re-calculates `startPos` and `endPos` on `bodyNode` change

    - #### addTextNode

          public void addTextNode(org.outerj.daisy.diff.html.dom.TextNode textNode)

      Appends `textNode` to the `textNodes` list If `textNode` 'closed' ContextNode -> re-calculates context boundaries Call this method only from org.outerj.daisy.diff.html.TextNodeComparator

    - #### stripAssertions

          public java.util.Set<java.lang.String> stripAssertions()

      Removes assertion nodes from the list of text nodes
      Returns:
        list of assertion IDs found

    - #### getTextNode

          public org.outerj.daisy.diff.html.dom.TextNode getTextNode(int relPos)

    - #### getOpenContextNode

          public ContextNode getOpenContextNode()

    - #### getCloseContextNode

          public ContextNode getCloseContextNode()

    - #### getStart

          public int getStart()

    - #### getEnd

          public int getEnd()

    - #### getSize

          public int getSize()

    - #### toBodyNode

          public org.outerj.daisy.diff.html.dom.BodyNode toBodyNode()

    - #### findEnclosedAssertionTextNodes

          public java.util.List<org.outerj.daisy.diff.html.dom.TextNode> findEnclosedAssertionTextNodes(AssertionNode openNode)

      Returns a list of TextNode enclosed between open AssertionNode `openNode` and following closed AssertionNode

    - #### isAssertOrCtx

          public boolean isAssertOrCtx(org.outerj.daisy.diff.html.dom.Node node)

      Returns true if `node` is AssertionNode or ContextNode

    - #### toString

          public java.lang.String toString()

      Overrides:
        `toString` in class `java.lang.Object`

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `java.lang.Object`

    - #### equals

          public boolean equals(java.lang.Object o)

      Overrides:
        `equals` in class `java.lang.Object`

    - #### getUniqueHashCode

          public final long getUniqueHashCode()

      This method returns a unique long value for each instance. Used to organize hash map <ContextTree, Something>.
      Returns:
        a unique value associated with this instance.