Ejemplo n.º 1
0
 /**
  * Initialize this tool. This method declares this tool's command line options. The default
  * implementation declares
  *
  * <ul>
  *   <li>a boolean option <code>optionSilent</code> for silent operation,
  *   <li>a boolean option <code>optionVerbose</code> for verbose operation,
  *   <li>a boolean option <code>optionNoExit</code> for not exiting the Java virtual machine,
  *   <li>a multiple directory option {@link Runtime#INPUT_DIRECTORY} for the file search path,
  *   <li>a directory option {@link Runtime#OUTPUT_DIRECTORY} for the output directory,
  *   <li>a word option {@link Runtime#INPUT_ENCODING} for the character encoding when reading
  *       files,
  *   <li>a word option {@link Runtime#OUTPUT_ENCODING} for the character encoding when writing
  *       files,
  *   <li>
  *   <li>a boolean option <code>optionDiagnostics</code> for printing tool diagnostics,
  *   <li>a boolean option <code>optionPerformance</code> for collecting performance statistics,
  *   <li>a boolean option <code>optionMeasureParser</code> for measuring parser performance only.
  *   <li>a boolean option <code>optionMeasureProcessing</code> for measuring processing
  *       performance only.
  *   <li>a boolean option <code>optionGC</code> for performing GC,
  *   <li>an integer option <code>runsWarmUp</code> with a default of 2 for the number of warm-up
  *       runs,
  *   <li>and an integer option <code>runsTotal</code> with a default of 12 for the total number of
  *       runs.
  * </ul>
  */
 public void init() {
   runtime
       .bool("silent", "optionSilent", false, "Enable silent operation.")
       .bool("verbose", "optionVerbose", false, "Enable verbose operation.")
       .bool("no-exit", "optionNoExit", false, "Do not explicitly exit the Java virtual machine.")
       .dir(
           "in",
           Runtime.INPUT_DIRECTORY,
           true,
           "Add the specified directory to the file search path.")
       .dir("out", Runtime.OUTPUT_DIRECTORY, false, "Use the specified directory for output.")
       .word(
           "enc-in",
           Runtime.INPUT_ENCODING,
           false,
           "Use the specified character encoding for input.")
       .word(
           "enc-out",
           Runtime.OUTPUT_ENCODING,
           false,
           "Use the specified character encoding for output.")
       .bool(
           "diagnostics", "optionDiagnostics", false, "Print diagnostics for internal tool state.")
       .bool(
           "performance", "optionPerformance", false, "Collect and print performance statistics.")
       .bool("measureParser", "optionMeasureParser", false, "Measure parser performance only.")
       .bool(
           "measureProcess",
           "optionMeasureProcessing",
           false,
           "Measure processing performance only.")
       .bool("gc", "optionGC", false, "Perform GC before each operation.")
       .number(
           "warmupRuns",
           "runsWarmUp",
           2,
           "Perform the specified number of warm-up runs.  The default is 2.")
       .number(
           "totalRuns",
           "runsTotal",
           12,
           "Perform the specified number of total runs.  The default is 12.");
 }