|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface Passage
A Passage is a specialized Collection of Verses. The additions are:
Passage no longer extends the Collection interface to avoid J2SE 1.1/1.2 portability problems, and because many of the things that a Passage does rely on consecutive Verses which are an alien concept to Collections. So users would have to use the Passage interface anyway.
Other arguments for and against.
The upshot of all this is that I am removing the Collections interface from Passage, but writing a PassageSet as a proxy.
I considered giving Passages names to allow for a CLI that could use named RangedPassages, however that is perhaps better left to another class.
for license details.
The copyright to this program is held by it's authors.
Method Summary | |
---|---|
void |
add(Key that)
Add this Verse/VerseRange to this Passage |
void |
addPassageListener(PassageListener li)
Event Listeners - Add Listener |
int |
booksInPassage()
How many books are there in this Passage |
int |
chaptersInPassage(int book)
How many chapters are there in a particular book in this Passage |
boolean |
contains(Key that)
Returns true if this collection contains all the specified Verse |
boolean |
containsAll(Passage that)
Returns true if this Passage contains all of the verses in that Passage |
int |
countRanges(RestrictionType restrict)
Like countVerses() that counts VerseRanges instead of Verses Returns the number of fragments in this collection. |
int |
countVerses()
Returns the number of verses in this collection. |
String |
getOverview()
A summary of the verses in this Passage For example "10 verses in 4 books" |
VerseRange |
getRangeAt(int offset,
RestrictionType restrict)
Get a specific VerseRange from this collection |
Verse |
getVerseAt(int offset)
Get a specific Verse from this collection |
void |
optimizeReads()
For preformance reasons we may well want to hint to the Passage that we have done editing it for now and that it is safe to cache certain values to speed up future reads. |
Iterator |
rangeIterator(RestrictionType restrict)
Like verseElements() that iterates over VerseRanges instead of Verses. |
void |
readDescription(Reader in)
To be compatible with humans we read/write ourselves to a file that a human can read and even edit. |
void |
remove(Key that)
Remove this Verse/VerseRange from this Passage |
void |
removePassageListener(PassageListener li)
Event Listeners - Remove Listener |
Passage |
trimRanges(int count,
RestrictionType restrict)
Ensures that there are a maximum of count VerseRanges
in this Passage. |
Passage |
trimVerses(int count)
Ensures that there are a maximum of count Verses in
this Passage. |
int |
versesInPassage(int book,
int chapter)
How many chapters are there in a particular book in this Passage Note that versesInPassage(ref, 0, 0) == ref.countVerses() |
void |
writeDescription(Writer out)
To be compatible with humans we read/write ourselves to a file that a human can read and even edit. |
Methods inherited from interface org.crosswire.jsword.passage.Key |
---|
addAll, blur, canHaveChildren, clear, clone, get, getChildCount, getName, getName, getOsisID, getOsisRef, getParent, indexOf, isEmpty, removeAll, retainAll |
Methods inherited from interface java.lang.Comparable |
---|
compareTo |
Methods inherited from interface org.crosswire.common.util.Iterable |
---|
iterator |
Method Detail |
---|
String getOverview()
int countVerses()
Verse
int countRanges(RestrictionType restrict)
restrict
- Do we break ranges at chapter/book boundries
VerseRange
Passage trimVerses(int count)
count
Verses in
this Passage. If there were more than count
Verses
then a new Passage is created containing the Verses from
count
+1 onwards. If there was not greater than
count
in the Passage, then the passage remains
unchanged, and null is returned.
count
- The maximum number of Verses to allow in this collection
Verse
Passage trimRanges(int count, RestrictionType restrict)
count
VerseRanges
in this Passage. If there were more than count
VerseRanges then a new Passage is created containing the
VerseRanges from count
+1 onwards. If there was not
greater than count
in the Passage, then the passage
remains unchanged, and null is returned.
count
- The maximum number of VerseRanges to allow in this collectionrestrict
- Do we break ranges at chapter/book boundries
VerseRange
int booksInPassage()
int chaptersInPassage(int book) throws NoSuchVerseException
book
- The book to check (0 for distinct chapters in all books)
NoSuchVerseException
- if the book is invalidint versesInPassage(int book, int chapter) throws NoSuchVerseException
versesInPassage(ref, 0, 0) == ref.countVerses()
book
- The book to check (0 for distinct chapters in all books)chapter
- The chapter to check (0 for distinct verses in all chapters)
NoSuchVerseException
- if the book/chapter is invalidVerse getVerseAt(int offset) throws ArrayIndexOutOfBoundsException
offset
- The verse offset (legal values are 0 to countVerses()-1)
ArrayIndexOutOfBoundsException
- If the offset is out of rangeVerseRange getRangeAt(int offset, RestrictionType restrict) throws ArrayIndexOutOfBoundsException
offset
- The verse range offset (legal values are 0 to countRanges()-1)restrict
- Do we break ranges at chapter/book boundries
ArrayIndexOutOfBoundsException
- If the offset is out of rangeIterator rangeIterator(RestrictionType restrict)
restrict
- Do we break ranges over chapters
boolean contains(Key that)
contains
in interface Key
that
- Verse or VerseRange that may exist in this Passage
void add(Key that)
that
- The Verses to be removed from this Passagevoid remove(Key that)
that
- The Verses to be removed from this Passageboolean containsAll(Passage that)
that
- Passage to be checked for containment in this collection.
void readDescription(Reader in) throws IOException, NoSuchVerseException
in
- The stream to read from
IOException
- If the file/network etc breaks
NoSuchVerseException
- If the file was invalidvoid writeDescription(Writer out) throws IOException
out
- The stream to write to
IOException
- If the file/network etc breaksvoid optimizeReads()
void addPassageListener(PassageListener li)
li
- The listener to addvoid removePassageListener(PassageListener li)
li
- The listener to remove
|
Copyright ยจ 2003-2006 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |