@Test public void testReduceKeySize() throws NoSuchKeyException { final Versification v = Versifications.instance().getVersification("KJV"); final Book b = Books.installed().getBook("ESV_th"); assertEquals("Gen.2", reduceKeySize(v, b, "Gen.2-Rev.1").getOsisRef()); assertEquals("Gen.2", reduceKeySize(v, b, "Gen.2").getOsisRef()); assertEquals("Gen.0", reduceKeySize(v, b, "Gen.0").getOsisRef()); assertEquals("Gen.0", reduceKeySize(v, b, "Gen.0").getOsisRef()); assertEquals("Gen.1.1", reduceKeySize(v, b, "Gen.1.1").getOsisRef()); assertEquals("Judg.1", reduceKeySize(v, b, "Judg").getOsisRef()); assertEquals("Jude", reduceKeySize(v, b, "Jude").getOsisRef()); assertEquals("Ruth.1", reduceKeySize(v, b, "Rut").getOsisRef()); }
Key reduceKeySize(final Key inputKey, final Versification v11n) throws NoSuchKeyException { Key key = inputKey; final int cardinality = key.getCardinality(); final Passage requestedPassage = KeyUtil.getPassage(key); if (cardinality > MAX_VERSES_RETRIEVED) { VerseRange firstChapter = requestedPassage.getRangeAt(0, RestrictionType.CHAPTER); if (firstChapter.getStart().getChapter() == 0) { key = requestedPassage.getRangeAt(1, RestrictionType.CHAPTER); } else { key = firstChapter; } } else if (isWholeBook(requestedPassage) && !requestedPassage.getRangeAt(0, RestrictionType.CHAPTER).getStart().getBook().isShortBook()) { key = requestedPassage.getRangeAt(1, RestrictionType.CHAPTER); } return key; }
JSwordPassageServiceImpl implements JSwordPassageService { Key reduceKeySize(final Key inputKey, final Versification v11n) throws NoSuchKeyException { Key key = inputKey; final int cardinality = key.getCardinality(); final Passage requestedPassage = KeyUtil.getPassage(key); if (cardinality > MAX_VERSES_RETRIEVED) { VerseRange firstChapter = requestedPassage.getRangeAt(0, RestrictionType.CHAPTER); if (firstChapter.getStart().getChapter() == 0) { key = requestedPassage.getRangeAt(1, RestrictionType.CHAPTER); } else { key = firstChapter; } } else if (isWholeBook(requestedPassage) && !requestedPassage.getRangeAt(0, RestrictionType.CHAPTER).getStart().getBook().isShortBook()) { key = requestedPassage.getRangeAt(1, RestrictionType.CHAPTER); } return key; } }
JSwordPassageServiceImpl implements JSwordPassageService { Key reduceKeySize(final Key inputKey, final Versification v11n) throws NoSuchKeyException { Key key = inputKey; final int cardinality = key.getCardinality(); final Passage requestedPassage = KeyUtil.getPassage(key); if (cardinality > MAX_VERSES_RETRIEVED) { VerseRange firstChapter = requestedPassage.getRangeAt(0, RestrictionType.CHAPTER); if (firstChapter.getStart().getChapter() == 0) { key = requestedPassage.getRangeAt(1, RestrictionType.CHAPTER); } else { key = firstChapter; } } else if (isWholeBook(requestedPassage) && !requestedPassage.getRangeAt(0, RestrictionType.CHAPTER).getStart().getBook().isShortBook()) { key = requestedPassage.getRangeAt(1, RestrictionType.CHAPTER); } return key; } @Inject  JSwordPassageServiceImpl(final JSwordVersificationService versificationService,
                                    final MorphologyServiceImpl morphologyProvider, final VocabularyService vocabProvider,
                                    final ColorCoderProviderImpl colorCoder, final VersionResolver resolver,
                                    final PassageOptionsValidationService optionsValidationService); }
