public interface DictionaryImplementation<T extends Dictionary>
Dictionary
implementations.Dictionary
Modifier and Type | Field and Description |
---|---|
static float |
ZERO_CONFIDENCE
Confidence value meaning that the descriptor does not descripe a dictionary in the
format described by this implementation.
|
Modifier and Type | Method and Description |
---|---|
T |
createInstance(String descriptor)
Creates an instance of the dictionary described by this implementation.
|
Class<? extends T> |
getDictionaryClass(String descriptor)
Returns the class of the dictionary which would be created for this descriptor by
createInstance . |
float |
getMaxConfidence()
Returns the maximum confidence value used by this implementation.
|
String |
getName()
Returns the name of the dictionary format described by this implementation.
|
TestResult |
isInstance(String descriptor)
Test if the descriptor points to a dictionary in a format supported by the
Dictionary implementation. |
static final float ZERO_CONFIDENCE
TestResult isInstance(String descriptor)
Dictionary
implementation. The format of the descriptor is dependent
on the dictionary implementation. For file-based dictionaries it is usually the
path to the file.
The returned value is the confidence.
If the implementation is certain that the descriptor does not match this
implementation, it must return ZERO_CONFIDENCE
; if it is certain
that it matches it must return getMaxConfidence()
. The
DictionaryFactory
will use the dictionary with the largest
confidence to create a new instance for a descriptor.
The value of getMaxConfidence
is not limited. This can be used
for specialized dictionary formats. For example, if every file in the format
of Dictionary A is also in the format of Dictionary B, but not every file
of B is in the format of A, B can return a confidence > A.getMaxConfidence()
for files in format B to force opening them with B instead of A.
descriptor
- Descriptor of the dictionary to test.float getMaxConfidence()
String getName()
T createInstance(String descriptor) throws DictionaryInstantiationException
isInstance
for compatibility.descriptor
- Descriptor describing the instance. For file-based dictionaries
this is usually the path to the file.DictionaryInstantiationException
- if the instantiation of the dictionary failed.Class<? extends T> getDictionaryClass(String descriptor)
createInstance
.Copyright © 2001-2013 the JGloss developers. All Rights Reserved.