mjc

org.multijava.mjdoc.mjdoc_142
Class Main

java.lang.Object
  extended byorg.multijava.util.Utils
      extended byorg.multijava.util.compiler.Compiler
          extended byorg.multijava.mjc.Main
              extended byorg.multijava.mjdoc.mjdoc_142.Main
All Implemented Interfaces:
Cloneable, TroubleReporter

public class Main
extends Main

This class implements the entry point of the mjdoc tool. It extends the Main class of the multijava compiler. Use java org.multijava.mjdoc.Main --help to get usage options.

Author:
David R. Cok

Nested Class Summary
 class Main.MjdocTask
          This task creates MjDoc objects that hold all relevant information about classes/methods/interfaces/packages/etc for generating html.
 
Nested classes inherited from class org.multijava.mjc.Main
Main.CheckInitializerTask, Main.CheckInterfaceTask, Main.ContextBehavior, Main.DFilter, Main.ExpectedGF, Main.ExpectedIndifferent, Main.ExpectedResult, Main.ExpectedType, Main.Filter, Main.ParseTask, Main.PreprocessTask, Main.PrettyPrintTask, Main.ResolveSpecializerTask, Main.ResolveTopMethodTask, Main.Task, Main.TaskTimes, Main.TranslateMJTask, Main.TreeProcessingTask, Main.Trees, Main.TypecheckTask
 
Field Summary
protected  ArrayList packageList
          ArrayList (of String) of command-line arguments that are packages ('/'-separated and terminated name).
 
Fields inherited from class org.multijava.mjc.Main
activeSequenceID, activeTaskPriority, allowUniverseAnnotations, allowUniverseBytecode, allowUniverseChecks, allowUniverseDynChecks, allowUniverseKeywords, allowUniversePurity, appName, classes, codeGenNeeded, contextsCreated, destination, errorFound, errorLimit, filesFound, mostSevereWarningIssued, options, parseJavadoc, PRI_CHECK_INITIALIZER, PRI_CHECK_INTERFACE, PRI_PARSE, PRI_PREPROCESS, PRI_PRETTY_PRINT, PRI_RESOLVE_SPECIALIZER, PRI_TOP_METHODS, PRI_TRANSLATE_MJ, PRI_TYPECHECK, taskQueue, uncheckedWarningsIssued, UNIVERSE_ANNOTATIONS, UNIVERSE_BYTECODE, UNIVERSE_CHECKS, UNIVERSE_DYNCHECKS, UNIVERSE_FULL, UNIVERSE_NO, UNIVERSE_PARSE, UNIVERSE_PURITY, universeVersion
 
Fields inherited from class org.multijava.util.compiler.Compiler
PRINT_TO_ERR, PRINT_TO_OUT
 
Fields inherited from class org.multijava.util.Utils
DBG_LEVEL_HIGH, DBG_LEVEL_LOW, DBG_LEVEL_NO
 
Constructor Summary
  Main()
          The principal constructor for an object to do the work of the mjdoc tool.
protected Main(ModifierUtility modUtil)
          Construct a mjdoc tool (an object of Main) that uses the given ModifierUtility.
 
Method Summary
protected  void addRecursivePackages(String packageName, File dir, ArrayList dirs)
          This adds all subdirectories (recursively) as packages to be processed.
static boolean compile(String[] args)
          Second entry point.
static boolean compile(String[] args, MjdocOptions opt, OutputStream os)
          Entry point for the GUI
protected  Main.Task createTaskAfter(Main.Task oldTask)
          This method uses the dynamic type of oldTask along with the command line options to determine what task to add to the task queue after the given task completes.
protected  MjcCommonOptions getOptionsInstance(MjcCommonOptions opt)
          Returns opt as an instance of MjcCommonOptions so it can be assigned to the options variable in mjc's Main.
protected  String getWarningFilterNameFromOptions(MjcCommonOptions opts)
          Get the warning filter's class name from the options structure.
 void handlePackages(ArrayList packages, ArrayList dirs, ArrayList infiles)
          Handles the package names found on the command-line by making them 'selected' for the purpose of the javadoc API and converting them into directory names for the purpose of the parser.
static void main(String[] args)
          The entry point when starting this program from the command line.
protected  MjcCommonOptions makeOptionsInstance()
          This function creates an object to do the parsing of the command line arguments and to store the values of the flags and options so obtained (it does not actually do the argument parsing).
 boolean parseArguments(String[] args, ArrayList infiles)
          Parses the argument list.
 boolean runParser(String[] args, MjcCommonOptions opt, ArrayList infiles)
          Runs the argument parser only so the GUI can process options from the command line
protected  void taskQueueEmptied()
          Implemented in mjdoc to cause the generation of all the html files by the appropriate call into the doclet api.
 
