public abstract class Constituent extends java.lang.Object implements Labeled, Scored, Label
Constituent
object defines a generic edge in a graph.
The Constituent
class is designed to be extended. It
implements the Comparable
interface in order to allow
graphs to be topologically sorted by the ordinary Collection
library in java.util
, keying primarily on right-hand
node ID number. The Constituent
class implements most
of the functionality of the the Label
interface by passing all requests down to the Label
which
might be contained in the Constituent
. This allows one
to put a Constituent
anywhere that a Label
is
required. A Constituent
is always Scored
.Constructor and Description |
---|
Constituent() |
Modifier and Type | Method and Description |
---|---|
boolean |
contains(Constituent c)
Detects whether this constituent contains a constituent, that is
whether they are nested.
|
boolean |
crosses(java.util.Collection<Constituent> constColl)
Detects whether this constituent overlaps any of a Collection of
Constituents without
nesting, that is, whether it "crosses" any of them.
|
boolean |
crosses(Constituent c)
Detects whether this constituent overlaps a constituent without
nesting, that is, whether they "cross".
|
abstract int |
end()
access end node.
|
boolean |
equals(java.lang.Object obj)
Compare with another Object for equality.
|
int |
hashCode()
A hashCode for Constituents done by shifting and or'ing for speed.
|
Label |
label()
access label
|
java.util.Collection<Label> |
labels()
Access labels -- actually always a singleton here.
|
double |
score()
access score
|
abstract void |
setEnd(int end)
set end node.
|
void |
setFromString(java.lang.String labelStr)
Make a new label with this
String as the "name", perhaps
by doing some appropriate decoding of the string. |
void |
setLabel(Label label)
Sets the label associated with the current Constituent,
if there is one.
|
void |
setLabels(java.util.Collection<Label> labels)
Sets the labels associated with this object.
|
void |
setScore(double score)
Sets the score associated with the current node, if there is one
|
abstract void |
setStart(int start)
set start node.
|
void |
setValue(java.lang.String value)
Set the value for the label (if one is stored).
|
int |
size()
Return the length of a
Constituent |
abstract int |
start()
access start node.
|
java.lang.String |
toSentenceString(java.util.List<?> s)
Print out as a string the subpart of a sentence covered
by this
Constituent . |
java.lang.String |
toString()
Return a string representation of a
Constituent . |
java.lang.String |
value()
Return the value of the label (or null if none).
|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
labelFactory
public abstract int start()
public abstract void setStart(int start)
public abstract int end()
public abstract void setEnd(int end)
public Label label()
public void setLabel(Label label)
public java.util.Collection<Label> labels()
public void setLabels(java.util.Collection<Label> labels)
Labeled
public double score()
public void setScore(double score)
public java.lang.String toString()
Constituent
.public int size()
Constituent
public boolean equals(java.lang.Object obj)
double
NaN values are considered unequal in
Java.)
The general contract of equals() implies that one can't have a
subclass of a concrete [non-abstract] class redefine equals() to use
extra aspects, so subclasses shouldn't override this in ways that
make use of extra fields.equals
in class java.lang.Object
obj
- The object being compared withpublic int hashCode()
hashCode
in class java.lang.Object
public boolean crosses(Constituent c)
c
- The constituent to check againstpublic boolean crosses(java.util.Collection<Constituent> constColl)
constColl
- The set of constituent to check againstjava.lang.ClassCastException
- If some member of the Collection isn't
a Constituentpublic boolean contains(Constituent c)
c
- The constituent to check againstpublic java.lang.String value()
public void setValue(java.lang.String value)
public void setFromString(java.lang.String labelStr)
String
as the "name", perhaps
by doing some appropriate decoding of the string.setFromString
in interface Label
labelStr
- the String that translates into the content of the
labelpublic java.lang.String toSentenceString(java.util.List<?> s)
Constituent
.