edu.uci.ics.jung.utils
Class ParallelEdgeIndexSingleton

java.lang.Object
  extended by edu.uci.ics.jung.utils.ParallelEdgeIndexSingleton
All Implemented Interfaces:
ParallelEdgeIndexFunction

public class ParallelEdgeIndexSingleton
extends Object
implements ParallelEdgeIndexFunction

A class which creates and maintains indices for parallel edges. Parallel edges are defined here to be those edges of type Edge that are returned by v.findEdgeSet(w) for some v and w.

At this time, users are responsible for resetting the indices if changes to the graph make it appropriate.

Author:
Joshua O'Madadhain

Field Summary
protected  Map edge_index
           
 
Method Summary
protected  Integer getIndex_internal(Edge e, Graph g)
           
 int getIndex(Edge e)
          Returns the index for the specified edge.
static ParallelEdgeIndexFunction getInstance()
           
 void reset()
          Clears all edge indices for all edges in all graphs.
 void reset(Edge e)
          Resets the indices for this edge and its parallel edges.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

edge_index

protected Map edge_index
Method Detail

getInstance

public static ParallelEdgeIndexFunction getInstance()

getIndex

public int getIndex(Edge e)
Returns the index for the specified edge. Calculates the indices for e and for all edges parallel to e.

Specified by:
getIndex in interface ParallelEdgeIndexFunction

getIndex_internal

protected Integer getIndex_internal(Edge e,
                                    Graph g)

reset

public void reset(Edge e)
Resets the indices for this edge and its parallel edges. Should be invoked when an edge parallel to e has been added or removed.

Parameters:
e -

reset

public void reset()
Clears all edge indices for all edges in all graphs. Does not recalculate the indices.