edu.northwestern.at.morphadorner

## Class SentenceAndWordNumber

- java.lang.Object
- - edu.northwestern.at.morphadorner.SentenceAndWordNumber

- All Implemented Interfaces:
    java.lang.Comparable

      public class SentenceAndWordNumber
      extends java.lang.Object
      implements java.lang.Comparable

  Holds sentence and word number data for a word.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected boolean` | `eos` The end-of-sentence flag.
    `protected java.lang.String` | `id` The word ID.
    `protected int` | `ord` The word ordinal.
    `protected java.lang.String` | `part` Word part flag.
    `protected int` | `sentenceNumber` The sentence number for the word.
    `protected int` | `wordNumber` The word number within the sentence.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `SentenceAndWordNumber(java.lang.String id, int ord, java.lang.String part, boolean eos)` Create SentenceAndWordNumber entry.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `int` | `compareTo(java.lang.Object object)` Compare this object with another.
    `boolean` | `getEOS()` Get end of sentence flag.
    `java.lang.String` | `getID()` Get word ID.
    `int` | `getOrd()` Get word ordinal.
    `int` | `getSentenceNumber()` Get sentence number for word.
    `int` | `getWordNumber()` Get word number in sentence.
    `int` | `hashCode()` Hash code is hash value for word ID.
    `boolean` | `isFirstPart()` Check if word is first (or only) part of a split word.
    `boolean` | `isLastPart()` Check if word is last (or only) part of a split word.
    `boolean` | `isMiddlePart()` Check if word is middle (or only) part of a split word.
    `void` | `setID(java.lang.String id)` Set word ID.
    `void` | `setSentenceAndWordNumber(int sentenceNumber, int wordNumber)` Set sentence number and word number.
    `java.lang.String` | `toString()` Return a string representation of this object.

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

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

- - ### Field Detail

    - #### id

          protected java.lang.String id

      The word ID.

    - #### ord

          protected int ord

      The word ordinal.

    - #### part

          protected java.lang.String part

      Word part flag.

      N for an unsplit word. I for the the first part of a split word. M for the middle part(s) of a split word. F for the final part of a split word.

    - #### eos

          protected boolean eos

      The end-of-sentence flag.

    - #### wordNumber

          protected int wordNumber

      The word number within the sentence.

    - #### sentenceNumber

          protected int sentenceNumber

      The sentence number for the word.

  - ### Constructor Detail

    - #### SentenceAndWordNumber

          public SentenceAndWordNumber(java.lang.String id,
                               int ord,
                               java.lang.String part,
                               boolean eos)

      Create SentenceAndWordNumber entry.
      Parameters:
        `id` - The word ID.
        `ord` - The word ordinal.
        `part` - The word part flag.
        `eos` - True if word at end of sentence.

  - ### Method Detail

    - #### setSentenceAndWordNumber

          public void setSentenceAndWordNumber(int sentenceNumber,
                                      int wordNumber)

      Set sentence number and word number.
      Parameters:
        `wordNumber` - The word number within the sentence.
        `sentenceNumber` - The sentence number.

    - #### getID

          public java.lang.String getID()

      Get word ID.
      Returns:
        The word ID.

    - #### setID

          public void setID(java.lang.String id)

      Set word ID.
      Parameters:
        `id` - The word ID.

    - #### getOrd

          public int getOrd()

      Get word ordinal.
      Returns:
        The word ordinal.

    - #### isFirstPart

          public boolean isFirstPart()

      Check if word is first (or only) part of a split word.
      Returns:
        True if word is first part of a split word or only part of a non-split word.

    - #### isMiddlePart

          public boolean isMiddlePart()

      Check if word is middle (or only) part of a split word.
      Returns:
        True if word is middle part of a split word or only part of a non-split word.

    - #### isLastPart

          public boolean isLastPart()

      Check if word is last (or only) part of a split word.
      Returns:
        True if word is last part of a split word or only part of a non-split word.

    - #### getSentenceNumber

          public int getSentenceNumber()

      Get sentence number for word.
      Returns:
        The sentence number in which this word appears.

    - #### getWordNumber

          public int getWordNumber()

      Get word number in sentence.
      Returns:
        The word number in the sentence.

    - #### getEOS

          public boolean getEOS()

      Get end of sentence flag.
      Returns:
        The end of sentence flag.

    - #### compareTo

          public int compareTo(java.lang.Object object)

      Compare this object with another.
      Specified by:
        `compareTo` in interface `java.lang.Comparable`
      Parameters:
        `object` - The other object.
      Returns:
        < 0 if the other object is less than this one, = 0 if the two objects are equal, > 0 if the other object is greater than this one.

        We compare the word IDs only.

    - #### hashCode

          public int hashCode()

      Hash code is hash value for word ID.
      Overrides:
        `hashCode` in class `java.lang.Object`
      Returns:
        The hash value.

    - #### toString

          public java.lang.String toString()

      Return a string representation of this object.
      Overrides:
        `toString` in class `java.lang.Object`
      Returns:
        A string representation of this object.