public final class VersificationsMapper extends Object
Practically speaking, a Verse in one v11n may map:
The internal details of the mapping can be found in VersificationToKJVMapper.
This transitive relationship is not perfect. It assumes that verses outside of the KJV versification map 1:1 between the source and target Versifications. That it uses the KJV as an intermediary is an implementation detail that may change. Do not rely on it.
The GNU Lesser General Public License for details.
Modifier and Type | Field and Description |
---|---|
private static VersificationsMapper |
instance |
private static Versification |
KJV |
private static org.slf4j.Logger |
LOGGER |
private static Map<Versification,VersificationToKJVMapper> |
MAPPERS |
Modifier | Constructor and Description |
---|---|
private |
VersificationsMapper()
Prevent instantiation
|
Modifier and Type | Method and Description |
---|---|
private void |
ensure(Versification versification)
Reads the mapping from file if it does not exist
|
void |
ensureMappingDataLoaded(Versification versification)
Call this to ensure mapping data is loaded (maybe for newly installed books).
|
private VerseKey |
getKeyFromQualifiedKeys(Versification versification,
List<QualifiedKey> kjvVerses) |
private VerseKey |
guessKeyFromKjvVerses(Versification targetVersification,
List<QualifiedKey> kjvVerses)
This is a last attempt at trying to get something, on the basis that
something is better than nothing.
|
static VersificationsMapper |
instance() |
Passage |
map(Passage key,
Versification target)
Maps a whole passage, and does so verse by verse.
|
VerseKey |
mapVerse(Verse v,
Versification targetVersification) |
private static volatile VersificationsMapper instance
private static final Versification KJV
private static final Map<Versification,VersificationToKJVMapper> MAPPERS
private static final org.slf4j.Logger LOGGER
public static VersificationsMapper instance()
public Passage map(Passage key, Versification target)
key
- the key if the source versificationtarget
- the target versificationpublic VerseKey mapVerse(Verse v, Versification targetVersification)
v
- the versetargetVersification
- the final versification that we wantprivate VerseKey guessKeyFromKjvVerses(Versification targetVersification, List<QualifiedKey> kjvVerses)
targetVersification
- the target versificationkjvVerses
- the verses in the KJV versification.private VerseKey getKeyFromQualifiedKeys(Versification versification, List<QualifiedKey> kjvVerses)
kjvVerses
- the list of keyspublic void ensureMappingDataLoaded(Versification versification)
versification
- the versification we want to load mapping data forprivate void ensure(Versification versification)
versification
- the versification we want to load