|
||||||||||
| 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:
|
Distribution Licence: JSword is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License, version 2 as published by the Free Software Foundation. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. The License is available on the internet here, or by writing to: Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA The copyright to this program is held by it's authors. |
Licence,
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 | |
|---|---|
(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(VerseBase 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 Passage. |
boolean |
contains(VerseBase 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 Passage have 0 members |
Iterator |
iterator()
|
protected 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(VerseBase 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, chaptersInPassage, compareTo, contains, containsAll, equals, fireContentsChanged, fireIntervalAdded, fireIntervalRemoved, get, getChildCount, getName, getOSISName, getOverview, getParent, getRangeAt, getVerseAt, hashCode, indexOf, lowerEventSuppresionAndTest, lowerNormalizeProtection, optimizeReads, optimizeWrites, raiseEventSuppresion, raiseNormalizeProtection, readDescription, readObjectSupport, removeAll, removePassageListener, setParent, toString, toVerseArray, toVerseRange, trimRanges, trimVerses, versesInPassage, writeDescription, writeObjectSupport |
| 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 invalid| Method Detail |
|---|
public Object clone()
Passage
clone in interface Passageclone 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 AbstractPassageVersepublic Iterator iterator()
iterator in interface Keyiterator in class AbstractPassagepublic 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 AbstractPassagepublic boolean contains(VerseBase obj)
Passage
obj - Verse or VerseRange that may exist in this Passage
public void add(VerseBase obj)
Passage
obj - The Verses to be removed from this Passagepublic void clear()
Key
clear in interface Keyclear in class AbstractPassagepublic void remove(VerseBase 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.protected 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-2004 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||