public Versification getOriginalVersification() { return originalVerseRange.getVersification(); } }
@Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; ConvertibleVerseRange that = (ConvertibleVerseRange) o; return originalVerseRange.equals(that.getVerseRange(originalVerseRange.getVersification())); }
/** * Ctor */ protected VerseIterator(VerseRange range) { v11n = range.getVersification(); nextVerse = range.getStart(); total = range.getCardinality(); count = 0; }
public VerseRange next() { if (next == null) { next = real.next(); } if (next == null) { throw new NoSuchElementException(); } // So we know what is broadly next, however the range might need // splitting according to restrict if (restrict.isSameScope(next.getVersification(), next.getStart(), next.getEnd())) { return replyNext(); } return splitNext(); }
/** * Start chain of actions to switch to MyNote view * @param verseRange */ public void showMyNote(VerseRange verseRange) { // if existing MyNote exists with same start verse then adjust range to match the note that will be edited final MyNoteDto existingMyNoteWithSameStartVerse = myNoteDAO.getMyNoteByStartVerse(verseRange); if (existingMyNoteWithSameStartVerse!=null) { verseRange = existingMyNoteWithSameStartVerse.getVerseRange(verseRange.getVersification()); } getCurrentPageManager().showMyNote(verseRange); }
public BookmarkDto insertOrUpdateBookmark(BookmarkDto bookmark) { // Create a new row of values to insert. ContentValues newValues = new ContentValues(); VerseRange key = bookmark.getVerseRange(); // must save a Key's versification along with the key! String v11nName = key.getVersification().getName(); // Gets the current system time in milliseconds Long now = System.currentTimeMillis(); newValues.put(BookmarkColumn.KEY, key.getOsisRef()); newValues.put(BookmarkColumn.VERSIFICATION, v11nName); newValues.put(BookmarkColumn.CREATED_ON, now); PlaybackSettings playbackSettings = bookmark.getPlaybackSettings(); if(playbackSettings!= null) { newValues.put(BookmarkColumn.PLAYBACK_SETTINGS, playbackSettings.toJson()); } else { newValues.putNull(BookmarkColumn.PLAYBACK_SETTINGS); } if(bookmark.getId() != null) { db.update(Table.BOOKMARK, newValues, BookmarkColumn._ID + "=" + bookmark.getId(), null); return bookmark; } else { long newId = db.insert(Table.BOOKMARK, null, newValues); return getBookmarkDto(newId); } }
/** * Create a VerseRange that is the stuff in VerseRange a that is also * in VerseRange b. * * @param a * The verses that you might want * @param b * The verses that you definitely don't * @return A list of the Verses outstanding */ public static VerseRange intersection(VerseRange a, VerseRange b) { Versification v11n = a.getVersification(); Verse newStart = v11n.max(a.getStart(), b.getStart()); Verse newEnd = v11n.min(a.getEnd(), b.getEnd()); if (v11n.distance(newStart, newEnd) >= 0) { return new VerseRange(a.getVersification(), newStart, newEnd); } return null; }
public VerseRange getNextVerseRange(AbstractPassageBook document, VerseRange verseRange, boolean continueToNextChapter) { Versification v11n = verseRange.getVersification(); int verseCount = verseRange.getCardinality(); // shuffle forward Verse start = verseRange.getStart(); Verse end = verseRange.getEnd(); int i=0; while (i++<verseCount && (continueToNextChapter || !v11n.isEndOfChapter(end))) { start = getNextVerse(document, start); end = getNextVerse(document, end); } return new VerseRange(v11n, start, end); }
public VerseRange getPreviousVerseRange(AbstractPassageBook document, VerseRange verseRange, boolean continueToPreviousChapter) { Versification v11n = verseRange.getVersification(); int verseCount = verseRange.getCardinality(); // shuffle backward Verse start = verseRange.getStart(); Verse end = verseRange.getEnd(); int i=0; while (i++<verseCount && (continueToPreviousChapter || !v11n.isStartOfChapter(start))) { start = getPrevVerse(document, start); end = getPrevVerse(document, end); } return new VerseRange(v11n, start, end); }
VerseRange rend = null; Versification v11n = a.getVersification();