aspect JPITypeDecl{ syn boolean JPITypeDecl.hasChildren(){ return hasJPIChildren(this); } inh lazy boolean JPITypeDecl.hasJPIChildren(JPITypeDecl jpiTypeDecl); eq Program.getCompilationUnit().hasJPIChildren(JPITypeDecl jpiTypeDecl){ TypeAccess jpiSuperAccess; for(CompilationUnit cu : getCompilationUnits()){ for(TypeDecl typeDecl : cu.getTypeDecls()){ if(!typeDecl.isJPITypeDecl()){ continue; } jpiSuperAccess = (TypeAccess)((JPITypeDecl)typeDecl).getSuperTypeName(); if (jpiSuperAccess.type().equals(jpiTypeDecl)){ return true; } } } return false; } syn abc.ja.jpi.utils.JPIHierarchyHashMap JPITypeDecl.getHierarchy(){ return getJPIHierarchy(this); } inh lazy abc.ja.jpi.utils.JPIHierarchyHashMap JPITypeDecl.getJPIHierarchy(JPITypeDecl jpiTypeDecl); eq Program.getCompilationUnit().getJPIHierarchy(JPITypeDecl jpiTypeDecl){ TypeAccess jpiSuperAccess; abc.ja.jpi.utils.JPIHierarchyHashMap root = new abc.ja.jpi.utils.JPIHierarchyHashMap(); abc.ja.jpi.utils.JPIHierarchyHashMap children; for(CompilationUnit cu : getCompilationUnits()){ for(TypeDecl typeDecl : cu.getTypeDecls()){ if(!typeDecl.isJPITypeDecl()){ continue; } children = new abc.ja.jpi.utils.JPIHierarchyHashMap(); jpiSuperAccess = (TypeAccess)((JPITypeDecl)typeDecl).getSuperTypeName(); if (jpiSuperAccess.isDummyAccess()){ continue; } if (((JPITypeDecl)((JPITypeAccess)jpiSuperAccess).decl(((JPITypeDecl)typeDecl).getParentParameterTypeList())).equals(jpiTypeDecl)){ children = ((JPITypeDecl)typeDecl).getJPIHierarchy((JPITypeDecl)typeDecl); root.put((JPITypeDecl)typeDecl, children); } } } return root; } syn lazy boolean BodyDecl.isCJPAdviceDecl() = false; eq CJPAdviceDecl.isCJPAdviceDecl() = true; inh lazy Collection JPITypeDecl.getExhibitDecls(JPITypeDecl jpiTypeDecl); syn lazy Collection JPITypeDecl.getExhibitDecls(){ return getExhibitDecls(this); } inh lazy Collection JPITypeDecl.getAllJPITypeDecls(); eq Program.getCompilationUnit().getAllJPITypeDecls() = getAllJPITypeDecls(); public Collection Program.getAllJPITypeDecls(){ HashSet set = new HashSet(); for(CompilationUnit cu : getCompilationUnits()){ for(TypeDecl td : cu.getTypeDecls()){ if(td.isJPITypeDecl()){ set.add((JPITypeDecl)td); } } } return set; } inh lazy Collection JPITypeDecl.getJPIWithoutAdviceDeclaration(); inh lazy Collection JPITypeDecl.getJPIWithAdviceDeclaration(); eq Program.getCompilationUnit().getJPIWithoutAdviceDeclaration(){ Collection jpiWithAdvice = getJPIWithAdviceDeclaration(); HashSet set = new HashSet(); for(JPITypeDecl jpiTypeDecl : getAllJPITypeDecls()){ if(!jpiWithAdvice.contains(jpiTypeDecl)){ set.add(jpiTypeDecl); } } return set; } eq Program.getCompilationUnit().getJPIWithAdviceDeclaration() = getJPIWithAdviceDeclaration(); public Collection Program.getJPIWithAdviceDeclaration(){ HashSet set = new HashSet(); JPITypeDecl jpiTypeDecl; for(CompilationUnit cu : getCompilationUnits()){ for(TypeDecl td : cu.getTypeDecls()){ if(td.isAspectDecl()){ for(BodyDecl bd : ((AspectDecl)td).getBodyDecls()){ if(bd.isCJPAdviceDecl()){ jpiTypeDecl = (JPITypeDecl) ((JPITypeAccess)((CJPAdviceDecl)bd).getName()).decls(((CJPAdviceDecl)bd).getAdviceSpec().getParameterTypeList()); if(!set.contains(jpiTypeDecl)){ set.add(jpiTypeDecl); } } } } } } return set; } public boolean JPITypeDecl.isSubType(JPITypeDecl jpiTypeDecl){ return getJPIHierarchy(jpiTypeDecl).containsKey(this); } }