Package org.onlab.graph
Class DefaultMutablePath<V extends Vertex,E extends Edge<V>>
- java.lang.Object
- 
- org.onlab.graph.DefaultMutablePath<V,E>
 
- 
- All Implemented Interfaces:
- Edge<V>,- MutablePath<V,E>,- Path<V,E>
 
 public class DefaultMutablePath<V extends Vertex,E extends Edge<V>> extends java.lang.Object implements MutablePath<V,E> Simple concrete implementation of a directed graph path.
- 
- 
Constructor SummaryConstructors Constructor Description DefaultMutablePath()Creates a new empty path.DefaultMutablePath(Path<V,E> path)Creates a new path as a copy of another path.
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description voidappendEdge(E edge)Appends a new edge at the end of the this path.Weightcost()Returns the total cost of the path as a weight object.Vdst()Returns the edge destination vertex.java.util.List<E>edges()Returns the list of edges comprising the path.booleanequals(java.lang.Object obj)inthashCode()voidinsertEdge(E edge)Inserts a new edge at the beginning of this path.voidremoveEdge(E edge)Removes the specified edge.voidsetCost(Weight cost)Sets the total path cost as a weight object.Vsrc()Returns the edge source vertex.Path<V,E>toImmutable()Returns an immutable copy of this path.java.lang.StringtoString()
 
- 
- 
- 
Method Detail- 
costpublic Weight cost() Description copied from interface:PathReturns the total cost of the path as a weight object.
 - 
edgespublic java.util.List<E> edges() Description copied from interface:PathReturns the list of edges comprising the path. Adjacent edges will share the same vertex, meaning that a source of one edge, will be the same as the destination of the prior edge.
 - 
setCostpublic void setCost(Weight cost) Description copied from interface:MutablePathSets the total path cost as a weight object.
 - 
toImmutablepublic Path<V,E> toImmutable() Description copied from interface:MutablePathReturns an immutable copy of this path.- Specified by:
- toImmutablein interface- MutablePath<V extends Vertex,E extends Edge<V>>
- Returns:
- immutable copy
 
 - 
insertEdgepublic void insertEdge(E edge) Description copied from interface:MutablePathInserts a new edge at the beginning of this path. The edge must be adjacent to the prior start of the path.- Specified by:
- insertEdgein interface- MutablePath<V extends Vertex,E extends Edge<V>>
- Parameters:
- edge- edge to be inserted
 
 - 
appendEdgepublic void appendEdge(E edge) Description copied from interface:MutablePathAppends a new edge at the end of the this path. The edge must be adjacent to the prior end of the path.- Specified by:
- appendEdgein interface- MutablePath<V extends Vertex,E extends Edge<V>>
- Parameters:
- edge- edge to be inserted
 
 - 
removeEdgepublic void removeEdge(E edge) Description copied from interface:MutablePathRemoves the specified edge. This edge must be either at the start or at the end of the path, or it must be a cyclic edge in order not to violate the contiguous path property.- Specified by:
- removeEdgein interface- MutablePath<V extends Vertex,E extends Edge<V>>
- Parameters:
- edge- edge to be removed
 
 - 
toStringpublic java.lang.String toString() - Overrides:
- toStringin class- java.lang.Object
 
 - 
hashCodepublic int hashCode() - Overrides:
- hashCodein class- java.lang.Object
 
 - 
equalspublic boolean equals(java.lang.Object obj) - Overrides:
- equalsin class- java.lang.Object
 
 
- 
 
-