|
||||||||||
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.
The GNU Lesser General Public License for details.
,
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(Versification v11n)
Create a new RocketPassage |
protected |
RocketPassage(Versification v11n,
String refs)
Create a Verse from a human readable string. |
protected |
RocketPassage(Versification v11n,
String refs,
Key basis)
Create a Verse from a human readable string. |
Method Summary | |
---|---|
int |
booksInPassage()
How many books are there 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<Key> |
iterator()
|
void |
optimizeReads()
For performance 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<VerseRange> |
rangeIterator(RestrictionType restrict)
Like iterator() that iterates over VerseRanges instead of Verses. |
private void |
readObject(ObjectInputStream is)
Serialization support |
Methods inherited from class org.crosswire.jsword.passage.BitwisePassage |
---|
add, addAll, addVersifiedOrdinal, 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, getVersification, getWhole, hashCode, hasRanges, indexOf, isWhole, lowerEventSuppressionAndTest, lowerNormalizeProtection, normalize, raiseEventSuppresion, raiseNormalizeProtection, readDescription, readObjectSupport, removePassageListener, reversify, 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(Versification v11n)
v11n
- The Versification to which this Passage belongs.protected RocketPassage(Versification v11n, String refs, Key basis) 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 comparison 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.
v11n
- The Versification to which this Passage belongs.refs
- A String containing the text of the RangedPassagebasis
- The basis by which to interpret refs
NoSuchVerseException
- if refs is invalidprotected RocketPassage(Versification v11n, 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 comparison 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.
v11n
- The Versification to which this Passage belongs.refs
- A String containing the text of the RangedPassage
NoSuchVerseException
- if refs is invalidMethod Detail |
---|
public void optimizeReads()
Passage
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 boundaries
VerseRange
public int countVerses()
Passage
countVerses
in interface Passage
countVerses
in class BitwisePassage
Verse
public Iterator<Key> iterator()
iterator
in interface Iterable<Key>
iterator
in class BitwisePassage
public Iterator<VerseRange> rangeIterator(RestrictionType restrict)
Passage
rangeIterator
in interface Passage
rangeIterator
in class AbstractPassage
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 boundaries
ArrayIndexOutOfBoundsException
- If the offset is out of rangepublic int booksInPassage()
Passage
booksInPassage
in interface Passage
booksInPassage
in class AbstractPassage
public boolean containsAll(Passage that)
Passage
containsAll
in interface Passage
containsAll
in class AbstractPassage
that
- 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-2015 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |