public class BitwisePassage extends AbstractPassage
The BitSet has one more bit than the number of verses in the Bible. This would waste 1 bit per BitSet but since this doesn't cause BitSet to need an extra long it doesn't, and it saves us some maths.
The GNU Lesser General Public License for details.,
Serialized Form| Modifier and Type | Class and Description |
|---|---|
private class |
BitwisePassage.VerseIterator
Iterate over the Verses
|
AbstractPassage.VerseRangeIterator| Modifier and Type | Field and Description |
|---|---|
private static long |
serialVersionUID
To make serialization work across new versions
|
protected BitSet |
store
The place the real data is stored
|
BITWISE, DISTINCT, listeners, METHOD_COUNT, originalName, RANGED, REF_ALLOWED_DELIMS, REF_OSIS_DELIM, REF_PREF_DELIM, skipNormalization, suppressEvents| Modifier | Constructor and Description |
|---|---|
|
BitwisePassage(Versification v11n)
Create an empty BitwisePassage.
|
protected |
BitwisePassage(Versification v11n,
String refs)
Create a Verse from a human readable string.
|
protected |
BitwisePassage(Versification v11n,
String refs,
Key basis)
Create a Verse from a human readable string.
|
| Modifier and Type | Method and Description |
|---|---|
void |
add(Key obj)
Add this Verse/VerseRange to this Passage
|
void |
addAll(Key key)
Adds the specified element to this set if it is not already present.
|
void |
addVersifiedOrdinal(int ordinal)
A shortcut to adding a key, by ordinal.
|
void |
blur(int verses,
RestrictionType restrict)
Widen the range of the verses/keys in this list.
|
void |
clear()
Removes all of the elements from this set (optional operation).
|
BitwisePassage |
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 |
countVerses()
Returns the number of verses in this collection.
|
boolean |
isEmpty()
Does this Key have 0 members
|
Iterator<Key> |
iterator() |
private void |
readObject(ObjectInputStream in)
Call the support mechanism in AbstractPassage
|
void |
remove(Key obj)
Remove this Verse/VerseRange from this Passage
|
void |
removeAll(Key key)
Removes the specified elements from this set if it is present.
|
void |
retainAll(Key key)
Removes all but the specified element from this set.
|
private void |
writeObject(ObjectOutputStream out)
Call the support mechanism in AbstractPassage
|
addPassageListener, addVerses, booksInPassage, canHaveChildren, compareTo, containsAll, countRanges, equals, fireContentsChanged, fireIntervalAdded, fireIntervalRemoved, get, getCardinality, getChildCount, getName, getName, getOsisID, getOsisRef, getOverview, getParent, getRangeAt, getRootName, getVerseAt, getVersification, getWhole, hashCode, hasRanges, indexOf, isWhole, lowerEventSuppressionAndTest, lowerNormalizeProtection, normalize, optimizeReads, optimizeWrites, raiseEventSuppresion, raiseNormalizeProtection, rangeIterator, readDescription, readObjectSupport, removePassageListener, reversify, setParent, toString, toVerseRange, trimRanges, trimVerses, writeDescription, writeObjectSupportprivate static final long serialVersionUID
protected transient BitSet store
public BitwisePassage(Versification v11n)
DistinctPassage().add(...);v11n - The Versification to which this Passage belongs.protected BitwisePassage(Versification v11n, String refs, Key basis) throws NoSuchVerseException
DistinctPassage v2 = new BitwisePassage(v1.toString()); Then
v1.equals(v2); Theoretically, since there are many ways of
representing a BitwisePassage as text string comparison along the lines
of: v1.toString().equals(v2.toString()) could be false.
Practically since toString() is standardized this will be true however.
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 BitwisePassagebasis - The basis by which to interpret refsNoSuchVerseException - If the string is not parsableprotected BitwisePassage(Versification v11n, String refs) throws NoSuchVerseException
DistinctPassage v2 = new BitwisePassage(v1.toString()); Then
v1.equals(v2); Theoretically, since there are many ways of
representing a BitwisePassage as text string comparison along the lines
of: v1.toString().equals(v2.toString()) could be false.
Practically since toString() is standardized this will be true however.
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 BitwisePassageNoSuchVerseException - If the string is not parsablepublic BitwisePassage clone()
Keyclone in interface Keyclone in class AbstractPassagepublic int countVerses()
PassagecountVerses in interface PassagecountVerses in class AbstractPassageVersepublic boolean isEmpty()
KeyisEmpty in interface KeyisEmpty in class AbstractPassagepublic boolean contains(Key obj)
Passagepublic void add(Key obj)
Passageobj - The Verses to be added from this Passagepublic void addVersifiedOrdinal(int ordinal)
ordinal - the ordinalpublic void remove(Key obj)
Passageobj - The Verses to be removed from this Passagepublic void addAll(Key key)
KeyaddAll in interface KeyaddAll in class AbstractPassagekey - element to be added to this set.public void removeAll(Key key)
KeyremoveAll in interface KeyremoveAll in class AbstractPassagekey - object to be removed from this set, if present.public void retainAll(Key key)
KeyretainAll in interface KeyretainAll in class AbstractPassagekey - object to be left in this set.public void clear()
Keyclear in interface Keyclear in class AbstractPassagepublic void blur(int verses,
RestrictionType restrict)
Keyblur in interface Keyblur in class AbstractPassageverses - The number of verses/keys to widen byrestrict - How should we restrict the blurring?Passageprivate void writeObject(ObjectOutputStream out) throws IOException
out - The stream to write our state toIOException - if the read failsAbstractPassage.writeObjectSupport(ObjectOutputStream)private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException
in - The stream to read our state fromIOException - if the read failsClassNotFoundException - If the read data is incorrectAbstractPassage.readObjectSupport(ObjectInputStream)