public void visitAnonymousClassDeclaration(AnonymousClassDeclaration node) { if (node.getBaseClass() != null) { visit(node.getBaseClass()); } for (TypeIterator iter = node.getBaseInterfaces().getIterator(); iter.hasNext(); ) { visit(iter.getNext()); } for (TypeDeclarationIterator iter = node.getInnerTypes().getIterator(); iter.hasNext(); ) { visit(iter.getNext()); } for (FieldIterator iter = node.getFields().getIterator(); iter.hasNext(); ) { visit(iter.getNext()); } for (InitializerIterator iter = node.getInitializers().getIterator(); iter.hasNext(); ) { visit(iter.getNext()); } for (MethodIterator iter = node.getMethods().getIterator(); iter.hasNext(); ) { visit(iter.getNext()); } }
public boolean hasChildrenIn(Project prj) { for (PackageIterator pkgIter = prj.getPackages().getIterator(); pkgIter.hasNext(); ) { for (TypeDeclarationIterator typeIter = pkgIter.getNext().getTypes().getIterator(); typeIter.hasNext(); ) { if (isChild(typeIter.getNext())) { return true; } } } return false; }
public void visitCompilationUnit(CompilationUnit node) { // visit package visit(node.getPackage()); // visit imports for (ImportIterator iter = node.getImportDeclarations().getIterator(); iter.hasNext(); ) { visit(iter.getNext()); } // visit interfaces and Classes for (TypeDeclarationIterator iter = node.getTypeDeclarations().getIterator(); iter.hasNext(); ) { visit(iter.getNext()); } }
public MethodArray getInheritedMethods() { MethodArray result = new MethodArrayImpl(); MethodDeclaration curMeth; for (TypeDeclarationIterator typeIter = getAncestors().getIterator(); typeIter.hasNext(); ) { for (MethodIterator methIter = typeIter.getNext().getMethods().getIterator(); methIter.hasNext(); ) { curMeth = methIter.getNext(); if (isVisible(curMeth) && !isRedefined(curMeth)) { result.add(curMeth); } } } return result; }
public FieldArray getInheritedFields() { FieldArray result = new FieldArrayImpl(); FieldDeclaration curField; for (TypeDeclarationIterator typeIter = getAncestors().getIterator(); typeIter.hasNext(); ) { for (FieldIterator fieldIter = typeIter.getNext().getFields().getIterator(); fieldIter.hasNext(); ) { curField = fieldIter.getNext(); if (isVisible(curField) && !isRedefined(curField)) { result.add(curField); } } } return result; }
public TypeDeclarationArray getChildren(boolean onlyDirect) { TypeDeclarationArray result = new TypeDeclarationArrayImpl(); Project project = ASTHelper.getProjectOf(_localType); Hashtable knownSubTypes = new Hashtable(); Hashtable finishedTypes = new Hashtable(); for (PackageIterator pkgIt = project.getPackages().getIterator(); pkgIt.hasNext(); ) { for (TypeDeclarationIterator typeIt = pkgIt.getNext().getTypes().getIterator(); typeIt.hasNext(); ) { checkForSubType(typeIt.getNext(), knownSubTypes, finishedTypes, !onlyDirect); } } for (Enumeration en = knownSubTypes.elements(); en.hasMoreElements(); ) { result.add((TypeDeclaration) en.nextElement()); } return result; }
public void visitClassDeclaration(ClassDeclaration node) { // visit modifiers visit(node.getModifiers()); if (node.getBaseClass() != null) { // visit extended class (type) visit(node.getBaseClass()); } // visit implemented interfaces (types) for (TypeIterator iter = node.getBaseInterfaces().getIterator(); iter.hasNext(); ) { visit(iter.getNext()); } // visit inner classes (types) for (TypeDeclarationIterator iter = node.getInnerTypes().getIterator(); iter.hasNext(); ) { visit(iter.getNext()); } // visit field declarations for (FieldIterator iter = node.getFields().getIterator(); iter.hasNext(); ) { visit(iter.getNext()); } // visit initializers for (InitializerIterator iter = node.getInitializers().getIterator(); iter.hasNext(); ) { visit(iter.getNext()); } // visit constructor declarations for (ConstructorIterator iter = node.getConstructors().getIterator(); iter.hasNext(); ) { visit(iter.getNext()); } // visit method declarations for (MethodIterator iter = node.getMethods().getIterator(); iter.hasNext(); ) { visit(iter.getNext()); } }
public void visitInterfaceDeclaration(InterfaceDeclaration node) { // visit modifiers visit(node.getModifiers()); // visit implemented interfaces (types) for (TypeIterator iter = node.getBaseInterfaces().getIterator(); iter.hasNext(); ) { visit(iter.getNext()); } // visit inner classes (types) for (TypeDeclarationIterator iter = node.getInnerTypes().getIterator(); iter.hasNext(); ) { visit(iter.getNext()); } // visit field declarations for (FieldIterator iter = node.getFields().getIterator(); iter.hasNext(); ) { visit(iter.getNext()); } // visit methods declarations for (MethodIterator iter = node.getMethods().getIterator(); iter.hasNext(); ) { visit(iter.getNext()); } }