de.grogra.graph
Class GraphState.ObjectContext

java.lang.Object
  extended by de.grogra.graph.GraphState.ObjectContext
Enclosing class:
GraphState

public static final class GraphState.ObjectContext
extends java.lang.Object

This class represents an object context. A graph state has a current object context which is obtained by GraphState.getObjectContext() and set by GraphState.setObjectContext(Object, boolean) and GraphState.setObjectContext(ObjectContext). An object context consists of two parts:

  1. An object of the graph (getObject(), isNode())
  2. A usual key-value-map which associates arbitrary information to the keys within this object context. This map should be used only for caching purposes, because it is cleared by the invocation of GraphState.setObjectContext(Object, boolean). The map uses == to compare keys.

Author:
Ole Kniemeyer

Method Summary
 java.lang.Object getObject()
          Returns the object of this context.
 java.lang.Object getValue(java.lang.Object owner)
          Returns the value associated with owner.
 boolean isNode()
          Defines whether this object context specifies a node or an edge.
 void setValue(java.lang.Object owner, java.lang.Object value)
          Associates a value with an owner in the context map.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getObject

public java.lang.Object getObject()
Returns the object of this context.

Returns:
an object of the graph

getValue

public java.lang.Object getValue(java.lang.Object owner)
Returns the value associated with owner.

Parameters:
owner - a key for the context map
Returns:
the associated value, or null

isNode

public boolean isNode()
Defines whether this object context specifies a node or an edge.

Returns:
true if getObject() returns a node, false if it returns an edge

setValue

public void setValue(java.lang.Object owner,
                     java.lang.Object value)
Associates a value with an owner in the context map.

Parameters:
owner - a key for the context map
value - the new value to associate with owner