[jsword-devel] Iterating over "Pericopes"
Douglas Campos
qmx at qmx.me
Tue Jan 21 11:41:21 MST 2014
On Sat, Jan 18, 2014 at 09:47:09PM -0500, DM Smith wrote:
>
> On Jan 18, 2014, at 8:26 PM, Douglas Campos <qmx at qmx.me> wrote:
>
> > Is there an easy way to do this which I'm missing?
>
> I'm not sure I understand your question. A pericope is a contiguous
> collection of one or more verses. In JSword, this is a Verse or a
> VerseRange.
Lemme explain what I'm trying to do:
I want to create a reading plan builder: you input the time (one year,
two years, etc) and it slices the text, but respecting the Pericopes or
Passages (so you don't get a hard break in the middle of a passage).
hope this clarifies things!
>
> In JSword, we also have a Passage, not a very good name, which is a collection of one or more verses that may or may not be a contiguous collection. That is it is a collection of non-overlapping Verses and VerseRanges.
>
> All are derived from Key. Key defines iterator() which will return atomic parts. For a dictionary, it might be over terms.
>
> In the case of a Passage, VerseRange or Verse, it will return each Verse contained in canonical order.
>
> Passage defines rangeIterator. While passage is was developed for Verses, it also makes sense for any work. A range starts with an indexed entry and continues for a while. We just haven't abstracted that yet.
>
> The rangeIterator can be influenced by a RestrictionType, which defines boundaries beyond which a range cannot extend. At one time we had 3, but now we have two types. NONE and BOOK. So given the entire Bible, NONE will return a single VerseRange key, but Book will return one for each book.
>
> So iteration is simply a loop over Verses or VerseRanges.
>
> E.g. Verses
> Passage p = ....; // Could also be a VerseRange.
> for (Key key : p) {
> Verse verse = (Verse) key;
> ...
> }
>
> The complexity I described in an earlier post was how the internal data structures of a RangedPassage is maintained with each call to p.add(Key).
>
> In Him,
> DM
> _______________________________________________
> jsword-devel mailing list
> jsword-devel at crosswire.org
> http://www.crosswire.org/mailman/listinfo/jsword-devel
--
qmx
More information about the jsword-devel
mailing list