net.sourceforge.combean.graph.containers
Class MapAsEdgeMap<Val>

Package class diagram package MapAsEdgeMap
java.lang.Object
  extended by net.sourceforge.combean.graph.containers.MapAsEdgeMap<Val>
All Implemented Interfaces:
EdgeMap<Val>, FixedEdgeMap<Val>, Initializable, InitializableWithDefaultValue<Val>

public class MapAsEdgeMap<Val>
extends Object
implements EdgeMap<Val>

A edge map which is based on a standard java.util.Map


Constructor Summary
MapAsEdgeMap()
          Constructor.
MapAsEdgeMap(Map<Edge,Val> jMap)
          Constructor.
 
Method Summary
 Val get(Edge e)
          Get the value of an edge
 void init(Graph g)
          Has to be invoked before the data structure can be used.
 void init(Graph g, Val initVal)
          Has to be invoked before the data structure can be used.
 Val put(Edge e, Val newVal)
          Set the value of an edge
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MapAsEdgeMap

public MapAsEdgeMap()
Constructor. Use java.util.HashMap internally.


MapAsEdgeMap

public MapAsEdgeMap(Map<Edge,Val> jMap)
Constructor. Use a given java.util.Map object internally.

Parameters:
jMap - the java.util.Map to be wrapped
Method Detail

init

public void init(Graph g)
Description copied from interface: EdgeMap
Has to be invoked before the data structure can be used. The data structure may only be used with nodes belonging to the given graph. After init() all edges map to null.

Specified by:
init in interface EdgeMap<Val>
Specified by:
init in interface Initializable
Parameters:
g - the graph for which the EdgeMap shall be defined.

init

public void init(Graph g,
                 Val initVal)
Description copied from interface: InitializableWithDefaultValue
Has to be invoked before the data structure can be used. The data structure may only be used with objects belonging to the given graph. After init() all potential elements of the data structure are set to the given default value.

Specified by:
init in interface InitializableWithDefaultValue<Val>
Parameters:
g - the graph for which the data structure shall be defined.
initVal - the default value with which the data structure shall be initialized

put

public Val put(Edge e,
               Val newVal)
Description copied from interface: EdgeMap
Set the value of an edge

Specified by:
put in interface EdgeMap<Val>
Parameters:
e - the edge for which the value shall be set
newVal - the new value of the edge
Returns:
the old value of the edge (null if no value has been set)

get

public Val get(Edge e)
Description copied from interface: FixedEdgeMap
Get the value of an edge

Specified by:
get in interface FixedEdgeMap<Val>
Parameters:
e - the edge for which the value shall be retrieved
Returns:
the value of the edge (null if no value has been set)