|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.stanford.nlp.ling.ValueLabel
edu.stanford.nlp.ling.StringLabel
public class StringLabel
A StringLabel
object acts as a Label by containing a
single String, which it sets or returns in response to requests.
The hashCode() and compareTo() methods for this class assume that this
string value is non-null. equals() is correctly implemented
Constructor Summary | |
---|---|
StringLabel()
Create a new StringLabel with a null content (i.e., str). |
|
StringLabel(Label label)
Create a new StringLabel with the
value() of another label as its label. |
|
StringLabel(java.lang.String str)
Create a new StringLabel with the given content. |
|
StringLabel(java.lang.String str,
int beginPosition,
int endPosition)
Create a new StringLabel with the given content. |
Method Summary | |
---|---|
int |
beginPosition()
Return the beginning character offset of the label (or -1 if none). |
int |
endPosition()
Return the ending character offset of the label (or -1 if none). |
static LabelFactory |
factory()
Return a factory for this kind of label. |
LabelFactory |
labelFactory()
Return a factory for this kind of label (i.e., StringLabel ). |
void |
setBeginPosition(int beginPosition)
Set the beginning character offset for the label. |
void |
setEndPosition(int endPosition)
Set the ending character offset of the label (or -1 if none). |
void |
setFromString(java.lang.String str)
Set the label from a String. |
void |
setValue(java.lang.String value)
Set the value for the label. |
java.lang.String |
toString()
Return a string representation of the label. |
java.lang.String |
value()
Return the word value of the label (or null if none). |
Methods inherited from class edu.stanford.nlp.ling.ValueLabel |
---|
compareTo, equals, hashCode |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public StringLabel()
StringLabel
with a null content (i.e., str).
public StringLabel(java.lang.String str)
StringLabel
with the given content.
str
- The new label's contentpublic StringLabel(java.lang.String str, int beginPosition, int endPosition)
StringLabel
with the given content.
str
- The new label's contentbeginPosition
- Start offset in original textendPosition
- End offset in original textpublic StringLabel(Label label)
StringLabel
with the
value()
of another label as its label.
label
- The other labelMethod Detail |
---|
public java.lang.String value()
value
in interface Label
value
in class ValueLabel
public void setValue(java.lang.String value)
setValue
in interface Label
setValue
in class ValueLabel
value
- The value for the labelpublic void setFromString(java.lang.String str)
setFromString
in interface Label
setFromString
in class ValueLabel
str
- The str for the labelpublic java.lang.String toString()
ValueLabel
value()
if it is non-null
,
and the empty string otherwise.
toString
in interface Label
toString
in class ValueLabel
public LabelFactory labelFactory()
StringLabel
).
The factory returned is always the same one (a singleton).
labelFactory
in interface Label
labelFactory
in class ValueLabel
public static LabelFactory factory()
public int beginPosition()
HasOffset
beginPosition
in interface HasOffset
public int endPosition()
HasOffset
endPosition
in interface HasOffset
public void setBeginPosition(int beginPosition)
HasOffset
setBeginPosition
in interface HasOffset
beginPosition
- The beginning positionpublic void setEndPosition(int endPosition)
HasOffset
setEndPosition
in interface HasOffset
endPosition
- The end character offset for the label
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |