edu.neu.ccs.demeter.dj
Class ObjectGraph

java.lang.Object
  |
  +--edu.neu.ccs.demeter.dj.ObjectGraph

public class ObjectGraph
extends Object

A graph whose nodes are objects and whose edges are part-of relationships (properties), with a single distinguished root object. An object graph has a class graph to which it conforms.


Field Summary
protected  ClassGraph cg
           
protected  Object root
           
 
Constructor Summary
ObjectGraph(Object o, ClassGraph c)
          The object graph rooted at o with respect to c.
 
Method Summary
 List asList(Strategy s)
          View (without copying) the objects in the object graph corresponding to the target of s as a List.
 List asList(String s)
          View (without copying) the objects in the object graph corresponding to the target of strategy s as a List.
 Object fetch(Strategy s)
          Fetch the object in the object graph corresponding to the target of s.
 Object fetch(String s)
          Fetch the object in the object graph corresponding to the target of stragegy s.
 List gather(Strategy s)
          Gather (copy) the objects in the object graph corresponding to the target of s into a List.
 List gather(String s)
          Gather (copy) the objects in the object graph corresponding to the target of strategy s into a List.
 ClassGraph getClassGraph()
          The class graph that this object graph is an instance of.
 Object getRoot()
          The root of the graph.
 ObjectGraphSlice slice(Strategy s)
          The subgraph of the object graph determined by s.
 ObjectGraphSlice slice(String s)
          The subgraph of the object graph determined by strategy s.
 Object traverse(Strategy s, Visitor v)
          Traverse the subgraph of the object graph determined by s using v, returning the value of v.getReturnValue() at the end of the traversal.
 Object traverse(Strategy s, Visitor[] v)
          Traverse the subgraph of the object graph determined by s using visitors in array v in parallel, returning the value of v[0].getReturnValue() at the end of the traversal.
 Object traverse(String s, Visitor v)
          Traverse the subgraph of the object graph determined by strategy s using v, returning the value of v.getReturnValue() at the end of the traversal.
 Object traverse(String s, Visitor[] v)
          Traverse the subgraph of the object graph determined by strategy s using visitors in array v in parallel, returning the value of v[0].getReturnValue() at the end of the traversal.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

cg

protected ClassGraph cg

root

protected Object root
Constructor Detail

ObjectGraph

public ObjectGraph(Object o,
                   ClassGraph c)
The object graph rooted at o with respect to c.

Method Detail

getClassGraph

public ClassGraph getClassGraph()
The class graph that this object graph is an instance of.


getRoot

public Object getRoot()
The root of the graph.


slice

public ObjectGraphSlice slice(Strategy s)
The subgraph of the object graph determined by s.


traverse

public Object traverse(Strategy s,
                       Visitor v)
Traverse the subgraph of the object graph determined by s using v, returning the value of v.getReturnValue() at the end of the traversal.


traverse

public Object traverse(Strategy s,
                       Visitor[] v)
Traverse the subgraph of the object graph determined by s using visitors in array v in parallel, returning the value of v[0].getReturnValue() at the end of the traversal.


fetch

public Object fetch(Strategy s)
             throws FetchException
Fetch the object in the object graph corresponding to the target of s.

FetchException

gather

public List gather(Strategy s)
Gather (copy) the objects in the object graph corresponding to the target of s into a List.


asList

public List asList(Strategy s)
View (without copying) the objects in the object graph corresponding to the target of s as a List.


slice

public ObjectGraphSlice slice(String s)
The subgraph of the object graph determined by strategy s.


traverse

public Object traverse(String s,
                       Visitor v)
Traverse the subgraph of the object graph determined by strategy s using v, returning the value of v.getReturnValue() at the end of the traversal.


traverse

public Object traverse(String s,
                       Visitor[] v)
Traverse the subgraph of the object graph determined by strategy s using visitors in array v in parallel, returning the value of v[0].getReturnValue() at the end of the traversal.


fetch

public Object fetch(String s)
             throws FetchException
Fetch the object in the object graph corresponding to the target of stragegy s.

FetchException

gather

public List gather(String s)
Gather (copy) the objects in the object graph corresponding to the target of strategy s into a List.


asList

public List asList(String s)
View (without copying) the objects in the object graph corresponding to the target of strategy s as a List.