Main { public static void main(String args[]) throws Exception {{ Blackboard m = Blackboard.parse(System.in); m.simple(); System.out.println(" done "); ClassGraph cg = new ClassGraph(false, true); ClassGraph cgWithoutTail = new ClassGraph(cg, "from Blackboard bypassing -> *,tail,* to *"); cg = cgWithoutTail; // m.clauseTypes(cg); m.doCT(); }} } Blackboard { {{ void simple(){ System.out.println(" example ") ;} }} } CTVisitor { init {{ }} before Derivative{{ System.out.println(host.get_name().get_name()); }} before RawMaterial {{ }} before Clause {{ host.print(); pos = 0; neg = 0; }} before PosLiteral {{ pos ++; }} before NegLiteral {{ neg ++; }} after Clause {{ System.out.println(" CLAUSE TYPE clause length = " + (pos + neg) + " pos " + pos); }} finish {{ }} } Clause { void print() to * (PrintVisitor); } Blackboard { // traversal CTtrav(CTVisitor) { // via Store via Derivative to RawMaterial;} void doCT() via Store via Derivative via RawMaterial to {PosLiteral, NegLiteral} (CTVisitor); } Blackboard { {{ void clauseTypes(ClassGraph cg){ cg.traverse(this,"from Blackboard via Store via Derivative via RawMaterial to {PosLiteral,NegLiteral}", new Visitor(){ public void before(Derivative host){ System.out.println(host.get_name().get_name()); } }); } }} }