aspect Navigation { // find a type given its package and name (both may contains dots) public TypeDecl Program.findType(String pkg, String name) { String path[] = name.split("\\."); TypeDecl tp = lookupType(pkg, path[0]); if(tp == null) return null; for(int i=1;i iter = tp.memberTypes(path[i]).iterator(); if(!iter.hasNext()) return null; tp = iter.next(); } return tp; } // find a type given its name (may contain dots) public TypeDecl Program.findType(String name) { String path[] = name.split("\\."); String pkg = ""; int i; for(i=0;i iter = tp.memberTypes(path[i]).iterator(); if(!iter.hasNext()) return null; tp = iter.next(); } return tp; } public ConstructorDecl Program.findConstructor(String name) { TypeDecl td = findType(name); if(td != null) return (ConstructorDecl)td.constructors().iterator().next(); return null; } public TypeDecl ASTNode.findSimpleType(String name) { for(int i=0;i Program.sourceMethods() { Collection res = new LinkedList(); collectSourceMethods(res); return res; } protected void ASTNode.collectSourceMethods(Collection res) { for(int i=0;i res) { if(fromSource()) super.collectSourceMethods(res); } protected void MethodDecl.collectSourceMethods(Collection res) { res.add(this); super.collectSourceMethods(res); } // find all source class declarations in a program syn lazy Collection Program.sourceClassDecls() { Collection res = new LinkedList(); collectSourceClassDecls(res); return res; } protected void ASTNode.collectSourceClassDecls(Collection res) { for(int i=0;i res) { if(fromSource()) super.collectSourceClassDecls(res); } protected void ClassDecl.collectSourceClassDecls(Collection res) { res.add(this); super.collectSourceClassDecls(res); } // find all source packages in a program syn lazy Collection Program.sourcePackageDecls() { Collection res = new HashSet(); collectPackageDecls(res); return res; } protected void ASTNode.collectPackageDecls(Collection res) { for(int i=0;i res) { if(fromSource()) res.add(packageName()); } }