public final class LWNode extends java.lang.Object implements DependencyNode, Node
Modifier | Constructor and Description |
---|---|
protected |
LWNode(LWDependencyGraph _graph,
int _index) |
protected |
LWNode(LWDependencyGraph _graph,
LWNode node) |
protected |
LWNode(LWNode node) |
Modifier and Type | Method and Description |
---|---|
void |
addColumnLabels(java.lang.String[] columnLabels) |
void |
addColumnLabels(java.lang.String[] columnLabels,
boolean addEdges) |
void |
addHeadEdgeLabel(LabelSet labelSet) |
void |
addHeadEdgeLabel(SymbolTable table,
int code) |
void |
addHeadEdgeLabel(SymbolTable table,
java.lang.String symbol) |
void |
addIncomingEdge(Edge in) |
void |
addLabel(LabelSet labels)
Adds the labels of the label set to the label set of the graph element.
|
void |
addLabel(SymbolTable table,
int code)
Adds a label (an integer value) to the symbol table and to the graph element.
|
void |
addLabel(SymbolTable table,
java.lang.String symbol)
Adds a label (a string value) to the symbol table and to the graph element.
|
void |
addOutgoingEdge(Edge out) |
void |
clear()
Resets the graph element.
|
int |
compareTo(ComparableNode that) |
boolean |
equals(java.lang.Object obj) |
DependencyNode |
findComponent() |
DependencyNode |
getAncestor() |
LabeledStructure |
getBelongsToGraph()
Returns the graph (structure) in which the graph element belongs to.
|
DependencyNode |
getClosestLeftDependent()
Returns the closest left dependent to the node it self, if not found
null is returned. |
DependencyNode |
getClosestRightDependent()
Returns the closest right dependent to the node it self, if not found
null is returned. |
int |
getCompareToIndex()
Returns the index of the node (only used internal by compareTo).
|
DependencyNode |
getComponent() |
int |
getDependencyNodeDepth()
Returns the depth of the node.
|
java.util.SortedSet<DependencyNode> |
getDependents() |
protected DependencyStructure |
getGraph() |
DependencyNode |
getHead()
Returns the head dependency node if it exists, otherwise null.
|
Edge |
getHeadEdge()
Returns the edge between the head and the node if it exists, otherwise null.
|
int |
getHeadEdgeLabelCode(SymbolTable table) |
LabelSet |
getHeadEdgeLabelSet() |
java.lang.String |
getHeadEdgeLabelSymbol(SymbolTable table) |
java.util.Set<SymbolTable> |
getHeadEdgeLabelTypes() |
java.util.Set<Edge> |
getHeadEdges() |
int |
getHeadIndex() |
java.util.SortedSet<DependencyNode> |
getHeads() |
java.util.Iterator<Edge> |
getIncomingEdgeIterator() |
java.util.SortedSet<Edge> |
getIncomingSecondaryEdges()
Returns a sorted set of incoming secondary edges.
|
int |
getInDegree()
Returns the in degree of the node (number of incoming edges of all types of edges).
|
int |
getIndex()
Returns the index of the node.
|
java.lang.String |
getLabel(org.maltparser.concurrent.graph.dataformat.ColumnDescription column) |
java.lang.String |
getLabel(int columnPosition) |
java.lang.String |
getLabel(java.lang.String columnName) |
int |
getLabelCode(SymbolTable table)
Returns the label code (an integer representation) of the symbol table if it exists, otherwise
an exception is thrown.
|
java.util.SortedMap<org.maltparser.concurrent.graph.dataformat.ColumnDescription,java.lang.String> |
getLabels() |
LabelSet |
getLabelSet()
Returns the label set.
|
java.lang.String |
getLabelSymbol(SymbolTable table)
Returns the label symbol(a string representation) of the symbol table if it exists, otherwise
an exception is thrown.
|
java.util.Set<SymbolTable> |
getLabelTypes()
Returns a set of symbol tables (labeling functions or label types) that labels the graph element.
|
DependencyNode |
getLeftDependent(int leftDependentIndex)
Returns the left dependent at the position index, where index==0 equals the left most dependent.
|
int |
getLeftDependentCount()
Return the number of left dependents
|
java.util.SortedSet<DependencyNode> |
getLeftDependents()
Returns a sorted set of left dependents.
|
DependencyNode |
getLeftmostDependent() |
ComparableNode |
getLeftmostDescendant()
Returns the left-most terminal descendant node.
|
int |
getLeftmostDescendantIndex()
Returns the index of the left-most terminal descendant node.
|
ComparableNode |
getLeftmostProperDescendant()
Returns the left-most proper terminal descendant node (excluding itself).
|
int |
getLeftmostProperDescendantIndex()
Returns the index of the left-most proper terminal descendant node (excluding itself).
|
DependencyNode |
getLeftSibling()
Returns the left sibling if it exists, otherwise
null |
java.util.List<DependencyNode> |
getListOfDependents() |
java.util.List<DependencyNode> |
getListOfLeftDependents() |
java.util.List<DependencyNode> |
getListOfRightDependents() |
int |
getOutDegree()
Returns the out degree of the node (number of outgoing edges of all types of edges).
|
java.util.Iterator<Edge> |
getOutgoingEdgeIterator() |
java.util.SortedSet<Edge> |
getOutgoingSecondaryEdges()
Returns a sorted set of outgoing secondary edges.
|
DependencyNode |
getPredecessor()
Returns the predecessor dependency node in the linear order of the token nodes.
|
DependencyNode |
getProperAncestor() |
int |
getRank() |
DependencyNode |
getRightDependent(int rightDependentIndex) |
int |
getRightDependentCount()
Return the number of right dependents
|
java.util.SortedSet<DependencyNode> |
getRightDependents()
Returns a sorted set of right dependents.
|
DependencyNode |
getRightmostDependent() |
ComparableNode |
getRightmostDescendant()
Returns the right-most terminal descendant node.
|
int |
getRightmostDescendantIndex()
Returns the index of the right-most terminal descendant node.
|
ComparableNode |
getRightmostProperDescendant()
Returns the right-most proper terminal descendant node (excluding itself).
|
int |
getRightmostProperDescendantIndex()
Returns the index of the right-most proper terminal descendant node (excluding itself).
|
DependencyNode |
getRightSibling()
Returns the right sibling if it exists, otherwise
null |
DependencyNode |
getSameSideLeftSibling()
Returns the left sibling at the same side of head as the node it self.
|
DependencyNode |
getSameSideRightSibling()
Returns the right sibling at the same side of head as the node it self.
|
DependencyNode |
getSuccessor()
Returns the successor dependency node in the linear order of the token nodes.
|
boolean |
hasAncestorInside(int left,
int right) |
boolean |
hasAtMostOneHead()
Returns true if the node has at most one head, otherwise false.
|
boolean |
hasDependent() |
int |
hashCode() |
boolean |
hasHead()
Returns true if the node has one or more head(s), otherwise false.
|
boolean |
hasHeadEdgeLabel(SymbolTable table) |
boolean |
hasLabel(org.maltparser.concurrent.graph.dataformat.ColumnDescription column) |
boolean |
hasLabel(int columnPosition) |
boolean |
hasLabel(java.lang.String columnName) |
boolean |
hasLabel(SymbolTable table)
Returns true if the graph element has a label for the symbol table, otherwise false.
|
boolean |
hasLeftDependent()
Returns true if the node has one or more left dependents, otherwise false.
|
boolean |
hasRightDependent() |
boolean |
isHeadEdgeLabeled() |
boolean |
isHeadLabeled() |
boolean |
isLabeled()
Returns true if the graph element has one or more labels, otherwise false.
|
boolean |
isProjective()
Returns true if the head edge is projective, otherwise false.
|
boolean |
isRoot()
Returns true if the node is a root node, otherwise false.
|
int |
nHeadEdgeLabels() |
int |
nLabels()
Returns the number of labels of the graph element.
|
void |
removeIncomingEdge(Edge in) |
void |
removeLabel(SymbolTable table) |
void |
removeLabels() |
void |
removeOutgoingEdge(Edge out) |
void |
setBelongsToGraph(LabeledStructure belongsToGraph)
Sets the graph (structure) in which the graph element belongs to.
|
void |
setComponent(DependencyNode x) |
void |
setIndex(int index) |
void |
setRank(int r) |
java.lang.String |
toString() |
protected LWNode(LWNode node) throws LWGraphException
LWGraphException
protected LWNode(LWDependencyGraph _graph, LWNode node) throws LWGraphException
LWGraphException
protected LWNode(LWDependencyGraph _graph, int _index) throws LWGraphException
LWGraphException
protected DependencyStructure getGraph()
public int getIndex()
ComparableNode
getIndex
in interface ComparableNode
public void setIndex(int index) throws MaltChainedException
setIndex
in interface Node
MaltChainedException
public java.lang.String getLabel(int columnPosition)
public java.lang.String getLabel(java.lang.String columnName)
public java.lang.String getLabel(org.maltparser.concurrent.graph.dataformat.ColumnDescription column)
public boolean hasLabel(int columnPosition)
public boolean hasLabel(java.lang.String columnName)
public boolean hasLabel(org.maltparser.concurrent.graph.dataformat.ColumnDescription column)
public boolean isLabeled()
Element
public boolean isHeadLabeled()
public int getHeadIndex()
public java.util.SortedMap<org.maltparser.concurrent.graph.dataformat.ColumnDescription,java.lang.String> getLabels()
public DependencyNode getPredecessor()
DependencyNode
getPredecessor
in interface DependencyNode
public DependencyNode getSuccessor()
DependencyNode
getSuccessor
in interface DependencyNode
public boolean isRoot()
ComparableNode
isRoot
in interface ComparableNode
public boolean hasAtMostOneHead()
DependencyNode
hasAtMostOneHead
in interface DependencyNode
public boolean hasHead()
DependencyNode
hasHead
in interface DependencyNode
public boolean hasDependent()
hasDependent
in interface DependencyNode
public boolean hasLeftDependent()
DependencyNode
hasLeftDependent
in interface DependencyNode
public boolean hasRightDependent()
hasRightDependent
in interface DependencyNode
public java.util.SortedSet<DependencyNode> getHeads()
getHeads
in interface DependencyNode
public DependencyNode getHead()
DependencyNode
getHead
in interface DependencyNode
public DependencyNode getLeftDependent(int leftDependentIndex)
DependencyNode
getLeftDependent
in interface DependencyNode
leftDependentIndex
- the indexpublic int getLeftDependentCount()
DependencyNode
getLeftDependentCount
in interface DependencyNode
public java.util.SortedSet<DependencyNode> getLeftDependents()
DependencyNode
getLeftDependents
in interface DependencyNode
public java.util.List<DependencyNode> getListOfLeftDependents()
getListOfLeftDependents
in interface DependencyNode
public DependencyNode getLeftSibling()
DependencyNode
null
getLeftSibling
in interface DependencyNode
null
public DependencyNode getSameSideLeftSibling()
DependencyNode
null
is returnedgetSameSideLeftSibling
in interface DependencyNode
null
is returnedpublic DependencyNode getClosestLeftDependent()
DependencyNode
null
is returned.getClosestLeftDependent
in interface DependencyNode
null
is returned.public DependencyNode getLeftmostDependent()
getLeftmostDependent
in interface DependencyNode
public DependencyNode getRightDependent(int rightDependentIndex)
getRightDependent
in interface DependencyNode
public int getRightDependentCount()
DependencyNode
getRightDependentCount
in interface DependencyNode
public java.util.SortedSet<DependencyNode> getRightDependents()
DependencyNode
getRightDependents
in interface DependencyNode
public java.util.List<DependencyNode> getListOfRightDependents()
getListOfRightDependents
in interface DependencyNode
public DependencyNode getRightSibling()
DependencyNode
null
getRightSibling
in interface DependencyNode
null
public DependencyNode getSameSideRightSibling()
DependencyNode
null
is returnedgetSameSideRightSibling
in interface DependencyNode
null
is returnedpublic DependencyNode getClosestRightDependent()
DependencyNode
null
is returned.getClosestRightDependent
in interface DependencyNode
null
is returned.public DependencyNode getRightmostDependent()
getRightmostDependent
in interface DependencyNode
public java.util.SortedSet<DependencyNode> getDependents()
public java.util.List<DependencyNode> getListOfDependents()
getListOfDependents
in interface DependencyNode
public int getInDegree()
ComparableNode
getInDegree
in interface ComparableNode
public int getOutDegree()
ComparableNode
getOutDegree
in interface ComparableNode
public DependencyNode getAncestor() throws MaltChainedException
getAncestor
in interface DependencyNode
MaltChainedException
public DependencyNode getProperAncestor() throws MaltChainedException
getProperAncestor
in interface DependencyNode
MaltChainedException
public boolean hasAncestorInside(int left, int right) throws MaltChainedException
hasAncestorInside
in interface DependencyNode
MaltChainedException
public boolean isProjective() throws MaltChainedException
DependencyNode
isProjective
in interface DependencyNode
MaltChainedException
public int getDependencyNodeDepth() throws MaltChainedException
DependencyNode
getDependencyNodeDepth
in interface DependencyNode
MaltChainedException
public int getCompareToIndex()
ComparableNode
getCompareToIndex
in interface ComparableNode
public ComparableNode getLeftmostProperDescendant() throws MaltChainedException
ComparableNode
getLeftmostProperDescendant
in interface ComparableNode
MaltChainedException
public ComparableNode getRightmostProperDescendant() throws MaltChainedException
ComparableNode
getRightmostProperDescendant
in interface ComparableNode
MaltChainedException
public int getLeftmostProperDescendantIndex() throws MaltChainedException
ComparableNode
getLeftmostProperDescendantIndex
in interface ComparableNode
MaltChainedException
public int getRightmostProperDescendantIndex() throws MaltChainedException
ComparableNode
getRightmostProperDescendantIndex
in interface ComparableNode
MaltChainedException
public ComparableNode getLeftmostDescendant() throws MaltChainedException
ComparableNode
getLeftmostDescendant
in interface ComparableNode
MaltChainedException
public ComparableNode getRightmostDescendant() throws MaltChainedException
ComparableNode
getRightmostDescendant
in interface ComparableNode
MaltChainedException
public int getLeftmostDescendantIndex() throws MaltChainedException
ComparableNode
getLeftmostDescendantIndex
in interface ComparableNode
MaltChainedException
public int getRightmostDescendantIndex() throws MaltChainedException
ComparableNode
getRightmostDescendantIndex
in interface ComparableNode
MaltChainedException
public java.util.SortedSet<Edge> getIncomingSecondaryEdges() throws MaltChainedException
ComparableNode
getIncomingSecondaryEdges
in interface ComparableNode
MaltChainedException
public java.util.SortedSet<Edge> getOutgoingSecondaryEdges() throws MaltChainedException
ComparableNode
getOutgoingSecondaryEdges
in interface ComparableNode
MaltChainedException
public java.util.Set<Edge> getHeadEdges()
getHeadEdges
in interface DependencyNode
public Edge getHeadEdge()
DependencyNode
getHeadEdge
in interface DependencyNode
public void addHeadEdgeLabel(SymbolTable table, java.lang.String symbol) throws MaltChainedException
addHeadEdgeLabel
in interface DependencyNode
MaltChainedException
public void addHeadEdgeLabel(SymbolTable table, int code) throws MaltChainedException
addHeadEdgeLabel
in interface DependencyNode
MaltChainedException
public void addHeadEdgeLabel(LabelSet labelSet) throws MaltChainedException
addHeadEdgeLabel
in interface DependencyNode
MaltChainedException
public boolean hasHeadEdgeLabel(SymbolTable table) throws MaltChainedException
hasHeadEdgeLabel
in interface DependencyNode
MaltChainedException
public java.lang.String getHeadEdgeLabelSymbol(SymbolTable table) throws MaltChainedException
getHeadEdgeLabelSymbol
in interface DependencyNode
MaltChainedException
public int getHeadEdgeLabelCode(SymbolTable table) throws MaltChainedException
getHeadEdgeLabelCode
in interface DependencyNode
MaltChainedException
public java.util.Set<SymbolTable> getHeadEdgeLabelTypes() throws MaltChainedException
getHeadEdgeLabelTypes
in interface DependencyNode
MaltChainedException
public LabelSet getHeadEdgeLabelSet() throws MaltChainedException
getHeadEdgeLabelSet
in interface DependencyNode
MaltChainedException
public void addIncomingEdge(Edge in) throws MaltChainedException
addIncomingEdge
in interface Node
MaltChainedException
public void addOutgoingEdge(Edge out) throws MaltChainedException
addOutgoingEdge
in interface Node
MaltChainedException
public void removeIncomingEdge(Edge in) throws MaltChainedException
removeIncomingEdge
in interface Node
MaltChainedException
public void removeOutgoingEdge(Edge out) throws MaltChainedException
removeOutgoingEdge
in interface Node
MaltChainedException
public java.util.Iterator<Edge> getIncomingEdgeIterator()
getIncomingEdgeIterator
in interface Node
public java.util.Iterator<Edge> getOutgoingEdgeIterator()
getOutgoingEdgeIterator
in interface Node
public void setRank(int r)
setRank
in interface DependencyNode
public DependencyNode getComponent()
getComponent
in interface DependencyNode
public void setComponent(DependencyNode x)
setComponent
in interface DependencyNode
public DependencyNode findComponent()
findComponent
in interface DependencyNode
public int getRank()
getRank
in interface DependencyNode
public boolean isHeadEdgeLabeled()
isHeadEdgeLabeled
in interface DependencyNode
public int nHeadEdgeLabels()
nHeadEdgeLabels
in interface DependencyNode
public void addColumnLabels(java.lang.String[] columnLabels) throws MaltChainedException
MaltChainedException
public void addColumnLabels(java.lang.String[] columnLabels, boolean addEdges) throws MaltChainedException
MaltChainedException
public void addLabel(SymbolTable table, java.lang.String symbol) throws MaltChainedException
addLabel
in interface Element
table
- the symbol tablesymbol
- a label symbolMaltChainedException
public void addLabel(SymbolTable table, int code) throws MaltChainedException
addLabel
in interface Element
table
- the symbol tablecode
- a label codeMaltChainedException
public void addLabel(LabelSet labels) throws MaltChainedException
addLabel
in interface Element
labels
- a label set.MaltChainedException
public boolean hasLabel(SymbolTable table) throws MaltChainedException
hasLabel
in interface Element
table
- the symbol tableMaltChainedException
public java.lang.String getLabelSymbol(SymbolTable table) throws MaltChainedException
getLabelSymbol
in interface Element
table
- the symbol tableMaltChainedException
public int getLabelCode(SymbolTable table) throws MaltChainedException
getLabelCode
in interface Element
table
- the symbol tableMaltChainedException
public int nLabels()
public java.util.Set<SymbolTable> getLabelTypes()
getLabelTypes
in interface Element
public LabelSet getLabelSet()
getLabelSet
in interface Element
public void removeLabel(SymbolTable table) throws MaltChainedException
removeLabel
in interface Element
MaltChainedException
public void removeLabels() throws MaltChainedException
removeLabels
in interface Element
MaltChainedException
public LabeledStructure getBelongsToGraph()
getBelongsToGraph
in interface Element
public void setBelongsToGraph(LabeledStructure belongsToGraph)
Element
setBelongsToGraph
in interface Element
belongsToGraph
- a graph (structure).public void clear() throws MaltChainedException
clear
in interface Element
MaltChainedException
public int compareTo(ComparableNode that)
compareTo
in interface java.lang.Comparable<ComparableNode>
public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object
Copyright 2007-2017 Johan Hall, Jens Nilsson and Joakim Nivre.