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

Package class diagram package MapAsNodeMap
java.lang.Object
  extended by net.sourceforge.combean.graph.containers.MapAsNodeMap<Val>
All Implemented Interfaces:
Clearable, FixedNodeMap<Val>, Initializable, InitializableWithDefaultValue<Val>, NodeMap<Val>

public class MapAsNodeMap<Val>
extends Object
implements NodeMap<Val>

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


Constructor Summary
MapAsNodeMap()
          Constructor.
MapAsNodeMap(Map<Node,Val> jMap)
          Constructor
 
Method Summary
 void clear()
          remove all elements from the data structure.
 Val get(Node v)
          Get the value of a node
 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(Node v, Val newVal)
          Set the value of a node
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MapAsNodeMap

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


MapAsNodeMap

public MapAsNodeMap(Map<Node,Val> jMap)
Constructor

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

init

public void init(Graph g)
Description copied from interface: Initializable
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 objects in the data structure are set to null.

Specified by:
init in interface Initializable
Parameters:
g - the graph for which the data structure 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

clear

public void clear()
Description copied from interface: Clearable
remove all elements from the data structure.

Specified by:
clear in interface Clearable

put

public Val put(Node v,
               Val newVal)
Description copied from interface: NodeMap
Set the value of a node

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

get

public Val get(Node v)
Description copied from interface: FixedNodeMap
Get the value of a node

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