|
||||||||||
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:
for license details.
The copyright to this program is held by it's authors.
,
Serialized FormNested 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 | |
---|---|
(package private) static long |
serialVersionUID
To make serialization work across new versions |
private SortedSet |
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 | |
---|---|
protected |
RangedPassage()
Create an empty RangedPassage. |
protected |
RangedPassage(String refs)
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). |
Object |
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 set contains the specified element. |
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 |
iterator()
|
(package private) void |
normalize()
We sometimes need to sort ourselves out ... |
Iterator |
rangeIterator(RestrictionType restrict)
Like verseElements() 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 java.lang.Object |
---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
static final long serialVersionUID
private transient SortedSet store
Constructor Detail |
---|
protected RangedPassage()
RangedPassage().add(...);
protected RangedPassage(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 Object clone()
Key
clone
in interface Key
clone
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 AbstractPassage
Verse
public Iterator iterator()
public final Iterator 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 AbstractPassage
public boolean contains(Key obj)
Key
contains
in interface Key
contains
in interface Passage
contains
in class AbstractPassage
obj
- element whose presence in this set is to be tested.
public void add(Key obj)
Passage
obj
- The Verses to be removed from this Passagepublic void clear()
Key
clear
in interface Key
clear
in class AbstractPassage
public void remove(Key obj)
Passage
obj
- The Verses to be removed from this Passagepublic void retainAll(Key key)
Key
retainAll
in interface Key
retainAll
in class AbstractPassage
key
- object to be left in this set.final void normalize()
I don't think we need to be synchronised since we are private and we could check that all public calling of normalize() are synchronised, 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-2007 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |