|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.googlecode.whatswrong.Edge
public class Edge
An Edge is a labelled and typed pair of tokens. It can represent dependencies edges as well as spans. Along with a start and end (to and from) token an edge has the following three attributes:
Edge.RenderType.dependency
Nested Class Summary | |
---|---|
static class |
Edge.RenderType
The RenderType enum can be used to specify how the edge should be rendered. |
Constructor Summary | |
---|---|
Edge(Token from,
Token to,
java.lang.String label,
java.lang.String type)
Creates a new edge with default render type (dependency). |
|
Edge(Token from,
Token to,
java.lang.String label,
java.lang.String type,
Edge.RenderType renderType)
Create new edge. |
|
Edge(Token from,
Token to,
java.lang.String label,
java.lang.String note,
java.lang.String type,
Edge.RenderType renderType)
Create new edge. |
|
Edge(Token from,
Token to,
java.lang.String label,
java.lang.String note,
java.lang.String type,
Edge.RenderType renderType,
java.lang.String description)
Create new edge. |
Method Summary | |
---|---|
boolean |
covers(Edge edge)
Check whether this edge completely covers the specified edge. |
boolean |
coversExactly(Edge edge)
Check whether this edge spans the same sequence of tokens as the given edge. |
boolean |
coversSemi(Edge edge)
Checks whether this edge covers the given edge and is aligned with it on one side. |
boolean |
crosses(Edge edge)
Checks whether the given edge crosses this edge. |
boolean |
equals(java.lang.Object o)
Checks whether to edges are equal |
java.lang.String |
getDescription()
A description of the edge |
Token |
getFrom()
Returns the start token of the edge. |
java.lang.String |
getLabel()
Returns the label of the edge. |
java.lang.String |
getLabelWithNote()
Returns the label with an additional note if available. |
int |
getLength()
Returns the distance between the from and to token. |
int |
getMaxIndex()
Returns the maximal index of both tokens in this edge. |
int |
getMinIndex()
Returns the mimimal index of both tokens in this edge. |
java.lang.String |
getNote()
Returns the note that is appended to the label. |
Edge.RenderType |
getRenderType()
Returns the render type of this edge. |
Token |
getTo()
Returns the end token of the edge. |
java.lang.String |
getType()
Returns the type of the edge. |
java.lang.String |
getTypePostfix()
If the type of label is "prefix:postfix" this method returns "postfix". |
java.lang.String |
getTypePrefix()
If the type of label is qualified with a "qualifier:" prefix this method returns "qualifier". |
int |
hashCode()
Returns a hashcode based on type, label, note, from and to token. |
boolean |
leftOf(Token token)
Checks whether the edge is to the left of the given token. |
int |
lexicographicOrder(Edge edge)
Compares the type and label of this edge and the passed edge. |
boolean |
overlaps(Edge edge)
Checks whether this edge overlaps the given edge. |
boolean |
rightOf(Token token)
Checks whether the edge is to the right of the given token. |
void |
setDescription(java.lang.String description)
Sets the description of this edge |
void |
setRenderType(Edge.RenderType renderType)
Sets the render type of this edge. |
boolean |
strictlyCovers(Edge edge)
Checks whether the given edge is covered by this edge and at least one token is not aligned. |
java.lang.String |
toString()
Returns a string representation of this edge. |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public Edge(Token from, Token to, java.lang.String label, java.lang.String type, Edge.RenderType renderType)
from
- from token.to
- to tokenlabel
- the label of the edgetype
- the type of the edge (say, 'semantic role').renderType
- the render type.public Edge(Token from, Token to, java.lang.String label, java.lang.String note, java.lang.String type, Edge.RenderType renderType)
from
- from token.to
- to tokenlabel
- the label of the edgenote
- the note to add to the edgetype
- the type of the edge (say, 'semantic role').renderType
- the render type.public Edge(Token from, Token to, java.lang.String label, java.lang.String note, java.lang.String type, Edge.RenderType renderType, java.lang.String description)
from
- from token.to
- to tokenlabel
- the label of the edgenote
- the note to add to the edgetype
- the type of the edge (say, 'semantic role').renderType
- the render type.description
- a description of the edge.public Edge(Token from, Token to, java.lang.String label, java.lang.String type)
from
- from token.to
- to token.label
- the label of the edge.type
- the type of the edge.Method Detail |
---|
public java.lang.String getTypePrefix()
public java.lang.String getTypePostfix()
public java.lang.String getDescription()
public int getMinIndex()
public int getMaxIndex()
public Edge.RenderType getRenderType()
Edge.RenderType.span
.
public void setRenderType(Edge.RenderType renderType)
Edge.RenderType.span
.
renderType
- the render type of this edge.public Token getFrom()
public void setDescription(java.lang.String description)
description
- a text describing this edge.public Token getTo()
public java.lang.String getLabel()
public java.lang.String getNote()
public java.lang.String getLabelWithNote()
public java.lang.String getType()
public int lexicographicOrder(Edge edge)
edge
- the edge to compare to.
public boolean leftOf(Token token)
token
- the token to compare to
public boolean rightOf(Token token)
token
- the token to compare to
public int getLength()
public boolean covers(Edge edge)
edge
- the edge to check whether it is covered by this edge.
public boolean coversExactly(Edge edge)
edge
- the edge to compare with.
public boolean coversSemi(Edge edge)
edge
- the edge to compare with.
public boolean overlaps(Edge edge)
edge
- the edge to compare with.
public boolean strictlyCovers(Edge edge)
edge
- the edge to compare with.
public java.lang.String toString()
toString
in class java.lang.Object
public boolean crosses(Edge edge)
edge
- the edge to compare to.
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
o
- the other edge
public int hashCode()
hashCode
in class java.lang.Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |