public class SimpleDependencyPath extends Object implements DependencyPath
DependencyPath
that supports constant time access to the nodes and
relations that make up its sequence.Constructor and Description |
---|
SimpleDependencyPath()
Creates an empty dependency path
|
SimpleDependencyPath(DependencyPath path)
Creates new
SimpleDependencyPath as a copy of the provided path. |
SimpleDependencyPath(DependencyRelation relation,
boolean startFromHead)
Creates a
SimpleDependencyPath from a single relation, optionally
starting at the head node of the relation. |
SimpleDependencyPath(List<DependencyRelation> path)
Creates a
SimpleDependencyPath starting at the head node of the
first relation in the list. |
SimpleDependencyPath(List<DependencyRelation> path,
boolean isHeadFirst)
Creates a
SimpleDependencyPath that starts at either the head
node or dependent node of the first relation in the list. |
Modifier and Type | Method and Description |
---|---|
SimpleDependencyPath |
copy()
Returns a copy of this dependency path
|
boolean |
equals(Object o) |
SimpleDependencyPath |
extend(DependencyRelation relation)
Returns a copy of this dependency path that has the provided related
appended to the end of its path sequence.
|
DependencyTreeNode |
first()
Returns the first node in the path, which is closest to the root.
|
DependencyRelation |
firstRelation()
Returns the relation that connects the first and second nodes in the
path, which are closest to the root.
|
DependencyTreeNode |
getNode(int position)
Returns the node location at the specified position along the path.
|
String |
getRelation(int position)
Returns the relation connecting the node at the specified position to the
next node.
|
Iterator<DependencyRelation> |
iterator()
Returns an iterator over all the relations in the path in order from
closest to the root to furthest.
|
DependencyTreeNode |
last()
Returns the last node in the path, which is furthest from the root.
|
DependencyRelation |
lastRelation()
Returns the relation that connects the last and second to last nodes in
the path, which are furthest from the root.
|
int |
length()
Returns the number of nodes in the dependency path.
|
String |
toString()
Returns the path in order with words and relations space delimited.
|
public SimpleDependencyPath(List<DependencyRelation> path)
SimpleDependencyPath
starting at the head node of the
first relation in the list.public SimpleDependencyPath(List<DependencyRelation> path, boolean isHeadFirst)
SimpleDependencyPath
that starts at either the head
node or dependent node of the first relation in the list.public SimpleDependencyPath(DependencyPath path)
SimpleDependencyPath
as a copy of the provided path.public SimpleDependencyPath(DependencyRelation relation, boolean startFromHead)
SimpleDependencyPath
from a single relation, optionally
starting at the head node of the relation.public SimpleDependencyPath()
public SimpleDependencyPath copy()
public SimpleDependencyPath extend(DependencyRelation relation)
public DependencyTreeNode first()
first
in interface DependencyPath
public DependencyRelation firstRelation()
firstRelation
in interface DependencyPath
public DependencyTreeNode getNode(int position)
getNode
in interface DependencyPath
public String getRelation(int position)
length() - 1
relations in the path.getRelation
in interface DependencyPath
public Iterator<DependencyRelation> iterator()
iterator
in interface DependencyPath
iterator
in interface Iterable<DependencyRelation>
public DependencyTreeNode last()
last
in interface DependencyPath
public DependencyRelation lastRelation()
lastRelation
in interface DependencyPath
public int length()
length() - 1
.length
in interface DependencyPath
Copyright © 2012. All Rights Reserved.