edu.northwestern.at.morphadorner.tools.compareadornedfiles

## Class AdornedWordsLoader

- java.lang.Object
- - edu.northwestern.at.morphadorner.tools.compareadornedfiles.AdornedWordsLoader

-     public class AdornedWordsLoader
      extends java.lang.Object

  Loads word elements in an adorned XML file.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected java.util.Map<java.lang.String,AdornedWordData>` | `adornedWordDataMap` Map from word ID to adorned word data.
    `protected org.jdom2.Document` | `adornedXMLDocument` Adorned XML file as JDOM document.
    `protected java.util.List<java.lang.String>` | `wordIDs` List of word IDs.
    `protected java.util.Set<java.lang.String>` | `wordTagsSet` Set of word tags (typically "w" and "pc").

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `AdornedWordsLoader(java.lang.String adornedFileName)` Create adorned words loader.
    `AdornedWordsLoader(java.lang.String adornedFileName, java.lang.String[] wordTags)` Create adorned words loader.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `java.lang.String` | `findSiblingID(org.jdom2.Element wordElement, java.lang.String id)` Get sibling ID for a given word ID.
    `AdornedWordData` | `getAdornedWordData(java.lang.String id)` Get data for a specified word ID.
    `java.util.List<java.lang.String>` | `getAdornedWordIDs()` Return list of words IDs.
    `org.jdom2.Document` | `getDocument()` Get adorned XML document.
    `boolean` | `ifBlankPrecedes(org.jdom2.Element wordElement)` Determine if blank marker element ( ) precedes a word.
    `void` | `releaseDocument()` Release adorned XML document.

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

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

- - ### Field Detail

    - #### adornedWordDataMap

          protected java.util.Map<java.lang.String,AdornedWordData> adornedWordDataMap

      Map from word ID to adorned word data.

    - #### wordIDs

          protected java.util.List<java.lang.String> wordIDs

      List of word IDs.

    - #### wordTagsSet

          protected java.util.Set<java.lang.String> wordTagsSet

      Set of word tags (typically "w" and "pc").

    - #### adornedXMLDocument

          protected org.jdom2.Document adornedXMLDocument

      Adorned XML file as JDOM document.

  - ### Constructor Detail

    - #### AdornedWordsLoader

          public AdornedWordsLoader(java.lang.String adornedFileName,
                            java.lang.String[] wordTags)
                             throws java.lang.Exception

      Create adorned words loader.
      Parameters:
        `adornedFileName` - The adorned file from which to load word data.
        `wordTags` - String array of word tag element names, typically "w" and "pc".
      Throws:
        `java.lang.Exception` - in case of error.

    - #### AdornedWordsLoader

          public AdornedWordsLoader(java.lang.String adornedFileName)
                             throws java.lang.Exception

      Create adorned words loader.
      Parameters:
        `adornedFileName` - The adorned file from which to load word data.
      Throws:
        `java.lang.Exception` - in case of error.

        The word elements are assumed to be tagged as and .

  - ### Method Detail

    - #### getAdornedWordIDs

          public java.util.List<java.lang.String> getAdornedWordIDs()

      Return list of words IDs.
      Returns:
        list of word IDs.

    - #### getAdornedWordData

          public AdornedWordData getAdornedWordData(java.lang.String id)

      Get data for a specified word ID.
      Parameters:
        `id` - Word ID.
      Returns:
        The word data, or null if the word ID does not exist.

    - #### findSiblingID

          public java.lang.String findSiblingID(org.jdom2.Element wordElement,
                                       java.lang.String id)

      Get sibling ID for a given word ID.
      Parameters:
        `wordElement` - The word element.
        `id` - The word ID.
      Returns:
        Word ID of either the nearest previous sibling, if the given element is not the first child of its parent, or else the nearest following sibling. Returns null if a sibling cannot be found.

    - #### ifBlankPrecedes

          public boolean ifBlankPrecedes(org.jdom2.Element wordElement)

      Determine if blank marker element ( ) precedes a word.
      Parameters:
        `wordElement` - The word element.
      Returns:
        true if word is preceded by a blank marker element.

    - #### getDocument

          public org.jdom2.Document getDocument()

      Get adorned XML document.
      Returns:
        Adorned XML document.

    - #### releaseDocument

          public void releaseDocument()

      Release adorned XML document.