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( 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( new Strategy("from Cd_graph via Construct to Vertex"), cg); DefinedClassVisitor v1 = new DefinedClassVisitor(); // find defined classes tg1.traverse( cd_graph, v1); // check for violations TBRVisitor v2 = new TBRVisitor(v1.GetDefinedClasses()); tg2.traverse(cd_graph, v2); // 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"); } }