org.crosswire.jsword.book.study
Class StrongsNumber

java.lang.Object
  extended by 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:

Author:
DM Smith [dmsmith555 at yahoo dot com]
See Also:
for license details. The copyright to this program is held by it's authors.

Field Summary
private  char language
          Whether it is Greek (G) or Hebrew (H).
private static Pattern STRONGS_PATTERN
          The pattern of an acceptable strongs number.
private  short strongsNumber
          The Strong's Number.
private static DecimalFormat ZERO_PAD
           
 
Constructor Summary
StrongsNumber(char language, short strongsNumber)
          Build an immutable Strong's Number.
StrongsNumber(String input)
          Build an immutable Strong's Number.
 
Method Summary
 boolean equals(Object obj)
           
 String getStrongsNumber()
          Return the canonical form of a Strong's Number.
 int hashCode()
           
private  void parse(String input)
          Do the actual parsing.
 String toString()
           
private  void validate()
           
 
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 short strongsNumber
The Strong's Number.


STRONGS_PATTERN

private static final Pattern STRONGS_PATTERN
The pattern of an acceptable strongs number.


ZERO_PAD

private static final DecimalFormat ZERO_PAD
Constructor Detail

StrongsNumber

public StrongsNumber(String input)
              throws BookException
Build an immutable Strong's Number. Anything that does not match causes a BookException.

Parameters:
input - a string that needs to be parsed.
Throws:
BookException

StrongsNumber

public StrongsNumber(char language,
                     short strongsNumber)
              throws BookException
Build an immutable Strong's Number. If the language is not 'G' or 'H' or the number is invalid, a BookException.

Parameters:
language -
strongsNumber -
Throws:
BookException
Method Detail

getStrongsNumber

public String getStrongsNumber()
Return the canonical form of a Strong's Number.

Returns:
the strongsNumber

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 void parse(String input)
            throws BookException
Do the actual parsing. Anything that does not match causes a BookException.

Parameters:
input -
Throws:
BookException

validate

private void validate()
               throws BookException
Throws:
BookException

Copyright ยจ 2003-2007