edu.stanford.nlp.trees
Class StringLabel

java.lang.Object
  |
  +--edu.stanford.nlp.trees.AbstractLabel
        |
        +--edu.stanford.nlp.trees.StringLabel
All Implemented Interfaces:
Comparable, Label
Direct Known Subclasses:
Category, CategoryWordTag, Tag, Word

public class StringLabel
extends AbstractLabel

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(String str)
          Create a new StringLabel with the given content.
 
Method Summary
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 setFromString(String str)
          Set the label from a String.
 void setValue(String value)
          Set the value for the label.
 String value()
          Return the word value of the label (or null if none).
 
Methods inherited from class edu.stanford.nlp.trees.AbstractLabel
compareTo, equals, hashCode, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

StringLabel

public StringLabel()
Create a new StringLabel with a null content (i.e., str).


StringLabel

public StringLabel(String str)
Create a new StringLabel with the given content.

Parameters:
str - The new label's content

StringLabel

public StringLabel(Label label)
Create a new StringLabel with the value() of another label as its label.

Parameters:
label - The other label
Method Detail

value

public String value()
Return the word value of the label (or null if none).

Specified by:
value in interface Label
Overrides:
value in class AbstractLabel
Returns:
String the word value for the label

setValue

public void setValue(String value)
Set the value for the label.

Specified by:
setValue in interface Label
Overrides:
setValue in class AbstractLabel
Parameters:
value - The value for the label

setFromString

public void setFromString(String str)
Set the label from a String.

Specified by:
setFromString in interface Label
Overrides:
setFromString in class AbstractLabel
Parameters:
str - The str for the label

labelFactory

public LabelFactory labelFactory()
Return a factory for this kind of label (i.e., StringLabel). The factory returned is always the same one (a singleton).

Specified by:
labelFactory in interface Label
Specified by:
labelFactory in class AbstractLabel
Returns:
The label factory

factory

public static LabelFactory factory()
Return a factory for this kind of label.

Returns:
The label factory


Stanford NLP Group