|
|||||||||
| Home >> All >> com >> eireneh >> bible >> [ passage overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
com.eireneh.bible.passage
Class RangedPassage

java.lang.Objectcom.eireneh.bible.passage.AbstractPassage
com.eireneh.bible.passage.RangedPassage
- All Implemented Interfaces:
- java.lang.Cloneable, Passage, PassageConstants, java.io.Serializable
- public class RangedPassage
- extends AbstractPassage
A Passage that is implemented using a TreeSet of VerseRanges. The attributes of the style are:
- Compact storage of large amounts of data
- Fast getName()
- Slow manipulation
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:
- Before every read
- Before reads with a background thread
- After every change
- After every change with a cacheing scheme
|
Distribution Licence: Project B 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, by writing to Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA, Or locally at the Licence link below. The copyright to this program is held by it's authors. |
- Version:
- $Id:$
| Nested Class Summary | |
private class |
RangedPassage.VerseEnumeration
This class is here to prevent users of RangedPassage.iterator() from altering the underlying store and getting us out of sync. |
| Nested classes inherited from class com.eireneh.bible.passage.AbstractPassage |
AbstractPassage.VerseRangeEnumeration |
| Field Summary | |
(package private) static long |
serialVersionUID
To make serialization work across new versions |
private java.util.SortedSet |
store
The place the real data is stored |
| Fields inherited from class com.eireneh.bible.passage.AbstractPassage |
BITWISE, DISTINCT, listeners, log, METHOD_COUNT, original_name, RANGED, skip_normalization, suppress_events |
| Fields inherited from interface com.eireneh.bible.passage.PassageConstants |
ACCURACY_BOOK_CHAPTER, ACCURACY_BOOK_ONLY, ACCURACY_BOOK_VERSE, ACCURACY_CHAPTER_VERSE, ACCURACY_NONE, ACCURACY_VERSE_ONLY, CASE_LOWER, CASE_MIXED, CASE_SENTANCE, CASE_UPPER, CASES, RANGE_ALLOWED_DELIMS, RANGE_PREF_DELIM, REF_ALLOWED_DELIMS, REF_PREF_DELIM, RESTRICT_BOOK, RESTRICT_CHAPTER, RESTRICT_NONE, RESTRICTIONS, VERSE_ALLOWED_DELIMS, VERSE_END_MARK1, VERSE_END_MARK2, VERSE_NUMERIC_BOOK, VERSE_PREF_DELIM1, VERSE_PREF_DELIM2 |
| Constructor Summary | |
protected |
RangedPassage()
Create an empty RangedPassage. |
protected |
RangedPassage(java.lang.String refs)
Create a Verse from a human readable string. |
| Method Summary | |
void |
add(VerseBase obj)
Ensures that this Passage contains the specified Verse |
void |
clear()
Removes all of the Verses from this Passage. |
java.lang.Object |
clone()
Get a copy of ourselves. |
boolean |
contains(VerseBase obj)
Returns true if this Passage contains the specified Verse. |
int |
countRanges()
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 |
protected void |
normalize()
We sometimes need to sort ourselves out ... |
java.util.Enumeration |
rangeElements()
Iterate over the VerseRanges |
private void |
readObject(java.io.ObjectInputStream in)
Call the support mechanism in AbstractPassage |
void |
remove(VerseBase obj)
Removes a single instance of the specified Verse from this Passage |
void |
retainAll(Passage that)
Retains only the Verses in this Passage that are contained in the specified Passage |
java.util.Enumeration |
verseElements()
Iterate over the Verses |
private void |
writeObject(java.io.ObjectOutputStream out)
Call the support mechanism in AbstractPassage |
| Methods inherited from class java.lang.Object |
finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
serialVersionUID
static final long serialVersionUID
- To make serialization work across new versions
- See Also:
- Constant Field Values
store
private transient java.util.SortedSet store
- The place the real data is stored
| Constructor Detail |
RangedPassage
protected RangedPassage()
- Create an empty RangedPassage. There are no ctors from either Verse
or VerseRange so you need to do new
RangedPassage().add(...);
RangedPassage
protected RangedPassage(java.lang.String refs) throws NoSuchVerseException
- Create a Verse from a human readable string. The opposite
of getName(), Given any RangedPassage v1, and the following
RangedPassage v2 = new RangedPassage(v1.getName());Thenv1.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.
| Method Detail |
clone
public java.lang.Object clone() throws java.lang.CloneNotSupportedException
- Get a copy of ourselves. Points to note:
Call clone() not new() on member Objects, and on us.
Do not use Copy Constructors! - they do not inherit well.
Think about this needing to be synchronized
If this is not cloneable then writing cloneable children is harder
- Specified by:
clonein interfacePassage- Overrides:
clonein classAbstractPassage
countRanges
public int countRanges()
- Description copied from class:
AbstractPassage - Like countVerses() that counts VerseRanges instead of Verses
Returns the number of fragments in this collection.
This does not mean the Passage needs to use VerseRanges, just that it understands the concept.
- Specified by:
countRangesin interfacePassage- Overrides:
countRangesin classAbstractPassage
countVerses
public int countVerses()
- Description copied from class:
AbstractPassage - Returns the number of verses in this collection. Like Collection.size()
This does not mean the Passage needs to use Verses, just that it understands the concept.
- Specified by:
countVersesin interfacePassage- Overrides:
countVersesin classAbstractPassage
verseElements
public java.util.Enumeration verseElements()
- Iterate over the Verses
rangeElements
public java.util.Enumeration rangeElements()
- Iterate over the VerseRanges
- Specified by:
rangeElementsin interfacePassage- Overrides:
rangeElementsin classAbstractPassage
isEmpty
public boolean isEmpty()
- Description copied from class:
AbstractPassage - Does this Passage have 0 members
- Specified by:
isEmptyin interfacePassage- Overrides:
isEmptyin classAbstractPassage
contains
public boolean contains(VerseBase obj)
- Returns true if this Passage contains the specified Verse.
add
public void add(VerseBase obj)
- Ensures that this Passage contains the specified Verse
clear
public void clear()
- Removes all of the Verses from this Passage.
- Specified by:
clearin interfacePassage- Overrides:
clearin classAbstractPassage
remove
public void remove(VerseBase obj)
- Removes a single instance of the specified Verse from this Passage
retainAll
public void retainAll(Passage that)
- Retains only the Verses in this Passage that are contained in the
specified Passage
- Specified by:
retainAllin interfacePassage- Overrides:
retainAllin classAbstractPassage
normalize
protected void normalize()
- We sometimes need to sort ourselves out ...
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. (?)
- Overrides:
normalizein classAbstractPassage
writeObject
private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException
- Call the support mechanism in AbstractPassage
readObject
private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, java.lang.ClassNotFoundException
- Call the support mechanism in AbstractPassage
|
|||||||||
| Home >> All >> com >> eireneh >> bible >> [ passage overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC