com.sun.tdk.specdiff.html.stat

## Class StatBuilder

- java.lang.Object
- - com.sun.tdk.specdiff.html.AbstractDifferModule
  - - com.sun.tdk.specdiff.html.stat.StatBuilder

- All Implemented Interfaces:
    DifferModule
  Direct Known Subclasses:
    DiffStatBuilder

      public abstract class StatBuilder
      extends AbstractDifferModule

  Diff statistics builder: - assigns modification types - finds conflicts - resolves conflicts via using inner class ConflictResolver Note: not thread safe!
  See Also:
    `Differ`

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static interface` | `StatBuilder.ConflictResolver`
    `class` | `StatBuilder.DefaultConflictResolver`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected java.util.Map<java.lang.String,Assertion>` | `assertionMap`
    `protected Context` | `context`
    `protected Document` | `doc`
    `static ProblemType` | `DUPLICATE_ASSERTION`
    `protected org.outerj.daisy.diff.html.HTMLDiffer.ContextHistory` | `history`
    `protected java.util.List<org.outerj.daisy.diff.html.HTMLDiffer.ContextHistory>` | `historyList`
    `protected org.outerj.daisy.diff.html.dom.DomTreeBuilder` | `hnd`
    `static ProblemType` | `INVALID_TEST_CASE`
    `protected static java.util.logging.Logger` | `LOG`
    `static ProblemType` | `MISSED_CLOSE`
    `static ProblemType` | `MISSED_OPEN`
    `protected org.outerj.daisy.diff.html.modification.ModificationType` | `modType`
    `static ProblemType` | `NONEXISTENT_TEST_CASE`
    `static ProblemType` | `RENAMED_ASSERTION`
    `static ProblemType` | `RENAMED_CONTEXT`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `StatBuilder()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `java.io.File` | `build(org.outerj.daisy.diff.html.dom.DomTreeBuilder hnd, java.util.List<org.outerj.daisy.diff.html.HTMLDiffer.ContextHistory> historyList, org.outerj.daisy.diff.html.modification.ModificationType modType)` Builds diff statistics
    `protected void` | `doBuild()` Start processing
    `protected void` | `doBuild(org.outerj.daisy.diff.html.dom.TagNode node)` Processes one TagNode
    `protected boolean` | `filterAccept()` Applies filters Override it, if needed
    `protected java.util.List<AssertionNode>` | `findAssertionNodes(java.lang.String assertionId)` Returns AssertionNode(s) with ID `assertionId`
    `protected ChangedAssertionResult` | `findChangedAssertion(org.outerj.daisy.diff.html.HTMLDiffer.ContextHistory ch, java.lang.String assertionId)` Returns a structure with context ID and 'changed' assertion ID
    `protected ChangedAssertionResult` | `findChangedAssertion(java.lang.String assertionId)` Returns a structure with context ID and 'changed' assertion ID The method goes thru the whole document trying to find assertion # `assertionId`
    `protected org.outerj.daisy.diff.html.HTMLDiffer.ContextHistory` | `findContextHistory(java.lang.String contextId)`
    `Assertion` | `getAssertion(Context c, java.lang.String name)` Helper method: Assertion getter
    `StatBuilder.ConflictResolver` | `getConflictResolver()` Returns instance of ConflictResolver Override it!
    `Context` | `getContext(java.lang.String name)` Helper method: Context getter
    `Document` | `getDocument()` Document getter
    `protected java.io.File` | `getXmlStatFile()` Returns output file for XML statistics
    `protected void` | `initNewContext(java.lang.String name, boolean add)` Creates new Context
    `protected void` | `postBuild()` Post-process Override it!
    `protected void` | `preBuild()` Pre-process Override it!
    `protected void` | `process(AssertionNode aNode)` Processes single AssertionNode
    `protected void` | `process(org.outerj.daisy.diff.html.dom.BodyNode bNode)` Processes ContextNode
    `protected void` | `process(ContextNode cNode)` Processes single ContextNode
    `protected void` | `process(org.outerj.daisy.diff.html.dom.TextNode node)` Processes single TextNode
    `protected void` | `resolveProblem(org.outerj.daisy.diff.html.dom.Node node, Problem p)` Allow to resolve found problems This method updates corresponding ProblemStatus if the problem is resolved Override it!
    `protected void` | `validateAndFix(AssertionNode aNode)` Validates AssertionNode and fix issues if any
    `protected void` | `validateAndFix(ContextNode cNode)` Validates ContextNode and fix issues if any WARNING: don't refer to `this.context`
    `protected java.io.File` | `write()` Saves statistics in XML file

    - ### Methods inherited from class com.sun.tdk.specdiff.html.AbstractDifferModule

      `getFileName, getNewPath, getOldPath, getOutDir, getParameters, init`

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

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

- - ### Field Detail

    - #### RENAMED_CONTEXT

          public static final ProblemType RENAMED_CONTEXT

    - #### RENAMED_ASSERTION

          public static final ProblemType RENAMED_ASSERTION

    - #### DUPLICATE_ASSERTION

          public static final ProblemType DUPLICATE_ASSERTION

    - #### MISSED_OPEN

          public static final ProblemType MISSED_OPEN

    - #### MISSED_CLOSE

          public static final ProblemType MISSED_CLOSE

    - #### NONEXISTENT_TEST_CASE

          public static final ProblemType NONEXISTENT_TEST_CASE

    - #### INVALID_TEST_CASE

          public static final ProblemType INVALID_TEST_CASE

    - #### doc

          protected final Document doc

    - #### hnd

          protected org.outerj.daisy.diff.html.dom.DomTreeBuilder hnd

    - #### historyList

          protected java.util.List<org.outerj.daisy.diff.html.HTMLDiffer.ContextHistory> historyList

    - #### modType

          protected org.outerj.daisy.diff.html.modification.ModificationType modType

    - #### history

          protected org.outerj.daisy.diff.html.HTMLDiffer.ContextHistory history

    - #### context

          protected Context context

    - #### assertionMap

          protected java.util.Map<java.lang.String,Assertion> assertionMap

    - #### LOG

          protected static final java.util.logging.Logger LOG

  - ### Constructor Detail

    - #### StatBuilder

          public StatBuilder()

  - ### Method Detail

    - #### getConflictResolver

          public StatBuilder.ConflictResolver getConflictResolver()

      Returns instance of ConflictResolver Override it!

    - #### build

          public final java.io.File build(org.outerj.daisy.diff.html.dom.DomTreeBuilder hnd,
                                          java.util.List<org.outerj.daisy.diff.html.HTMLDiffer.ContextHistory> historyList,
                                          org.outerj.daisy.diff.html.modification.ModificationType modType)
                                   throws java.io.IOException

      Builds diff statistics
      Parameters:
        `hnd` - Document's handler
        `modType` - default ModificationType for the Document (optional)
      Throws:
        `java.io.IOException`

    - #### getDocument

          public final Document getDocument()

      Document getter

    - #### getContext

          public final Context getContext(java.lang.String name)

      Helper method: Context getter

    - #### getAssertion

          public final Assertion getAssertion(Context c,
                                              java.lang.String name)

      Helper method: Assertion getter

    - #### preBuild

          protected void preBuild()

      Pre-process Override it!

    - #### doBuild

          protected final void doBuild()

      Start processing

    - #### doBuild

          protected final void doBuild(org.outerj.daisy.diff.html.dom.TagNode node)

      Processes one TagNode

    - #### process

          protected void process(org.outerj.daisy.diff.html.dom.BodyNode bNode)

      Processes ContextNode

    - #### process

          protected void process(ContextNode cNode)

      Processes single ContextNode

    - #### process

          protected void process(AssertionNode aNode)

      Processes single AssertionNode

    - #### process

          protected void process(org.outerj.daisy.diff.html.dom.TextNode node)

      Processes single TextNode

    - #### postBuild

          protected void postBuild()

      Post-process Override it!

    - #### filterAccept

          protected boolean filterAccept()

      Applies filters Override it, if needed

    - #### validateAndFix

          protected void validateAndFix(AssertionNode aNode)

      Validates AssertionNode and fix issues if any

    - #### validateAndFix

          protected void validateAndFix(ContextNode cNode)

      Validates ContextNode and fix issues if any WARNING: don't refer to `this.context`

    - #### resolveProblem

          protected void resolveProblem(org.outerj.daisy.diff.html.dom.Node node,
                                        Problem p)

      Allow to resolve found problems This method updates corresponding ProblemStatus if the problem is resolved Override it!

    - #### initNewContext

          protected void initNewContext(java.lang.String name,
                                        boolean add)

      Creates new Context
      Parameters:
        `name` - Optional.

    - #### write

          protected java.io.File write()
                                throws java.io.IOException

      Saves statistics in XML file
      Throws:
        `java.io.IOException`

    - #### getXmlStatFile

          protected java.io.File getXmlStatFile()

      Returns output file for XML statistics

    - #### findAssertionNodes

          protected java.util.List<AssertionNode> findAssertionNodes(java.lang.String assertionId)

      Returns AssertionNode(s) with ID `assertionId`

    - #### findContextHistory

          protected org.outerj.daisy.diff.html.HTMLDiffer.ContextHistory findContextHistory(java.lang.String contextId)

    - #### findChangedAssertion

          protected ChangedAssertionResult findChangedAssertion(org.outerj.daisy.diff.html.HTMLDiffer.ContextHistory ch,
                                                                java.lang.String assertionId)

      Returns a structure with context ID and 'changed' assertion ID
      Returns:
        ChangedAssertionResult or NULL if the assertion is not present

    - #### findChangedAssertion

          protected ChangedAssertionResult findChangedAssertion(java.lang.String assertionId)

      Returns a structure with context ID and 'changed' assertion ID The method goes thru the whole document trying to find assertion # `assertionId`
      Returns:
        ChangedAssertionResult or NULL if the assertion is not present