import edu.neu.ccs.demeter.*; import edu.neu.ccs.demeter.dj.*; /* Input: B = A A. */ class Main { public static void main(String[] args) { // Adj: B = A A Vertex vertA = new Vertex(new Ident("A")); Vertex vertB = new Vertex(new Ident("B")); Construct construct = new Construct(new Labeled_vertex(new Ident("b"), vertA ), new Labeled_vertex(new Ident("c"), vertA)); Cd_graph cd_graph = new Cd_graph( new Adj(vertB, construct)); // THE FOLLOWING IDENTICAL IN BOTH PROGRAMS ClassGraph cg=new ClassGraph(); System.out.println("The DJ version is: " + cg.getVersion()); System.out.println("The class graph is" + "============================="); System.out.println(cg); System.out.println("end class graph " + "============================="); // The purpose of traversal tg1 is to // collect all the class names that are defined // in the cd TraversalGraph tg1 = new TraversalGraph( "from Cd_graph to Adj", cg); // new Strategy("from Cd_graph to Adj"), cg); // The purpose of traversal tg2 is to // visit all parts of all classes TraversalGraph tg2 = new TraversalGraph( "from Cd_graph via Construct to Vertex", cg); // new Strategy("from Cd_graph via Construct to Vertex"), cg); cd_graph.TBRchecker(tg1,tg2); // for the object slice version // select the object slices for this particular class graph // and object graph ObjectGraphSlice ogs1 = new ObjectGraphSlice(cd_graph,tg1); ObjectGraphSlice ogs2 = new ObjectGraphSlice(cd_graph,tg2); cd_graph.TBRchecker2(ogs1,ogs2); //Alternative ObjectGraph og = new ObjectGraph(cd_graph,cg); ObjectGraphSlice ogs11 = new ObjectGraphSlice(og,"from Cd_graph to Adj"); ObjectGraphSlice ogs21 = new ObjectGraphSlice(og, "from Cd_graph via Construct to Vertex"); cd_graph.TBRchecker2(ogs11,ogs21); cd_graph.TBRchecker2( new ObjectGraphSlice(og,"from Cd_graph to Adj"), new ObjectGraphSlice(og,"from Cd_graph via Construct to Vertex")); // for diagnostic reasons: print the traversal structure System.out.println("The traversal graph tg1 is "); System.out.println(tg1); System.out.println("end traversal graph "); System.out.println("The summarized traversal graph of tg1 is"); System.out.println(tg1.toClassGraph()); System.out.println("end summarized traversal graph "); System.out.println("The traversal graph tg2 is "); System.out.println(tg2); System.out.println("end traversal graph "); System.out.println("The summarized traversal graph of tg2 is"); System.out.println(tg2.toClassGraph()); System.out.println("end summarized traversal graph "); System.out.println("SUCCESS"); } }