y25.base
Interface NodeMap

All Superinterfaces:
DataAcceptor, DataProvider, NodeMap
All Known Implementing Classes:
LayeredGraph.NodeMapImpl

public interface NodeMap
extends NodeMap

Provides access to data associated with a node. A node map can be considered as a map that allows only nodes as keys. The nodes used as keys for the getter/setter methods must belong to the same layered graph.

The values bound to the nodes are initialized with Java(TM) default values(null, 0, 0.0, false) upon initialization.

This interface exists primarily because the original interface y.base.NodeMap only allows nodes that belong to the same graph as keys. This restriction is not posed by this interface. When working with layered graphs, there might be a situation where one NodeMap should store information about nodes from different graphs (wich all belong to the same layered graph) - and this is where this interface comes into play.

There is also another reason why this interface exists: orthogonality. The newly defined interfaces GraphMap and LayerEdgeMap both have a remove method, which is not true for the original y.base.NodeMap or y.base.EdgeMap.


Method Summary
 Object get(Object node)
          Returns the value bound to the given node.
 boolean getBool(Object node)
          Returns the boolean value bound to the given node.
 double getDouble(Object node)
          Returns the double value bound to the given node.
 int getInt(Object node)
          Returns the integer value bound to the given node.
 Object remove(Object node)
          Removes the value stored for the given node, if present.
 void set(Object node, Object value)
          Associates the given value to the given node.
 void setBool(Object node, boolean value)
          Associates the given boolean value to the given node.
 void setDouble(Object node, double value)
          Associates the given double value to the given node.
 void setInt(Object node, int value)
          Associates the given integer value to the given node.
 

Method Detail

remove

public Object remove(Object node)
Removes the value stored for the given node, if present. Returns the value that was previously stored for the graph, or null if there was no mapping for that node. A null return can also mean that the map previously associated null with the given node.


get

public Object get(Object node)
Returns the value bound to the given node. The value must have been assiciated to the given node by a call to set.

Returns null if the map contains no mapping for this key. A return value of null does not necessarily indicate that the map contains no mapping for the key; it is also possible that the map explicitly maps the key to null.

Specified by:
get in interface NodeMap

getBool

public boolean getBool(Object node)
Returns the boolean value bound to the given node. The value must have been assiciated to the given node by a call to setBool.

Returns false if the map contains no mapping for this key. A return value of false does not necessarily indicate that the map contains no mapping for the key; it is also possible that the map explicitly maps the key to false.

Specified by:
getBool in interface NodeMap

getDouble

public double getDouble(Object node)
Returns the double value bound to the given node. The value must have been assiciated to the given node by a call to setDouble.

Returns 0.0 if the map contains no mapping for this key. A return value of 0.0 does not necessarily indicate that the map contains no mapping for the key; it is also possible that the map explicitly maps the key to 0.0.

Specified by:
getDouble in interface NodeMap

getInt

public int getInt(Object node)
Returns the integer value bound to the given node. The value must have been assiciated to the given node by a call to setInt.

Returns 0 if the map contains no mapping for this key. A return value of 0 does not necessarily indicate that the map contains no mapping for the key; it is also possible that the map explicitly maps the key to 0.

Specified by:
getInt in interface NodeMap

set

public void set(Object node,
                Object value)
Associates the given value to the given node.

Specified by:
set in interface NodeMap

setBool

public void setBool(Object node,
                    boolean value)
Associates the given boolean value to the given node.

Specified by:
setBool in interface NodeMap

setDouble

public void setDouble(Object node,
                      double value)
Associates the given double value to the given node.

Specified by:
setDouble in interface NodeMap

setInt

public void setInt(Object node,
                   int value)
Associates the given integer value to the given node.

Specified by:
setInt in interface NodeMap