public class RocketPassage extends BitwisePassage
The GNU Lesser General Public License for details.
,
Serialized FormAbstractPassage.VerseRangeIterator
Modifier and Type | Field and Description |
---|---|
private DistinctPassage |
distinct
The contained DistinctPassage
|
private RangedPassage |
ranged
The contained RangedPassage
|
private static long |
serialVersionUID
Serialization ID
|
store
BITWISE, DISTINCT, listeners, METHOD_COUNT, originalName, RANGED, REF_ALLOWED_DELIMS, REF_OSIS_DELIM, REF_PREF_DELIM, skipNormalization, suppressEvents
Modifier | Constructor and Description |
---|---|
|
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.
|
Modifier and Type | Method and Description |
---|---|
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
|
add, addAll, addVersifiedOrdinal, blur, clear, clone, contains, remove, removeAll, retainAll
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
private transient DistinctPassage distinct
private transient RangedPassage ranged
private static final long serialVersionUID
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 refsNoSuchVerseException
- 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 RangedPassageNoSuchVerseException
- if refs is invalidpublic 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 boundariesVerseRange
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 chapterspublic 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 boundariesArrayIndexOutOfBoundsException
- 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 fromIOException
- if the read failsClassNotFoundException
- If the read data is incorrect