public class Word extends StringLabel implements HasWord
Word
object acts as a Label by containing a String.
This class is in essence identical to a StringLabel
, but
it also uses the value to implement the HasWord
interface.Modifier and Type | Field and Description |
---|---|
static Word |
EMPTY
Word representation of an empty.
|
Constructor and Description |
---|
Word()
Construct a new word with a
null value. |
Word(Label lab)
Creates a new word whose word value is the value of any
class that supports the
Label interface. |
Word(java.lang.String word)
Construct a new word, with the given value.
|
Word(java.lang.String word,
int beginPosition,
int endPosition)
Construct a new word, with the given value.
|
Modifier and Type | Method and Description |
---|---|
static LabelFactory |
factory()
Return a factory for this kind of label.
|
LabelFactory |
labelFactory()
Return a factory for this kind of label (i.e.,
Word ). |
void |
setWord(java.lang.String word)
Set the word value for the label (if one is stored).
|
java.lang.String |
word()
Return the word value of the label (or null if none).
|
beginPosition, endPosition, setBeginPosition, setEndPosition, setFromString, setValue, toString, value
compareTo, equals, hashCode
public static final Word EMPTY
public Word()
null
value.public Word(java.lang.String word)
word
- String value of the Wordpublic Word(java.lang.String word, int beginPosition, int endPosition)
word
- String value of the Wordpublic Word(Label lab)
Label
interface.lab
- The label to be used as the basis of the new Wordpublic java.lang.String word()
HasWord
public void setWord(java.lang.String word)
HasWord
public LabelFactory labelFactory()
Word
).
The factory returned is always the same one (a singleton).labelFactory
in interface Label
labelFactory
in class StringLabel
public static LabelFactory factory()