org.crosswire.jsword.book.study

## Class StrongsNumber

- java.lang.Object
- - org.crosswire.jsword.book.study.StrongsNumber

-     public class StrongsNumber
      extends Object

  A Strong's Number is either Greek or Hebrew, where the actual numbers for each start at 1. This class can parse Strong's Numbers that begin with G, g, H or h and are immediately followed by a number. That number can have leading 0's. It can be followed by an OSISref extension of !a, !b, which is ignored.

  The canonical representation of the number is a G or H followed by 4 digits, with leading 0's as needed.

  Numbers that exist:

  - Hebrew: 1-8674
  - Greek: 1-5624 (but not 1418, 2717, 3203-3302, 4452)
  Author:
    DM Smith
  See Also:
    `The GNU Lesser General Public License for details.`

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `private char` | `language` Whether it is Greek (G) or Hebrew (H).
    `private String` | `part` The part if any.
    `private static Pattern` | `STRONGS_PATTERN` The pattern of an acceptable Strong's number.
    `private int` | `strongsNumber` The Strong's Number.
    `private boolean` | `valid`
    `private static DecimalFormat` | `ZERO_PAD`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `StrongsNumber(char language, short strongsNumber)` Build an immutable Strong's Number.
    `StrongsNumber(char language, short strongsNumber, String part)` Build an immutable Strong's Number.
    `StrongsNumber(String input)` Build an immutable Strong's Number.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `equals(Object obj)`
    `String` | `getFullStrongsNumber()` Return the canonical form of a Strong's Number, with the part, if any
    `String` | `getStrongsNumber()` Return the canonical form of a Strong's Number, without the part.
    `int` | `hashCode()`
    `boolean` | `isGreek()`
    `boolean` | `isHebrew()`
    `boolean` | `isPart()`
    `boolean` | `isValid()` Validates the number portion of this StrongsNumber.
    `private boolean` | `parse(String input)` Do the actual parsing.
    `String` | `toString()`

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

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

- - ### Field Detail

    - #### language

          private char language

      Whether it is Greek (G) or Hebrew (H).

    - #### strongsNumber

          private int strongsNumber

      The Strong's Number.

    - #### part

          private String part

      The part if any.

    - #### valid

          private boolean valid

    - #### STRONGS_PATTERN

          private static final Pattern STRONGS_PATTERN

      The pattern of an acceptable Strong's number.

    - #### ZERO_PAD

          private static final DecimalFormat ZERO_PAD

  - ### Constructor Detail

    - #### StrongsNumber

          public StrongsNumber(String input)

      Build an immutable Strong's Number.
      Parameters:
        `input` - a string that needs to be parsed.

    - #### StrongsNumber

          public StrongsNumber(char language,
                       short strongsNumber)

      Build an immutable Strong's Number.
      Parameters:
        `language` -
        `strongsNumber` -

    - #### StrongsNumber

          public StrongsNumber(char language,
                       short strongsNumber,
                       String part)

      Build an immutable Strong's Number.
      Parameters:
        `language` -
        `strongsNumber` -
        `part` -

  - ### Method Detail

    - #### getStrongsNumber

          public String getStrongsNumber()

      Return the canonical form of a Strong's Number, without the part.
      Returns:
        the strongsNumber

    - #### getFullStrongsNumber

          public String getFullStrongsNumber()

      Return the canonical form of a Strong's Number, with the part, if any
      Returns:
        the strongsNumber

    - #### isGreek

          public boolean isGreek()

      Returns:
        true if the Strong's number is for Greek

    - #### isHebrew

          public boolean isHebrew()

      Returns:
        true if the Strong's number is for Hebrew

    - #### isPart

          public boolean isPart()

      Returns:
        true if this Strong's number is identified by a sub part

    - #### isValid

          public boolean isValid()

      Validates the number portion of this StrongsNumber.
      - Hebrew Strong's numbers are in the range of: 1-8674.
      - Greek Strong's numbers in the range of: 1-5624 (but not 1418, 2717, 3203-3302, 4452).
      Returns:
        true if the Strong's number is in range.

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `Object`

    - #### equals

          public boolean equals(Object obj)

      Overrides:
        `equals` in class `Object`

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

    - #### parse

          private boolean parse(String input)

      Do the actual parsing.
      Parameters:
        `input` -
      Returns:
        true when the input looks like a Strong's Number