|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.crosswire.jsword.passage.AbstractPassage
org.crosswire.jsword.passage.BitwisePassage
org.crosswire.jsword.passage.RocketPassage
public class RocketPassage
A RocketPassage is a bit and heavy implementation of Passage that goes fairly quickly once let of the leash. It manages its speed by creating contained instances of DistinctPassage and RangedPassage and selects the fastest implementation for each fo its methods from the 3 available.
for license details.
The copyright to this program is held by it's authors.
,
Serialized FormNested Class Summary |
---|
Nested classes/interfaces inherited from class org.crosswire.jsword.passage.AbstractPassage |
---|
AbstractPassage.VerseRangeIterator |
Field Summary | |
---|---|
private DistinctPassage |
distinct
The contained DistinctPassage |
private RangedPassage |
ranged
The contained RangedPassage |
private static long |
serialVersionUID
Serialization ID |
Fields inherited from class org.crosswire.jsword.passage.BitwisePassage |
---|
store |
Fields inherited from class org.crosswire.jsword.passage.AbstractPassage |
---|
BITWISE, DISTINCT, listeners, METHOD_COUNT, originalName, RANGED, REF_ALLOWED_DELIMS, REF_OSIS_DELIM, REF_PREF_DELIM, skipNormalization, suppressEvents |
Constructor Summary | |
---|---|
|
RocketPassage()
Create a new RocketPassage |
protected |
RocketPassage(String refs)
Create a Verse from a human readable string. |
Method Summary | |
---|---|
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 |
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. |
VerseRange |
getRangeAt(int offset,
RestrictionType restrict)
Get a specific VerseRange from this collection |
Verse |
getVerseAt(int offset)
Get a specific Verse from this collection |
boolean |
isEmpty()
Does this Passage have 0 members |
Iterator |
iterator()
|
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. |
protected void |
optimizeWrites()
Simple method to instruct children to stop caching results |
Iterator |
rangeIterator(RestrictionType restrict)
Like verseElements() that iterates over VerseRanges instead of Verses. |
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() |
Methods inherited from class org.crosswire.jsword.passage.BitwisePassage |
---|
add, addAll, blur, clear, clone, contains, remove, removeAll, retainAll |
Methods inherited from class org.crosswire.jsword.passage.AbstractPassage |
---|
addPassageListener, addVerses, canHaveChildren, compareTo, equals, fireContentsChanged, fireIntervalAdded, fireIntervalRemoved, get, getChildCount, getName, getName, getOsisID, getOsisRef, getOverview, getParent, hashCode, indexOf, lowerEventSuppresionAndTest, lowerNormalizeProtection, normalize, raiseEventSuppresion, raiseNormalizeProtection, readDescription, readObjectSupport, removePassageListener, setParent, toString, toVerseRange, trimRanges, trimVerses, writeDescription, writeObjectSupport |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
private transient DistinctPassage distinct
private transient RangedPassage ranged
private static final long serialVersionUID
Constructor Detail |
---|
public RocketPassage()
protected RocketPassage(String refs) throws NoSuchVerseException
RangedPassage v2 = new RangedPassage(v1.getName());
Then v1.equals(v2);
Theoretically, since there are many ways of representing a RangedPassage as text
string comparision along the lines of:
v1.getName().equals(v2.getName())
could be false.
However since getName() is standardized this will be true.
We don't need to worry about thread safety in a ctor since we don't exist yet.
refs
- A String containing the text of the RangedPassage
NoSuchVerseException
- if refs is invalidMethod Detail |
---|
public void optimizeReads()
optimizeReads
in interface Passage
optimizeReads
in class AbstractPassage
protected void optimizeWrites()
AbstractPassage
optimizeWrites
in class AbstractPassage
public int countRanges(RestrictionType restrict)
Passage
countRanges
in interface Passage
countRanges
in class AbstractPassage
restrict
- Do we break ranges at chapter/book boundries
VerseRange
public int countVerses()
Passage
countVerses
in interface Passage
countVerses
in class BitwisePassage
Verse
public Iterator iterator()
iterator
in interface Iterable
iterator
in class BitwisePassage
public Iterator rangeIterator(RestrictionType restrict)
Passage
rangeIterator
in interface Passage
rangeIterator
in class BitwisePassage
restrict
- Do we break ranges over chapters
public boolean isEmpty()
Key
isEmpty
in interface Key
isEmpty
in class BitwisePassage
public Verse getVerseAt(int offset) throws ArrayIndexOutOfBoundsException
Passage
getVerseAt
in interface Passage
getVerseAt
in class AbstractPassage
offset
- The verse offset (legal values are 0 to countVerses()-1)
ArrayIndexOutOfBoundsException
- If the offset is out of rangepublic VerseRange getRangeAt(int offset, RestrictionType restrict) throws ArrayIndexOutOfBoundsException
Passage
getRangeAt
in interface Passage
getRangeAt
in class AbstractPassage
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 rangepublic int booksInPassage()
Passage
booksInPassage
in interface Passage
booksInPassage
in class AbstractPassage
public int chaptersInPassage(int book) throws NoSuchVerseException
Passage
chaptersInPassage
in interface Passage
chaptersInPassage
in class AbstractPassage
book
- The book to check (0 for distinct chapters in all books)
NoSuchVerseException
- if the book is invalidpublic int versesInPassage(int book, int chapter) throws NoSuchVerseException
Passage
versesInPassage(ref, 0, 0) == ref.countVerses()
versesInPassage
in interface Passage
versesInPassage
in class AbstractPassage
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 invalidpublic boolean containsAll(Passage that)
Passage
containsAll
in interface Passage
containsAll
in class AbstractPassage
that
- Passage to be checked for containment in this collection.
|
Copyright ยจ 2003-2006 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |