public class DictionaryEngine
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
private java.util.Map<java.lang.String,java.lang.Boolean> |
_binaryLookupCacheMap |
private java.util.List<CollectionFilter> |
_collectionFilterList |
private Dictionary |
_dictionary |
private boolean |
_keepCase |
private java.util.Map<java.lang.String,java.util.Collection<MetaDataHit>> |
_metaLookupCacheMap |
private java.util.List<PostLookupFilter> |
_postLookupFilterList |
private java.util.List<PreLookupFilter> |
_preLookupFilterList |
Constructor and Description |
---|
DictionaryEngine(Dictionary dictionary,
boolean keepCase) |
Modifier and Type | Method and Description |
---|---|
void |
addCacheEntry(java.lang.String text)
Adds an entry to the dictionary lookup cache.
|
void |
addCollectionFilter(CollectionFilter collectionFilter)
Adds a Collection filter to the engine.
|
void |
addPostLookupFilter(PostLookupFilter postLookupFilter)
Adds a Post-lookup filter to the engine.
|
void |
addPreLookupFilter(PreLookupFilter preLookupFilter)
Adds a Pre-lookup filter to the engine.
|
boolean |
binaryLookup(java.lang.String text)
Determines whether the input text is contained by the Dictionary.
|
private boolean |
isFilteredByPreLookup(java.lang.String text)
Helper method that applies Pre-lookup filtering to the input text.
|
java.util.Collection<MetaDataHit> |
metaLookup(java.lang.String text)
Gets a collection of MetaDataHits from the Dictionary based on the input
text.
|
private final Dictionary _dictionary
private final boolean _keepCase
private java.util.List<PreLookupFilter> _preLookupFilterList
private java.util.List<PostLookupFilter> _postLookupFilterList
private java.util.List<CollectionFilter> _collectionFilterList
private java.util.Map<java.lang.String,java.lang.Boolean> _binaryLookupCacheMap
private java.util.Map<java.lang.String,java.util.Collection<MetaDataHit>> _metaLookupCacheMap
public DictionaryEngine(Dictionary dictionary, boolean keepCase)
dictionary
- Dictionary to use for lookup operations.keepCase
- Determines whether to keep character Upper or Lower casing.
False indicates that casing will be ignored by lower casing
all lookups.public void addPreLookupFilter(PreLookupFilter preLookupFilter)
preLookupFilter
- PreLookupFilter to add.public void addPostLookupFilter(PostLookupFilter postLookupFilter)
postLookupFilter
- PostLookupFilter to add.public void addCollectionFilter(CollectionFilter collectionFilter)
collectionFilter
- CollectionFilter to add.public void addCacheEntry(java.lang.String text) throws DictionaryException, FilterException
text
- to add to the caches as a hit or missDictionaryException
FilterException
public java.util.Collection<MetaDataHit> metaLookup(java.lang.String text) throws DictionaryException, FilterException
text
- text to check for in the filtersDictionaryException
FilterException
public boolean binaryLookup(java.lang.String text) throws DictionaryException, FilterException
text
- The input text.DictionaryException
FilterException
private boolean isFilteredByPreLookup(java.lang.String text) throws FilterException
text
- text to be filtered, possible case change must have already been accounted for by calling method.FilterException