|
||||||||||
| 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.RangedPassage
public class RangedPassage
A Passage that is implemented using a TreeSet of VerseRanges. The attributes of the style are:
When to normalize()? This is a slow process, but one that is perhaps done bit-by-bit instead of killing everything just to do getName(). The options are:
The GNU Lesser General Public License for details.,
Serialized Form| Nested Class Summary | |
|---|---|
private static class |
RangedPassage.VerseIterator
This class is here to prevent users of RangedPassage.iterator() from altering the underlying store and getting us out of sync. |
private static class |
RangedPassage.VerseRangeIterator
Loop over the VerseRanges and check that they do not require digging into |
| Field Summary | |
|---|---|
private static long |
serialVersionUID
To make serialization work across new versions |
private Set<VerseRange> |
store
The place the real data is stored |
| 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 | |
|---|---|
|
RangedPassage(Versification refSystem)
Create an empty RangedPassage. |
protected |
RangedPassage(Versification v11n,
String refs)
|
protected |
RangedPassage(Versification v11n,
String refs,
Key basis)
Create a Verse from a human readable string. |
| Method Summary | |
|---|---|
void |
add(Key obj)
Add this Verse/VerseRange to this Passage |
void |
clear()
Removes all of the elements from this set (optional operation). |
RangedPassage |
clone()
This needs to be declared here so that it is visible as a method on a derived Key. |
boolean |
contains(Key obj)
Returns true if this collection contains all the specified Verse |
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. |
boolean |
isEmpty()
Does this Key have 0 members |
Iterator<Key> |
iterator()
|
(package private) void |
normalize()
We sometimes need to sort ourselves out ... |
Iterator<VerseRange> |
rangeIterator(RestrictionType restrict)
Like iterator() that iterates over VerseRanges instead of Verses. |
private void |
readObject(ObjectInputStream in)
Call the support mechanism in AbstractPassage |
void |
remove(Key obj)
Remove this Verse/VerseRange from this Passage |
void |
retainAll(Key key)
Removes all but the specified element from this set. |
private void |
writeObject(ObjectOutputStream out)
Call the support mechanism in AbstractPassage |
| Methods inherited from class org.crosswire.jsword.passage.AbstractPassage |
|---|
addAll, addPassageListener, addVerses, blur, booksInPassage, canHaveChildren, compareTo, containsAll, equals, fireContentsChanged, fireIntervalAdded, fireIntervalRemoved, get, getCardinality, getChildCount, getName, getName, getOsisID, getOsisRef, getOverview, getParent, getRangeAt, getRootName, getVerseAt, getVersification, getWhole, hashCode, hasRanges, indexOf, isWhole, lowerEventSuppressionAndTest, lowerNormalizeProtection, optimizeReads, optimizeWrites, raiseEventSuppresion, raiseNormalizeProtection, readDescription, readObjectSupport, removeAll, 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 static final long serialVersionUID
private transient Set<VerseRange> store
| Constructor Detail |
|---|
public RangedPassage(Versification refSystem)
RangedPassage().add(...);
refSystem - The Versification to which this Passage belongs.
protected RangedPassage(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 invalid
protected RangedPassage(Versification v11n,
String refs)
throws NoSuchVerseException
NoSuchVerseException| Method Detail |
|---|
public RangedPassage clone()
Key
clone in interface Keyclone in class AbstractPassagepublic int countRanges(RestrictionType restrict)
Passage
countRanges in interface PassagecountRanges in class AbstractPassagerestrict - Do we break ranges at chapter/book boundaries
VerseRangepublic int countVerses()
Passage
countVerses in interface PassagecountVerses in class AbstractPassageVersepublic Iterator<Key> iterator()
public final Iterator<VerseRange> 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 AbstractPassagepublic boolean contains(Key obj)
Passage
contains in interface Keycontains in interface Passagecontains in class AbstractPassageobj - Verse or VerseRange that may exist in this Passage
public void add(Key obj)
Passage
obj - The Verses to be added from this Passagepublic void clear()
Key
clear in interface Keyclear in class AbstractPassagepublic void remove(Key obj)
Passage
obj - The Verses to be removed from this Passagepublic void retainAll(Key key)
Key
retainAll in interface KeyretainAll in class AbstractPassagekey - object to be left in this set.final void normalize()
I don't think we need to be synchronized since we are private and we could check that all public calling of normalize() are synchronized, however this is safe, and I don't think there is a cost associated with a double synchronize. (?)
normalize in class AbstractPassage
private void writeObject(ObjectOutputStream out)
throws IOException
out - The stream to write our state to
IOException - if the read failsAbstractPassage.writeObjectSupport(ObjectOutputStream)
private void readObject(ObjectInputStream in)
throws IOException,
ClassNotFoundException
in - The stream to read our state from
IOException - if the read fails
ClassNotFoundException - If the read data is incorrectAbstractPassage.readObjectSupport(ObjectInputStream)
|
Copyright ยจ 2003-2015 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||