|
||||||||||
| 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 of its methods from the 3 available.
for license details.
The copyright to this program is held by it's authors.,
Serialized Form| Nested 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 Key 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. |
private void |
readObject(ObjectInputStream is)
Serialization support |
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, getCardinality, getChildCount, getName, getName, getOsisID, getOsisRef, getOverview, getParent, getRootName, hashCode, hasRanges, 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 invalid| Method Detail |
|---|
public void optimizeReads()
optimizeReads in interface PassageoptimizeReads in class AbstractPassageprotected void optimizeWrites()
AbstractPassage
optimizeWrites in class AbstractPassagepublic int countRanges(RestrictionType restrict)
Passage
countRanges in interface PassagecountRanges in class AbstractPassagerestrict - Do we break ranges at chapter/book boundries
VerseRangepublic int countVerses()
Passage
countVerses in interface PassagecountVerses in class BitwisePassageVersepublic Iterator iterator()
iterator in interface Iterableiterator in class BitwisePassagepublic Iterator rangeIterator(RestrictionType restrict)
Passage
rangeIterator in interface PassagerangeIterator in class AbstractPassagerestrict - Do we break ranges over chapters
public boolean isEmpty()
Key
isEmpty in interface KeyisEmpty in class BitwisePassage
public Verse getVerseAt(int offset)
throws ArrayIndexOutOfBoundsException
Passage
getVerseAt in interface PassagegetVerseAt in class AbstractPassageoffset - The verse offset (legal values are 0 to countVerses()-1)
ArrayIndexOutOfBoundsException - If the offset is out of range
public VerseRange getRangeAt(int offset,
RestrictionType restrict)
throws ArrayIndexOutOfBoundsException
Passage
getRangeAt in interface PassagegetRangeAt in class AbstractPassageoffset - 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 PassagebooksInPassage in class AbstractPassage
public int chaptersInPassage(int book)
throws NoSuchVerseException
Passage
chaptersInPassage in interface PassagechaptersInPassage in class AbstractPassagebook - The book to check (0 for distinct chapters in all books)
NoSuchVerseException - if the book is invalid
public int versesInPassage(int book,
int chapter)
throws NoSuchVerseException
PassageversesInPassage(ref, 0, 0) == ref.countVerses()
versesInPassage in interface PassageversesInPassage in class AbstractPassagebook - 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 PassagecontainsAll in class AbstractPassagethat - Passage to be checked for containment in this collection.
private void readObject(ObjectInputStream is)
throws IOException,
ClassNotFoundException
is - The stream to read our state from
IOException - if the read fails
ClassNotFoundException - If the read data is incorrect
|
Copyright ยจ 2003-2007 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||