コード例 #1
0
ファイル: InheritanceAnalyzer.java プロジェクト: Wattos/JArt
  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;
  }
コード例 #2
0
ファイル: InheritanceAnalyzer.java プロジェクト: Wattos/JArt
  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;
  }