Package edu.uci.ics.jung.graph.util
Class DefaultParallelEdgeIndexFunction<V,E>
- java.lang.Object
-
- edu.uci.ics.jung.graph.util.DefaultParallelEdgeIndexFunction<V,E>
-
- All Implemented Interfaces:
EdgeIndexFunction<V,E>
public class DefaultParallelEdgeIndexFunction<V,E> extends java.lang.Object implements EdgeIndexFunction<V,E>
A class which creates and maintains indices for parallel edges. Parallel edges are defined here to be the collection of edges that are returned byv.findEdgeSet(w)for somevandw.At this time, users are responsible for resetting the indices (by calling
reset()) if changes to the graph make it appropriate.
-
-
Constructor Summary
Constructors Modifier Constructor Description privateDefaultParallelEdgeIndexFunction()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description intgetIndex(Graph<V,E> graph, E e)Returns the index foreingraph.protected intgetIndex(Graph<V,E> graph, E e, V v)protected intgetIndex(Graph<V,E> graph, E e, V v, V u)static <V,E>
DefaultParallelEdgeIndexFunction<V,E>getInstance()voidreset()Clears all edge indices for all edges in all graphs.voidreset(Graph<V,E> graph, E e)Resets the indices for this edge and its parallel edges.
-
-
-
Method Detail
-
getInstance
public static <V,E> DefaultParallelEdgeIndexFunction<V,E> getInstance()
- Type Parameters:
V- the vertex typeE- the edge type- Returns:
- an instance of this class
-
getIndex
public int getIndex(Graph<V,E> graph, E e)
Returns the index foreingraph. Calculates the indices foreand for all edges parallel toe, if they are not already assigned.- Specified by:
getIndexin interfaceEdgeIndexFunction<V,E>- Parameters:
graph- the graph with respect to which the index is calculatede- the edge whose index is to be queried- Returns:
e's index ingraph
-
reset
public void reset(Graph<V,E> graph, E e)
Resets the indices for this edge and its parallel edges. Should be invoked when an edge parallel toehas been added or removed.- Specified by:
resetin interfaceEdgeIndexFunction<V,E>- Parameters:
graph- the graph for which the indices are to be resete- the edge whose indices are to be reset
-
reset
public void reset()
Clears all edge indices for all edges in all graphs. Does not recalculate the indices.- Specified by:
resetin interfaceEdgeIndexFunction<V,E>
-
-