public final class WordData
extends java.lang.Object
implements java.lang.Cloneable
getStem(), getWord()
and other related methods change on subsequent calls to
DictionaryLookup class that returned a given
instance of WordData.
If you need a copy of the
stem or tag data for a given word, you have to create a custom buffer
yourself and copy the associated data, perform clone() or create
strings (they are immutable) using getStem() and then
CharSequence.toString().
For reasons above it makes no sense to use instances
of this class in associative containers or lists. In fact,
both equals(Object) and hashCode() are overridden and throw
exceptions to prevent accidental damage.| Modifier and Type | Field and Description |
|---|---|
private static java.lang.String |
COLLECTIONS_ERROR_MESSAGE
Error information if somebody puts us in a Java collection.
|
private java.nio.charset.CharsetDecoder |
decoder
Character encoding in internal buffers.
|
(package private) java.nio.ByteBuffer |
stemBuffer
Byte buffer holding stem data.
|
private java.nio.CharBuffer |
stemCharSequence
Character sequence after converting
stemBuffer using
decoder. |
(package private) java.nio.ByteBuffer |
tagBuffer
Byte buffer holding tag data.
|
private java.nio.CharBuffer |
tagCharSequence
|
(package private) java.nio.ByteBuffer |
wordBuffer
Byte buffer holding the inflected word form data.
|
private java.lang.CharSequence |
wordCharSequence
Inflected word form data.
|
| Constructor and Description |
|---|
WordData(java.nio.charset.CharsetDecoder decoder)
Package scope constructor.
|
WordData(java.lang.String stem,
java.lang.String tag,
java.lang.String encoding)
A constructor for tests only.
|
| Modifier and Type | Method and Description |
|---|---|
protected WordData |
clone()
Declare a covariant of
Object.clone() that returns a deep copy of
this object. |
private java.lang.CharSequence |
cloneCharSequence(java.lang.CharSequence chs)
Clone char sequences only if not immutable.
|
private java.nio.CharBuffer |
decode(java.nio.ByteBuffer bytes,
java.nio.CharBuffer chars)
Decode byte buffer, optionally expanding the char buffer to.
|
boolean |
equals(java.lang.Object obj) |
java.lang.CharSequence |
getStem() |
java.nio.ByteBuffer |
getStemBytes(java.nio.ByteBuffer target)
Copy the stem's binary data (no charset decoding) to a custom byte
buffer.
|
java.lang.CharSequence |
getTag() |
java.nio.ByteBuffer |
getTagBytes(java.nio.ByteBuffer target)
Copy the tag's binary data (no charset decoding) to a custom byte buffer.
|
java.lang.CharSequence |
getWord() |
java.nio.ByteBuffer |
getWordBytes(java.nio.ByteBuffer target)
Copy the inflected word's binary data (no charset decoding) to a custom
byte buffer.
|
int |
hashCode() |
java.lang.String |
toString() |
(package private) void |
update(java.nio.ByteBuffer wordBuffer,
java.lang.CharSequence word) |
private static final java.lang.String COLLECTIONS_ERROR_MESSAGE
private final java.nio.charset.CharsetDecoder decoder
private java.lang.CharSequence wordCharSequence
private java.nio.CharBuffer stemCharSequence
stemBuffer using
decoder.private java.nio.CharBuffer tagCharSequence
java.nio.ByteBuffer wordBuffer
java.nio.ByteBuffer stemBuffer
java.nio.ByteBuffer tagBuffer
WordData(java.nio.charset.CharsetDecoder decoder)
WordData(java.lang.String stem,
java.lang.String tag,
java.lang.String encoding)
public java.nio.ByteBuffer getStemBytes(java.nio.ByteBuffer target)
target - Target byte buffer to copy the stem buffer to or
null if a new buffer should be allocated.target or the new reallocated buffer.public java.nio.ByteBuffer getTagBytes(java.nio.ByteBuffer target)
target - Target byte buffer to copy the tag buffer to or
null if a new buffer should be allocated.target or the new reallocated buffer.public java.nio.ByteBuffer getWordBytes(java.nio.ByteBuffer target)
target - Target byte buffer to copy the word buffer to or
null if a new buffer should be allocated.target or the new reallocated buffer.public java.lang.CharSequence getTag()
null if no associated tag data exists.public java.lang.CharSequence getStem()
null if no associated stem data exists.public java.lang.CharSequence getWord()
DictionaryLookup.lookup(CharSequence).public boolean equals(java.lang.Object obj)
equals in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Objectpublic java.lang.String toString()
toString in class java.lang.Objectprotected WordData clone()
Object.clone() that returns a deep copy of
this object. The content of all internal buffers is copied.clone in class java.lang.Objectprivate java.lang.CharSequence cloneCharSequence(java.lang.CharSequence chs)
private java.nio.CharBuffer decode(java.nio.ByteBuffer bytes,
java.nio.CharBuffer chars)
void update(java.nio.ByteBuffer wordBuffer,
java.lang.CharSequence word)