Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.crosswire.jsword.passage
Class DistinctPassage

    java.lang.Object
      org.crosswire.jsword.passage.AbstractPassage
          org.crosswire.jsword.passage.DistinctPassage

All Implemented Interfaces:
  Serializable, Cloneable, Comparable<Key>, Iterable<Key>, Key, Passage, VerseKey<Passage>

    public class DistinctPassage

extends AbstractPassage

A Passage that is implemented using a TreeSet of Verses. The attributes of the style are:

- Fairly fast manipulation
- Slow getName()
- Bloated for storing large numbers of Verses

Author:
  Joe Walker
See Also:
  `The GNU Lesser General Public License for details.`, Serialized Form

Nested Class Summary

Nested classes/interfaces inherited from class org.crosswire.jsword.passage.AbstractPassage
`AbstractPassage.VerseRangeIterator`

Field Summary
`private static long` | `serialVersionUID` To make serialization work across new versions
`private SortedSet<Key>` | `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
`` | `DistinctPassage(Versification v11n)` Create an empty DistinctPassage.
`protected` | `DistinctPassage(Versification v11n, String refs)`
`protected` | `DistinctPassage(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).
`DistinctPassage` | `clone()` Get a copy of ourselves.
`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
`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, 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, removeAll, removePassageListener, retainAll, reversify, setParent, toString, toVerseRange, trimRanges, trimVerses, writeDescription, writeObjectSupport`

Methods inherited from class java.lang.Object
`finalize, getClass, notify, notifyAll, wait, wait, wait`

Field Detail

### serialVersionUID

    private static final long serialVersionUID

  To make serialization work across new versions

  See Also:
    Constant Field Values

### store

    private transient SortedSet<Key> store

  The place the real data is stored

Constructor Detail

### DistinctPassage

    public DistinctPassage(Versification v11n)

  Create an empty DistinctPassage. There are no ctors from either Verse or VerseRange so you need to do new `DistinctPassage().add(...);`

  Parameters:
    `v11n` - The Versification to which this Passage belongs.

### DistinctPassage

    protected DistinctPassage(Versification v11n,
                              String refs,
                              Key basis)
                       throws NoSuchVerseException

  Create a Verse from a human readable string. The opposite of toString(), Given any DistinctPassage v1, and the following `DistinctPassage v2 = new DistinctPassage(v1.toString());` Then `v1.equals(v2);` Theoretically, since there are many ways of representing a DistinctPassage 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.

  Parameters:
    `v11n` - The Versification to which this Passage belongs.
    `refs` - A String containing the text of the DistinctPassage
    `basis` - The basis by which to interpret refs
  Throws:
    `NoSuchVerseException` - If the string is not valid

### DistinctPassage

    protected DistinctPassage(Versification v11n,
                              String refs)
                       throws NoSuchVerseException

Throws:
  `NoSuchVerseException`

Method Detail

### clone

    public DistinctPassage clone()

  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:
    `clone` in interface `Key`
  Overrides:
    `clone` in class `AbstractPassage`
  Returns:
    A complete copy of ourselves

### iterator

    public Iterator<Key> iterator()

### isEmpty

    public boolean isEmpty()

  Description copied from interface: `Key`
  Does this Key have 0 members

  Specified by:
    `isEmpty` in interface `Key`
  Overrides:
    `isEmpty` in class `AbstractPassage`
  Returns:
    `true` if this set contains no elements.

### countVerses

    public int countVerses()

  Description copied from interface: `Passage`
  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:
    `countVerses` in interface `Passage`
  Overrides:
    `countVerses` in class `AbstractPassage`
  Returns:
    the number of Verses in this collection
  See Also:
    `Verse`

### contains

    public boolean contains(Key obj)

  Description copied from interface: `Passage`
  Returns true if this collection contains all the specified Verse

  Specified by:
    `contains` in interface `Key`
  Specified by:
    `contains` in interface `Passage`
  Overrides:
    `contains` in class `AbstractPassage`
  Parameters:
    `obj` - Verse or VerseRange that may exist in this Passage
  Returns:
    true if this collection contains that

### add

    public void add(Key obj)

  Description copied from interface: `Passage`
  Add this Verse/VerseRange to this Passage

  Parameters:
    `obj` - The Verses to be added from this Passage

### remove

    public void remove(Key obj)

  Description copied from interface: `Passage`
  Remove this Verse/VerseRange from this Passage

  Parameters:
    `obj` - The Verses to be removed from this Passage

### clear

    public void clear()

  Description copied from interface: `Key`
  Removes all of the elements from this set (optional operation). This set will be empty after this call returns (unless it throws an exception).

  Specified by:
    `clear` in interface `Key`
  Overrides:
    `clear` in class `AbstractPassage`

### writeObject

    private void writeObject(ObjectOutputStream out)
                      throws IOException

  Call the support mechanism in AbstractPassage

  Parameters:
    `out` - The stream to write our state to
  Throws:
    `IOException` - if the read fails
  See Also:
    `AbstractPassage.writeObjectSupport(ObjectOutputStream)`

### readObject

    private void readObject(ObjectInputStream in)
                     throws IOException,
                            ClassNotFoundException

  Call the support mechanism in AbstractPassage

  Parameters:
    `in` - The stream to read our state from
  Throws:
    `IOException` - if the read fails
    `ClassNotFoundException` - If the read data is incorrect
  See Also:
    `AbstractPassage.readObjectSupport(ObjectInputStream)`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Copyright ¨ 2003-2015
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD