public class DefaultMutablePath<V extends Vertex,E extends Edge<V>> extends Object implements MutablePath<V,E>
Constructor and Description |
---|
DefaultMutablePath()
Creates a new empty path.
|
DefaultMutablePath(Path<V,E> path)
Creates a new path as a copy of another path.
|
Modifier and Type | Method and Description |
---|---|
void |
appendEdge(E edge)
Appends a new edge at the end of the this path.
|
Weight |
cost()
Returns the total cost of the path as a weight object.
|
V |
dst()
Returns the edge destination vertex.
|
List<E> |
edges()
Returns the list of edges comprising the path.
|
boolean |
equals(Object obj) |
int |
hashCode() |
void |
insertEdge(E edge)
Inserts a new edge at the beginning of this path.
|
void |
removeEdge(E edge)
Removes the specified edge.
|
void |
setCost(Weight cost)
Sets the total path cost as a weight object.
|
V |
src()
Returns the edge source vertex.
|
Path<V,E> |
toImmutable()
Returns an immutable copy of this path.
|
String |
toString() |
public Weight cost()
Path
public List<E> edges()
Path
public void setCost(Weight cost)
MutablePath
public Path<V,E> toImmutable()
MutablePath
toImmutable
in interface MutablePath<V extends Vertex,E extends Edge<V>>
public void insertEdge(E edge)
MutablePath
insertEdge
in interface MutablePath<V extends Vertex,E extends Edge<V>>
edge
- edge to be insertedpublic void appendEdge(E edge)
MutablePath
appendEdge
in interface MutablePath<V extends Vertex,E extends Edge<V>>
edge
- edge to be insertedpublic void removeEdge(E edge)
MutablePath
removeEdge
in interface MutablePath<V extends Vertex,E extends Edge<V>>
edge
- edge to be removed