Ejemplo n.º 1
0
 @Override
 public void visit(IndexUnit n, Object arg) {
   for (CompilationUnit unit : n.getCompilationUnits()) {
     visit(unit, arg);
     printer.printLn();
     printer.printLn();
   }
 }
 /**
  * Entry point of recursive-descent IndexUnit to AScene transformer.
  *
  * @param iu {@link IndexUnit} representing stubfile
  * @return {@link AScene} containing annotations from stubfile
  */
 private static void extractScene(IndexUnit iu, AScene scene) {
   for (CompilationUnit cu : iu.getCompilationUnits()) {
     List<TypeDeclaration> typeDecls = cu.getTypes();
     if (typeDecls != null) {
       List<ImportDeclaration> impDecls = cu.getImports();
       PackageDeclaration pkgDecl = cu.getPackage();
       for (TypeDeclaration typeDecl : typeDecls) {
         ToIndexFileConverter converter = new ToIndexFileConverter(pkgDecl, impDecls, scene);
         String pkgName = converter.pkgName;
         String name = typeDecl.getName();
         if (!pkgName.isEmpty()) {
           name = pkgName + "." + name;
         }
         typeDecl.accept(converter, scene.classes.vivify(name));
       }
     }
   }
 }