|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--edu.stanford.nlp.trees.AbstractLabel
An AbstractLabel
object acts as a Label with linguistic
attributes. This is an abstract class, which doesn't actually store
or return anything. It returns null
to any requests.
Designed to be extended.
Constructor Summary | |
protected |
AbstractLabel()
|
Method Summary | |
int |
compareTo(Object obj)
Implementation of comparison for Label . |
boolean |
equals(Object obj)
Equality for Label s is defined in the first instance
as equality of their String value() . |
int |
hashCode()
Return the hashCode of the String value providing there is one. |
abstract LabelFactory |
labelFactory()
Returns a factory that makes Labels of the appropriate sort. |
void |
setFromString(String labelStr)
Set the contents of this label to this String
representing the
complete contents of the label. |
void |
setValue(String value)
Set the value for the label (if one is stored). |
String |
toString()
Return a string representation of the label. |
String |
value()
Return the value of the label (or null if none). |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
protected AbstractLabel()
Method Detail |
public String value()
AbstractLabel
is
always null
value
in interface Label
public void setValue(String value)
setValue
in interface Label
value
- - the value for the labelpublic String toString()
value()
if it is non-null
,
and the empty string otherwise.
toString
in interface Label
toString
in class Object
public void setFromString(String labelStr)
Label
String
representing the
complete contents of the label. A class implementing label may
throw an UnsupportedOperationException
for this
method (only). Typically, this method would do
some appropriate decoding of the string in a way that sets
multiple fields in an inverse of the toString()
method.
setFromString
in interface Label
labelStr
- the String that translates into the content of the
labelpublic boolean equals(Object obj)
Label
s is defined in the first instance
as equality of their String
value()
.
Now rewritten to correctly enforce the contract of equals in Object.
Equality for a Label
is determined simply by String
equality of its value()
. Subclasses should not redefine
this to include other aspects of the Label
, or the
contract for equals()
is broken.
equals
in class Object
obj
- the object against which equality is to be checked
this
and obj
are equalpublic int hashCode()
null
.
hashCode
in class Object
public int compareTo(Object obj)
Label
.
Orders by value
's lexicographic ordering.
compareTo
in interface Label
obj
- object to compare to
public abstract LabelFactory labelFactory()
labelFactory
in interface Label
LabelFactory
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |