|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.stanford.nlp.ling.AbstractLabel
public abstract class 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(java.lang.Object obj)
Implementation of comparison for Label . |
boolean |
equals(java.lang.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(java.lang.String labelStr)
Set the contents of this label to this String
representing the
complete contents of the label. |
void |
setValue(java.lang.String value)
Set the value for the label (if one is stored). |
java.lang.String |
toString()
Return a string representation of the label. |
java.lang.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 java.lang.String value()
AbstractLabel
is
always null
value
in interface Label
public void setValue(java.lang.String value)
setValue
in interface Label
value
- - the value for the labelpublic java.lang.String toString()
value()
if it is non-null
,
and the empty string otherwise.
toString
in interface Label
toString
in class java.lang.Object
public void setFromString(java.lang.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(java.lang.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 java.lang.Object
obj
- the object against which equality is to be checked
this
and obj
are equalpublic int hashCode()
null
.
hashCode
in class java.lang.Object
public int compareTo(java.lang.Object obj)
Label
.
Orders by value
's lexicographic ordering.
compareTo
in interface Label
compareTo
in interface java.lang.Comparable
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 |