Methods inherited from class org.multijava.mjc.Main
activeSequenceID, adoptCompilationUnitContext, bugReportBoilerplate, bugReportProperty, bugReportRequest, catchUp, catchUp, catchUpGF, catchUpType, checkPackageName, classToGenerate, compile, contextBehavior, createCompilationUnitContext, currentlyParsingFor, expandAtFiles, experimentalArrayHandling, failedParsing, filenameFilter, firstCheckingTask, firstTask, firstTask, genCode, Generic, Generic, getClasses, getDefaultFilter, getFilter, handleDirectories, handleNonOptions, handlePackageName, hasAlreadyFailedToParseFor, hasAlreadySuccessfullyParsed, initialize, initSession, initSession, interruptCompilation, isAnExpectedResult, isCurrentlyParsingFor, mainSequenceID, nonNullTypes, noteError, optimizeCode, options, parseAtFile, parseComments, prettyPrint, processTaskQueue, quietMode, RecommendedWarning, reportTrouble, reportTroubleFiltered, RMJ, run, run, runCompilation, runInitialization, runSetInitialTasks, safeMath, setAllowUniverses, setContextBehavior, setMainSequenceID, setUniverseChecks, setUniversePurity, subdirectoryFilter, successfullyParsed, suppressWarning, universeBytecode, universeBytecodeAnnotations, universeChecks, universeDynChecks, universeKeywords, universePurity, universeVersion, validPackageName, verboseMode
 
Methods inherited from class org.multijava.util.compiler.Compiler
getTimestamp, inform, inform, inform, inform, inform, inform, inform, inform, inform, modUtil, run, setOutputStream, verifyFiles, verifyFiles
 
Methods inherited from class org.multijava.util.Utils
assertTrue, assertTrue, combineArrays, escapeString, escapeString, fail, fail, getFilePath, hasFlag, hasOtherFlags, parsePathParts, relativePathTo, splitQualifiedName, splitQualifiedName, stripJavaModifiers, stripNonJavaModifiers, stripPrivateModifier, unescapeString, vectorToArray, vectorToIntArray
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

packageList

protected ArrayList packageList
ArrayList (of String) of command-line arguments that are packages ('/'-separated and terminated name).

Constructor Detail

Main

public Main()
The principal constructor for an object to do the work of the mjdoc tool.


Main

protected Main(ModifierUtility modUtil)
Construct a mjdoc tool (an object of Main) that uses the given ModifierUtility. This constructor allows the subclasses to have their own version of modifier utilities.

Method Detail

main

public static void main(String[] args)
The entry point when starting this program from the command line.

Parameters:
args - the command line arguments

compile

public static boolean compile(String[] args)
Second entry point. This function is overridden from the parent so that we can instantiate a derived class Main object.

Parameters:
args - the command line arguments
Returns:
true if run successfully with no errors

runParser

public boolean runParser(String[] args,
                         MjcCommonOptions opt,
                         ArrayList infiles)
Runs the argument parser only so the GUI can process options from the command line

Overrides:
runParser in class Main

compile

public static boolean compile(String[] args,
                              MjdocOptions opt,
                              OutputStream os)
Entry point for the GUI

Parameters:
args - the file, package, and directory names
opt - the options for the tool
os - the output stream for the compiler messages

makeOptionsInstance

protected MjcCommonOptions makeOptionsInstance()
This function creates an object to do the parsing of the command line arguments and to store the values of the flags and options so obtained (it does not actually do the argument parsing). It is overridden here from mjc.Main so that we can instantiate a MjdocOptions object, in order to parse some new options specific to this compiler (cf. MjdocOptions.opt).

Overrides:
makeOptionsInstance in class Main
See Also:
MjdocOptions

getOptionsInstance

protected MjcCommonOptions getOptionsInstance(MjcCommonOptions opt)
Returns opt as an instance of MjcCommonOptions so it can be assigned to the options variable in mjc's Main. This is done so we can access options that are only processed in MjcCommonOptions.

Overrides:
getOptionsInstance in class Main

parseArguments

public boolean parseArguments(String[] args,
                              ArrayList infiles)
Parses the argument list. Mutates infiles, options. Returns true if there were no problems parsing the arguments. The list of command line arguments is parsed per the options defined in MjdocOptions.opt. Values of given options are stored in the protected variable super.options. Remaining command-line arguments are considered to be filenames or directories.

Overrides:
parseArguments in class Main

handlePackages

public void handlePackages(ArrayList packages,
                           ArrayList dirs,
                           ArrayList infiles)
Handles the package names found on the command-line by making them 'selected' for the purpose of the javadoc API and converting them into directory names for the purpose of the parser.

Overrides:
handlePackages in class Main

addRecursivePackages

protected void addRecursivePackages(String packageName,
                                    File dir,
                                    ArrayList dirs)
This adds all subdirectories (recursively) as packages to be processed.


getWarningFilterNameFromOptions

protected String getWarningFilterNameFromOptions(MjcCommonOptions opts)
Get the warning filter's class name from the options structure. This is a hook method that can be overridden by subclasses.

Overrides:
getWarningFilterNameFromOptions in class Main
Returns:
null if there is no warning filter option specified.

createTaskAfter

protected Main.Task createTaskAfter(Main.Task oldTask)
This method uses the dynamic type of oldTask along with the command line options to determine what task to add to the task queue after the given task completes.

 also
 requires oldTask != null && oldTask.completed;
 ensures \result == null || 
	       (\result.sequenceID() == oldTask.sequenceID());
 

Overrides:
createTaskAfter in class Main

taskQueueEmptied

protected void taskQueueEmptied()
Implemented in mjdoc to cause the generation of all the html files by the appropriate call into the doclet api. This method is called by #run(String[]) when all reentrant invocations of #processTaskQueue() have been exited and in this implementation the method finalizes the generation of the HTML. This method should be overridden by subclasses to perform final work after completion of all tasks.

Overrides:
taskQueueEmptied in class Main

mjc

mjc is Copyright (C) 2000-2004 by Iowa State University and is distributed under the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. mjc is based in part on the Kopi project Copyright (C) 1990-99 DMS Decision Management Systems Ges.m.b.H.