com.sun.labs.minion.indexer.dictionary
Class StringNameHandler
java.lang.Object
com.sun.labs.minion.indexer.dictionary.StringNameHandler
- All Implemented Interfaces:
- NameDecoder, NameEncoder
public class StringNameHandler
- extends java.lang.Object
- implements NameEncoder, NameDecoder
Method Summary |
java.lang.Object |
decodeName(java.lang.Object prev,
ReadableBuffer b)
Decodes the name of an entry, given a buffer of encoded names and
the name of the previous entry in the dictionary. |
void |
encodeName(java.lang.Object prev,
java.lang.Object curr,
WriteableBuffer b)
Encodes the name of an entry, given the name of the previous entry
in the dictionary. |
static int |
getShared(java.lang.String s1,
java.lang.String s2)
|
boolean |
startsWith(java.lang.Object n,
java.lang.Object m)
Determines whether one string name starts with another. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
StringNameHandler
public StringNameHandler()
encodeName
public void encodeName(java.lang.Object prev,
java.lang.Object curr,
WriteableBuffer b)
- Encodes the name of an entry, given the name of the previous entry
in the dictionary.
- Specified by:
encodeName
in interface NameEncoder
- Parameters:
prev
- The name of the previous entry in the dictionary.curr
- The name of the entry to encode.b
- The buffer onto which the name of the term should be
encoded.
decodeName
public java.lang.Object decodeName(java.lang.Object prev,
ReadableBuffer b)
- Decodes the name of an entry, given a buffer of encoded names and
the name of the previous entry in the dictionary.
- Specified by:
decodeName
in interface NameDecoder
- Parameters:
prev
- The name of the previous entry in the dictionary.b
- The buffer onto which the name of the term should be
encoded.
- Returns:
- The decoded name.
startsWith
public boolean startsWith(java.lang.Object n,
java.lang.Object m)
- Determines whether one string name starts with another.
- Specified by:
startsWith
in interface NameDecoder
- Parameters:
n
- The first name. We are checking to see if m
starts with n
.m
- The second name.
- Returns:
true
if m
starts with
n
, false otherwise.
getShared
public static int getShared(java.lang.String s1,
java.lang.String s2)