/** * Check to see that everything is ok with the Data */ private void verifyData() { assert verseCount == calcVerseCount() : "start=" + start + ", end=" + end + ", verseCount=" + verseCount; }
public VerseRange(Versification v11n, Verse start, Verse end) { assert v11n != null; assert start != null; assert end != null; this.v11n = v11n; shaper = new NumberShaper(); int distance = v11n.distance(start, end); if (distance < 0) { this.start = end; this.end = start; this.verseCount = calcVerseCount(); } else if (distance == 0) { this.start = start; this.end = start; this.verseCount = 1; } else { this.start = start; this.end = end; this.verseCount = calcVerseCount(); } }
/** * Merge 2 VerseRanges together. The resulting range will encompass * Everything in-between the extremities of the 2 ranges. * * @param a * The first verse range to be merged * @param b * The second verse range to be merged */ public VerseRange(VerseRange a, VerseRange b) { v11n = a.v11n; shaper = new NumberShaper(); start = v11n.min(a.getStart(), b.getStart()); end = v11n.max(a.getEnd(), b.getEnd()); verseCount = calcVerseCount(); }