Пример #1
0
 @Override
 public void visit(PackageDeclaration n, Object arg) {
   printMemberAnnotations(n.getAnnotations(), arg);
   printer.print("package ");
   n.getName().accept(this, arg);
   printer.printLn(";");
   printer.printLn();
 }
 /**
  * @param pkgDecl AST node for package declaration
  * @param importDecls AST node for import declarations
  * @param scene scene for visitor methods to fill in
  */
 public ToIndexFileConverter(
     PackageDeclaration pkgDecl, List<ImportDeclaration> importDecls, AScene scene) {
   this.scene = scene;
   if (pkgDecl == null) {
     pkgName = "";
   } else {
     Matcher m = packagePattern.matcher(pkgDecl.toString());
     String s = m.find() ? m.group(1) : null;
     pkgName = s == null ? "" : s;
   }
   if (importDecls == null) {
     imports = Collections.emptyList();
   } else {
     ArrayList<String> imps = new ArrayList<String>(importDecls.size());
     for (ImportDeclaration decl : importDecls) {
       if (!decl.isStatic()) {
         Matcher m = importPattern.matcher(decl.toString());
         if (m.find()) {
           String s = m.group(1);
           if (s != null) {
             imps.add(s);
           }
         }
       }
     }
     imps.trimToSize();
     imports = Collections.unmodifiableList(imps);
   }
 }