JSwordPassageServiceImpl implements JSwordPassageService { Key reduceKeySize(final Key inputKey, final Versification v11n) throws NoSuchKeyException { Key key = inputKey; final int cardinality = key.getCardinality(); final Passage requestedPassage = KeyUtil.getPassage(key); if (cardinality > MAX_VERSES_RETRIEVED) { VerseRange firstChapter = requestedPassage.getRangeAt(0, RestrictionType.CHAPTER); if (firstChapter.getStart().getChapter() == 0) { key = requestedPassage.getRangeAt(1, RestrictionType.CHAPTER); } else { key = firstChapter; } } else if (isWholeBook(requestedPassage) && !requestedPassage.getRangeAt(0, RestrictionType.CHAPTER).getStart().getBook().isShortBook()) { key = requestedPassage.getRangeAt(1, RestrictionType.CHAPTER); } return key; } @Inject  JSwordPassageServiceImpl(final JSwordVersificationService versificationService,
                                    final MorphologyServiceImpl morphologyProvider, final VocabularyService vocabProvider,
                                    final ColorCoderProviderImpl colorCoder, final VersionResolver resolver,
                                    final PassageOptionsValidationService optionsValidationService); @Override KeyWrapper getSiblingChapter(final String reference, final String version,
                                        final boolean previousChapter); @Override KeyWrapper getKeyInfo(final String reference, final String sourceVersion, String version); @Override KeyWrapper expandToChapter(final String version, final String reference); @Override String getPlainText(final String version, final String reference, final boolean firstVerse); @Override Key getFirstVerseExcludingZero(final Key key, final Book b); @Override Key getFirstVersesFromRange(final Key range, final int context); @Override OsisWrapper peakOsisText(final Book bible, final Key key, final List<LookupOption> options); @Override OsisWrapper peakOsisText(String[] versions, Key lookupKey, List<LookupOption> options, String interlinearMode); OsisWrapper getPassageByDisplayMode(List<String> versionsInput, Key reference, List<LookupOption> options, final String interlinearMode); @Override OsisWrapper getOsisText(final String version, final String reference); @Override OsisWrapper getOsisTextByVerseNumbers(final String version, final String numberedVersion,
                                                 final int startVerseId, final int endVerseId, final List<LookupOption> lookupOptions,
                                                 final String interlinearVersion, final Boolean roundReference, final boolean ignoreVerse0); @Override OsisWrapper getOsisText(final String version, final String reference,
                                   final List<LookupOption> options, final String interlinearVersion,
                                   final InterlinearMode displayMode); @Override OsisWrapper getInterleavedVersions(final String[] versions, final String reference,
                                              final List<LookupOption> options, final InterlinearMode displayMode); @Override String getAllReferences(final String references, final String version); @Override StringAndCount getAllReferencesAndCounts(final String references, final String version); }
JSwordPassageServiceImpl implements JSwordPassageService { Key reduceKeySize(final Key inputKey, final Versification v11n) throws NoSuchKeyException { Key key = inputKey; final int cardinality = key.getCardinality(); final Passage requestedPassage = KeyUtil.getPassage(key); if (cardinality > MAX_VERSES_RETRIEVED) { VerseRange firstChapter = requestedPassage.getRangeAt(0, RestrictionType.CHAPTER); if (firstChapter.getStart().getChapter() == 0) { key = requestedPassage.getRangeAt(1, RestrictionType.CHAPTER); } else { key = firstChapter; } } else if (isWholeBook(requestedPassage) && !requestedPassage.getRangeAt(0, RestrictionType.CHAPTER).getStart().getBook().isShortBook()) { key = requestedPassage.getRangeAt(1, RestrictionType.CHAPTER); } return key; } @Inject  JSwordPassageServiceImpl(final JSwordVersificationService versificationService,
                                    final MorphologyServiceImpl morphologyProvider, final VocabularyService vocabProvider,
                                    final ColorCoderProviderImpl colorCoder, final VersionResolver resolver,
                                    final PassageOptionsValidationService optionsValidationService); @Override KeyWrapper getSiblingChapter(final String reference, final String version,
                                        final boolean previousChapter); @Override KeyWrapper getKeyInfo(final String reference, final String sourceVersion, String version); @Override KeyWrapper expandToChapter(final String version, final String reference); @Override String getPlainText(final String version, final String reference, final boolean firstVerse); @Override Key getFirstVerseExcludingZero(final Key key, final Book b); @Override Key getFirstVersesFromRange(final Key range, final int context); @Override OsisWrapper peakOsisText(final Book bible, final Key key, final List<LookupOption> options); @Override OsisWrapper peakOsisText(String[] versions, Key lookupKey, List<LookupOption> options, String interlinearMode); OsisWrapper getPassageByDisplayMode(List<String> versionsInput, Key reference, List<LookupOption> options, final String interlinearMode); @Override OsisWrapper getOsisText(final String version, final String reference); @Override OsisWrapper getOsisTextByVerseNumbers(final String version, final String numberedVersion,
                                                 final int startVerseId, final int endVerseId, final List<LookupOption> lookupOptions,
                                                 final String interlinearVersion, final Boolean roundReference, final boolean ignoreVerse0); @Override OsisWrapper getOsisText(final String version, final String reference,
                                   final List<LookupOption> options, final String interlinearVersion,
                                   final InterlinearMode displayMode); @Override OsisWrapper getInterleavedVersions(final String[] versions, final String reference,
                                              final List<LookupOption> options, final InterlinearMode displayMode); @Override String getAllReferences(final String references, final String version); @Override StringAndCount getAllReferencesAndCounts(final String references, final String version);  }