public interface Indexable
Dictionary
subclasses. IndexBuilder
and Index
classes use the methods
provided by this interface to compare index entries, which are usually strings of characters
encoded in an implementation-dependent format.Index
,
IndexBuilder
Modifier and Type | Interface and Description |
---|---|
static class |
Indexable.CharData
Stores a single character and the position of the character following it.
|
Modifier and Type | Method and Description |
---|---|
int |
compare(ByteBuffer data,
int position)
Compare the data in a buffer to an index entry.
|
int |
compare(int pos1,
int pos2)
Compares two index entries.
|
Indexable.CharData |
getChar(int position,
Indexable.CharData outResult)
Decode the character at a given position in the indexable data.
|
EncodedCharacterHandler |
getEncodedCharacterHandler() |
int compare(int pos1, int pos2) throws IndexException
Indexable
object. Since the index entries are usually
strings of text, it is expected that it is a lexicographical ordering, although there
is no guarantee that the compare
method will impose the same ordering
as String.compareTo
.pos1
- Position of the first index entry.pos2
- Position of the second index entry.<0
if the entry at pos1 is smaller than the entry at pos2;
>0
if it is greater and 0
if the entries at both
positions is equal.IndexException
int compare(ByteBuffer data, int position) throws IndexException
Indexable
class as EUC-JP encoded
text, the buffer must also contain EUC-JP encoded text. The ordering by this
compare
method must be consistent with compare(int,int)
.
The only allowed difference is that comparisons may be truncated to the length of the buffer;
i. e., a comparison may return equality even if the index entry is longer than the data
in the buffer (the buffer data is a prefix of the index entry). This is allowed to make
substring searches possible.<0
if the data in the buffer is smaller than the index entry;
>0
if it is greater and 0
buffer data and the entry
are identical.IndexException
Indexable.CharData getChar(int position, Indexable.CharData outResult) throws IndexException
outResult
- The result of the method invocation will be stored in the object.
This prevents the need to create an object every time the method is invoked.
If null
is passed, a new instance will be created.IndexException
EncodedCharacterHandler getEncodedCharacterHandler()
Copyright © 2001-2013 the JGloss developers. All Rights Reserved.