package edu.neu.ccs.demeter.dj; import java.util.*; /** * Thrown when creating an object graph slice from a traversal T and * an object graph whose root is not an instance of a class in the * start set of T. */ public class TraversalSourceException extends RuntimeException { TraversalSourceException(Object root, Traversal t) { super("Object graph root is " + root.getClass() + ", traversal sources are " + getStartNodes(t)); } static List getStartNodes(Traversal t) { // I sure wish this were Scheme: // (map get-node (get-start-node-sets this)) List nodes = new ArrayList(); for (Iterator it = t.getStartSet().iterator(); it.hasNext();) nodes.add(((Traversal.NodeSet) it.next()).getNode()); return nodes; } }