Search in sources :

Example 1 with RangedPassage

use of org.crosswire.jsword.passage.RangedPassage in project step by STEPBible.

the class SubjectEntryServiceImpl method getCombinedBookScope.

/**
 * Gets a key in the KJV versification that represents the total combined key for all search resutls.
 *
 * @param inputVersions the input version the kjv versified keys
 * @return
 */
private Passage getCombinedBookScope(String[] inputVersions) {
    final Versification bestVersification = this.versificationService.getVersificationForVersion(JSwordPassageService.BEST_VERSIFICATION);
    Passage range = new RangedPassage(bestVersification);
    for (final String v : inputVersions) {
        final Book bookFromVersion = this.versificationService.getBookFromVersion(v);
        final VerseKey scope = bookFromVersion.getBookMetaData().getScope();
        range.addAll(VersificationsMapper.instance().map(KeyUtil.getPassage(scope), bestVersification));
    }
    return range;
}
Also used : RangedPassage(org.crosswire.jsword.passage.RangedPassage) Book(org.crosswire.jsword.book.Book) Versification(org.crosswire.jsword.versification.Versification) Passage(org.crosswire.jsword.passage.Passage) RangedPassage(org.crosswire.jsword.passage.RangedPassage) VerseKey(org.crosswire.jsword.passage.VerseKey)

Example 2 with RangedPassage

use of org.crosswire.jsword.passage.RangedPassage in project step by STEPBible.

the class SubjectSearchServiceImpl method getScopeForVersions.

/**
 * Iterates through the versions, obtaining the maximum allowed scope for this query
 *
 * @param originalVersions the original versions prior to the query being run.
 * @return the scope for all versions combined
 */
private Passage getScopeForVersions(String[] originalVersions) {
    final Versification v11n = this.jSwordVersificationService.getVersificationForVersion(JSwordPassageService.BEST_VERSIFICATION);
    Passage total = new RangedPassage(v11n);
    for (String version : originalVersions) {
        Passage scope = KeyUtil.getPassage(this.jSwordVersificationService.getBookFromVersion(version).getBookMetaData().getScope());
        total.addAll(VersificationsMapper.instance().map(scope, v11n));
    }
    return total;
}
Also used : RangedPassage(org.crosswire.jsword.passage.RangedPassage) Versification(org.crosswire.jsword.versification.Versification) Passage(org.crosswire.jsword.passage.Passage) RangedPassage(org.crosswire.jsword.passage.RangedPassage)

Aggregations

Passage (org.crosswire.jsword.passage.Passage)2 RangedPassage (org.crosswire.jsword.passage.RangedPassage)2 Versification (org.crosswire.jsword.versification.Versification)2 Book (org.crosswire.jsword.book.Book)1 VerseKey (org.crosswire.jsword.passage.VerseKey)1