aspect Queries { public void Program.runQueries() { ArrayList list = new ArrayList(); Iterator iter = types().iterator(); long t1 = System.currentTimeMillis(); while(iter.hasNext()) { TypeDecl t = (TypeDecl)iter.next(); list.add( t.typeName() + ", WMC: " + t.getNumberMethods() + ", DIT: " + t.getDepthOfInheritanceTree() + ", NOC: " + t.getNumberOfChildren() + ", CBO: " + t.getCouplingBetweenObjectClasses() + ", RFC: " + t.getResponseForClass() + ", LCOM: " + t.getLackOfCohesion() + ", NPM: " + t.getNumberPublicMethods() + ", Ca: " + t.getAfferentCoupling() ); } long t2 = System.currentTimeMillis(); System.out.println("Result: " + (t2-t1) + " ms"); Collections.sort(list); for(Iterator i2 = list.iterator(); i2.hasNext(); ) { System.out.println(i2.next()); } } coll HashSet Program.types() [new HashSet()] with add; ClassDecl contributes this /*when packageName().startsWith("org.w3c.www")*/ to Program.types() for root(); InterfaceDecl contributes this /*when packageName().startsWith("org.w3c.www")*/ to Program.types() for root(); eq Program.getCompilationUnit().fromSource() = false; eq CompilationUnit.getTypeDecl(int i).fromSource() = fromSource(); inh boolean TypeDecl.fromSource(); inh Program TypeDecl.root(); inh Program CompilationUnit.root(); eq Program.getCompilationUnit().root() = this; // visit all children to trigger all rewrites public void ASTNode.visitAll() { for(int i = 0; i < getNumChild(); i++) getChild(i).visitAll(); } // bytecode classes result in class signatures that // may use other types. These types need to be loaded // transitively to avoid later class loading. Each // TypeAccess therefore trigger its binding which // may cause that type to be loaded. public void TypeAccess.visitAll() { decl(); super.visitAll(); } }