y25.base
Class LayeredGraph.GraphMapImpl

java.lang.Object
  extended byy25.base.LayeredGraph.GraphMapImpl
All Implemented Interfaces:
DataAcceptor, DataProvider, GraphMap
Enclosing class:
LayeredGraph

protected class LayeredGraph.GraphMapImpl
extends Object
implements GraphMap

An Implementation of the GraphMap interface based on a HashMap.


Field Summary
protected  HashMap map
          The HashMap that is used to store key/value pairs.
 
Method Summary
 Object get(Object key)
          Returns the value bound to the given graph.
 boolean getBool(Object graph)
          Returns the boolean value bound to the given graph.
 double getDouble(Object graph)
          Returns the double value bound to the given graph.
 int getInt(Object graph)
          Returns the integer value bound to the given graph.
 Object remove(Object graph)
          Removes the value stored for the given graph, if present.
 void set(Object key, Object value)
          Associates the given value to the given graph.
 void setBool(Object graph, boolean value)
          Associates the given boolean value to the given graph.
 void setDouble(Object graph, double value)
          Associates the given double value to the given graph.
 void setInt(Object graph, int value)
          Associates the given integer value to the given graph.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

map

protected HashMap map
The HashMap that is used to store key/value pairs.

Method Detail

remove

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

Specified by:
remove in interface GraphMap

set

public void set(Object key,
                Object value)
Description copied from interface: GraphMap
Associates the given value to the given graph.

Specified by:
set in interface GraphMap

get

public Object get(Object key)
Description copied from interface: GraphMap
Returns the value bound to the given graph. The value must have been assiciated to the given graph 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 GraphMap

getBool

public boolean getBool(Object graph)
Description copied from interface: GraphMap
Returns the boolean value bound to the given graph. The value must have been assiciated to the given graph 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 GraphMap

getDouble

public double getDouble(Object graph)
Description copied from interface: GraphMap
Returns the double value bound to the given graph. The value must have been assiciated to the given graph 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 GraphMap

getInt

public int getInt(Object graph)
Description copied from interface: GraphMap
Returns the integer value bound to the given graph. The value must have been assiciated to the given graph 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 GraphMap

setBool

public void setBool(Object graph,
                    boolean value)
Description copied from interface: GraphMap
Associates the given boolean value to the given graph.

Specified by:
setBool in interface GraphMap

setDouble

public void setDouble(Object graph,
                      double value)
Description copied from interface: GraphMap
Associates the given double value to the given graph.

Specified by:
setDouble in interface GraphMap

setInt

public void setInt(Object graph,
                   int value)
Description copied from interface: GraphMap
Associates the given integer value to the given graph.

Specified by:
setInt in interface GraphMap