public static int run()

in modules/jdktools/src/main/java/org/apache/harmony/tools/javap/Main.java [183:281]


    public static int run(Map options, Set classNames) {
        String bootClasspath = getString(options, "-bootclasspath");
        String classpath = getString(options, "-classpath");

        boolean c = getBoolean(options, "-c");
        boolean l = getBoolean(options, "-l");
        boolean s = getBoolean(options, "-s");
        boolean pack = getBoolean(options, "-package");
        boolean pub = getBoolean(options, "-public");
        boolean prot = getBoolean(options, "-protected");
        boolean priv = getBoolean(options, "-private");

        // The default option is "-package".
        if (!pub && !prot && !priv) {
            pack = true;
        }

        // Show all classes and their members.
        if (priv) {
            pack = true;
        }
        // Show package private, protected and public classes and their members.
        if (pack) {
            prot = true;
        }
        // Show protected and public classes and their members.
        if (prot) {
            pub = true;
        }

        boolean inner = getBoolean(options, "-inner");
        boolean verbose = getBoolean(options, "-verbose");

        ClassProvider classProvider = new ClassProvider(bootClasspath,
                classpath, verbose);

        StringBuffer result = new StringBuffer();
        try {
            String n = System.getProperty("line.separator");

            Set innerNames = new HashSet();
            Iterator namesIter = classNames.iterator();
            while (namesIter.hasNext()) {

                // Parse the next class.
                Clazz clazz = new Clazz(classProvider,
                        (String) namesIter.next(), verbose);

                // Set the output filter before we call clazz.toString().
                clazz.includeCode(c);
                clazz.includeLineNumbers(l);
                clazz.includeLocalVariables(l);
                clazz.includeTypeSignatures(s);
                clazz.includePackagePrivate(pack);
                clazz.includePublic(pub);
                clazz.includeProtected(prot);
                clazz.includePrivate(priv);

                if (inner) {
                    // Get the inner class names and store them 
                    // in a separate set.
                    String innerClassNames[] = clazz.getInnerClassNames();
                    for (int i = 0; i < innerClassNames.length; i++) {
                        innerNames.add(innerClassNames[i]);
                    }
                }

                // Process the next class.
                result.append(clazz.toString());
                result.append(n);

                // Process the inner class names, if any.
                if (!namesIter.hasNext() && !innerNames.isEmpty()) {
                    // Remove the inner class names that have already
                    // been processed.
                    innerNames.removeAll(classNames);

                    // Reset the loop iterator.
                    classNames = new HashSet(innerNames);
                    namesIter = classNames.iterator();

                    // Clear the set of the inner class names.
                    innerNames.clear();
                    inner = false;
                }

            }

        } catch (Exception e) {
            System.err.println("Error:");
            e.printStackTrace();
            return 1;
        }

        // Print the result.
        System.out.print(result.toString());

        return 0;
    }