Package de.julielab.java.utilities.index
Class AbstractMapProvider<K,V>
- java.lang.Object
-
- de.julielab.java.utilities.index.AbstractMapProvider<K,V>
-
- Type Parameters:
K-V-
- All Implemented Interfaces:
IMapProvider<K,V>
- Direct Known Subclasses:
PersistentStringIndexMapProvider
public abstract class AbstractMapProvider<K,V> extends Object implements IMapProvider<K,V>
Base class for resources that map one term to another. Uses a HashMap.^
This class is abstract because it is generic. To work with other data types than strings, the
getKey(String)andgetValue(String)methods are overridden by subclasses to deliver the correct data types from the string input.Subclasses deal with maps where the keys and/or values are not strings but numbers. Other subclasses deal with String but use a persistent data structure to deal with very large maps.
-
-
Constructor Summary
Constructors Constructor Description AbstractMapProvider(org.slf4j.Logger log)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description Set<K>getEligibleKeys()protected abstract KgetKey(String keyString)intgetKeyIndex()Map<K,V>getMap()Returns the loaded map.protected abstract VgetValue(String valueString)intgetValueIndex()voidload(InputStream is)voidload(URI uri)protected abstract voidput(K key, V value)voidsetEligibleKeys(Set<K> eligibleKeys)voidsetKeyIndex(int keyIndex)voidsetValueIndex(int valueIndex)
-
-
-
Method Detail
-
getKeyIndex
public int getKeyIndex()
-
setKeyIndex
public void setKeyIndex(int keyIndex)
- Specified by:
setKeyIndexin interfaceIMapProvider<K,V>
-
getValueIndex
public int getValueIndex()
-
setValueIndex
public void setValueIndex(int valueIndex)
- Specified by:
setValueIndexin interfaceIMapProvider<K,V>
-
load
public void load(URI uri) throws IndexCreationException
- Specified by:
loadin interfaceIMapProvider<K,V>- Throws:
IndexCreationException
-
load
public void load(InputStream is) throws IndexCreationException
- Specified by:
loadin interfaceIMapProvider<K,V>- Throws:
IndexCreationException
-
-