public class DefaultMutablePath<V extends Vertex,E extends Edge<V>> extends java.lang.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.
|
java.util.List<E> |
edges()
Returns the list of edges comprising the path.
|
boolean |
equals(java.lang.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.
|
java.lang.String |
toString() |
public Weight cost()
Pathpublic java.util.List<E> edges()
Pathpublic void setCost(Weight cost)
MutablePathpublic Path<V,E> toImmutable()
MutablePathtoImmutable in interface MutablePath<V extends Vertex,E extends Edge<V>>public void insertEdge(E edge)
MutablePathinsertEdge in interface MutablePath<V extends Vertex,E extends Edge<V>>edge - edge to be insertedpublic void appendEdge(E edge)
MutablePathappendEdge in interface MutablePath<V extends Vertex,E extends Edge<V>>edge - edge to be insertedpublic void removeEdge(E edge)
MutablePathremoveEdge in interface MutablePath<V extends Vertex,E extends Edge<V>>edge - edge to be removedpublic java.lang.String toString()
toString in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Objectpublic boolean equals(java.lang.Object obj)
equals in class java.lang.Object