maiolum
Class ChapterVerseIdentifier

java.lang.Object
  extended bymaiolum.ChapterVerseIdentifier
All Implemented Interfaces:
java.lang.Cloneable

public class ChapterVerseIdentifier
extends java.lang.Object
implements java.lang.Cloneable

The ChapterVerseIdentifier class is a container wrapping identifier for bible verse (typical identifier is "Mt1:1"). It contains methods to hold individual verse and chapter components, and to parse these components from the string.


Constructor Summary
ChapterVerseIdentifier()
          Empty constructor, internal ids are set to empty strings, separator defaults to '_' (underscore).
ChapterVerseIdentifier(java.lang.String id)
          After calling this constructor, internal chapter and verse ids are parsed from the string argument.
ChapterVerseIdentifier(java.lang.String chapterID, java.lang.String verseID)
          After calling this constructor, internal chapter id is set to chapterID and verse id is set to verseID.
 
Method Summary
static ChapterVerseIdentifier autoParse(java.lang.String id)
          Returns new ChapterVerseIdentifier with chapterID and verseID String parsed from the string argument, while guessing the separator.
 java.lang.Object clone()
           
 java.lang.String getChapterID()
           
 char getSeparator()
           
 java.lang.String getVerseID()
           
static ChapterVerseIdentifier parse(java.lang.String id, char separator)
          Returns new ChapterVerseIdentifier with chapterID and verseID properties parsed from the string argument.
 void setChapterID(java.lang.String chapterID)
           
 void setSeparator(char separator)
           
 void setVerseID(java.lang.String verseID)
           
 java.lang.String toString()
          Returns String representation form ChapterVerseIdentifier object.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ChapterVerseIdentifier

public ChapterVerseIdentifier()
Empty constructor, internal ids are set to empty strings, separator defaults to '_' (underscore).


ChapterVerseIdentifier

public ChapterVerseIdentifier(java.lang.String chapterID,
                              java.lang.String verseID)
After calling this constructor, internal chapter id is set to chapterID and verse id is set to verseID.


ChapterVerseIdentifier

public ChapterVerseIdentifier(java.lang.String id)
                       throws java.lang.IllegalArgumentException
After calling this constructor, internal chapter and verse ids are parsed from the string argument.

Throws:
java.lang.IllegalArgumentException - if string argument does not contain separator.
Method Detail

parse

public static ChapterVerseIdentifier parse(java.lang.String id,
                                           char separator)
                                    throws java.lang.IllegalArgumentException
Returns new ChapterVerseIdentifier with chapterID and verseID properties parsed from the string argument.

Second char argument is separator -- it is a character that separates chapter id from verse id, for example ':' in "Mt1:1" string.

Returns:
new ChapterVerseIdentifier with properties parsed from the string argument
Throws:
java.lang.IllegalArgumentException - if string argument doesn't contain separator character.

autoParse

public static ChapterVerseIdentifier autoParse(java.lang.String id)
                                        throws java.lang.IllegalArgumentException
Returns new ChapterVerseIdentifier with chapterID and verseID String parsed from the string argument, while guessing the separator.

The separators taken in account while guessing are: semicolon, underscore, and comma s.

Returns:
new ChapterVerseIdentifier with chapter and verse ID automatically parsed from string argument
Throws:
java.lang.IllegalArgumentException - if string argument doesn't seem to be valid Chapter identifier (because it does not contain separator and it is too long);

setSeparator

public void setSeparator(char separator)

getSeparator

public char getSeparator()

getChapterID

public java.lang.String getChapterID()

setChapterID

public void setChapterID(java.lang.String chapterID)

getVerseID

public java.lang.String getVerseID()

setVerseID

public void setVerseID(java.lang.String verseID)

toString

public java.lang.String toString()
Returns String representation form ChapterVerseIdentifier object. This is given as concatenation of chapter id, separator and verse id. For example: "Mt1:1", where ':' is separator.


clone

public java.lang.Object clone()