Runs {@link LRA Latent Relational Analysis} using the configuration
properties found in the specified arguments.

@param args arguments used to configure this program and the {@code
LRA} instance
341488
public void run(String[] args) {
        argOptions = setupOptions();
        try {
            if (args.length < 3) {
                usage();
                System.exit(1);
            }
            argOptions.parseOptions(args);
            
            if (argOptions.numPositionalArgs() < 4) {
                throw new IllegalArgumentException(
                        "must include all Required args");
            }

            Properties props = setupProperties();

            String corpusDir = argOptions.getPositionalArg(0);
            String analogyFile = argOptions.getPositionalArg(1);
            String testAnalogies = argOptions.getPositionalArg(2);
            String outputFile = argOptions.getPositionalArg(3);
            String indexDir = corpusDir;
            String userSpecifiedDir = 
                props.getProperty(LatentRelationalAnalysis.LRA_INDEX_DIR);
            if (userSpecifiedDir != null) {
                indexDir = userSpecifiedDir;
            } 

            boolean doIndex = true; //set as option later
            String skipIndexProp = props.getProperty(
                    LatentRelationalAnalysis.LRA_SKIP_INDEX);
            if (skipIndexProp.equals("true")) {
                doIndex = false; //set as option later
            }
            LatentRelationalAnalysis lra = new LatentRelationalAnalysis(
                    corpusDir, indexDir, doIndex,
                    SVD.getFastestAvailableFactorization());

            //Steps 1-2. Load analogy input
            lra.loadAnalogiesFromFile(analogyFile);

            Matrix projection;

            // if we load a projection matrix from file, we can skip all the
            // preprocessing
            String readProjectionFile = props.getProperty(
                    LatentRelationalAnalysis.LRA_READ_MATRIX_FILE);
            if (readProjectionFile != null) {
                File readFile = new File(readProjectionFile);
                if (readFile.exists()) {
                    projection = 
                        MatrixIO.readMatrix(new File(readProjectionFile), 
                                            MatrixIO.Format.SVDLIBC_SPARSE_TEXT,
                                            Matrix.Type.SPARSE_IN_MEMORY);
                } else {
                    throw new IllegalArgumentException(
                        "specified projection file does not exist");
                }
            } else { //do normal LRA preprocessing...


                //Step 3. Get patterns Step 4. Filter top NUM_PATTERNS
                lra.findPatterns();

                //Step 5. Map phrases to rows 
                lra.mapRows();
                //Step 6. Map patterns to columns 
                lra.mapColumns();

                //Step 7. Create sparse matrix 
                Matrix sparse_matrix = lra.createSparseMatrix();

                //Step 8. Calculate entropy
                sparse_matrix = lra.applyEntropyTransformations(sparse_matrix);

                //Step 9. Compute SVD on the pre-processed matrix.
                int dimensions = 300; //TODO: set as option
                String userSpecfiedDims = props.getProperty(
                        LatentRelationalAnalysis.LRA_DIMENSIONS_PROPERTY);
                if (userSpecfiedDims != null) {
                    try {
                        dimensions = Integer.parseInt(userSpecfiedDims);
                    } catch (NumberFormatException nfe) {
                        throw new IllegalArgumentException(
                            LatentRelationalAnalysis.LRA_DIMENSIONS_PROPERTY +
                            " is not an integer: " + userSpecfiedDims);
                    }
                }
                projection = lra.computeSVD(sparse_matrix, dimensions);

                //Step 10. Compute projection matrix from U and S.  This is
                //already returned by the matrix factorization.
            }

            String writeProjectionFile = props.getProperty(
                    LatentRelationalAnalysis.LRA_WRITE_MATRIX_FILE);
            if(writeProjectionFile != null) {
                MatrixIO.writeMatrix(projection, 
                                     new File(writeProjectionFile),
                                     MatrixIO.Format.SVDLIBC_SPARSE_TEXT);
            }

            //Step 11. Get analogy input and Evaluate Alternatives
            lra.evaluateAnalogies(projection, testAnalogies, outputFile);
        } catch (Throwable t)  {
            t.printStackTrace();
        }
    }
987287
public static void main(String[] args) {
        if(args.length != 1) {
            System.out.println("usage: " + ApplicationLauncher.class.getName() + " namespace");
            System.exit(0);
            return;
        }

        // generate configuration sources
        String namespace= args[0];
        AbstractConfiguration[] configs;
        try {
            configs= ConfigurationGenerator.execute(
                namespace,
                ApplicationLauncher.class.getClassLoader(),
                LoggerFactory.getLogger(ApplicationLauncher.class));
        } catch (Exception e) {
        	e.printStackTrace();
            System.err.println("namespace does not contain a valid application definition: " + e.getMessage());
            System.exit(1);
            return;
        }
        
        // prepare compilation
        JavaCompiler compiler= ToolProvider.getSystemJavaCompiler();
        if(compiler == null) {
            System.err.println("Java compiler could not be found. Possibly you are running a JRE instead of a JDK!");
            System.exit(1);
            return;
        }
        
        final List<NodeConfiguration> nodes= new ArrayList<NodeConfiguration>();
        ArrayList<JavaFileObject> sources= new ArrayList<JavaFileObject>();
        for(AbstractConfiguration config : configs) {
            sources.add(new CharSequenceJavaFileObject(config.className, config.source));
            
            // collect nodes for later execution
            if(config instanceof NodeConfiguration) {
                nodes.add((NodeConfiguration) config);
            }
        }
        
        StandardJavaFileManager stdFileManager= compiler.getStandardFileManager(null, null, null);
        ByteFileManager<StandardJavaFileManager> byteFileManager= new ByteFileManager<StandardJavaFileManager>(stdFileManager);
        ConfigurationDiagnosticListener listener= new ConfigurationDiagnosticListener();
        CompilationTask task= compiler.getTask(null, byteFileManager, listener, null, null, sources);
        
        // compile
        boolean success= task.call().booleanValue();
        try {
            byteFileManager.close();
        } catch (IOException e1) {
            e1.printStackTrace();
            System.err.println("could not close file manager");
        }
        
        if(!success) {
            System.err.println("could not compile node configurations");
            System.err.println("  trying to dump generated source files...");
            
            File targetFolder= dumpSources(configs);
            
            if(targetFolder != null) {
                System.err.println(" dumped into " + targetFolder.toString());
            } else {
                System.err.println(" failed");
            }
            System.exit(1);
            return;
        }
        
        // launch the nodes
        Map<String, ByteArrayJavaFileObject> classes= byteFileManager.getStore();
        if(nodes.size() <= 0) {
            System.err.println("no nodes configured");
            System.exit(1);
        } else if(nodes.size() == 1) {
            // start the node in the current vm
            launchInCurrentVM(nodes.get(0).className, classes);
        } else {
            // write the configuration
            launchInNewVMs(nodes, classes);
        }
    }
1333814
public static void main(final String[] args) throws Exception {
        if (args.length != 2) {
            throw new RuntimeException("Invalid build configuration. No command-line arguments specified");
        }
        final var buildDir = args[0];
        final var projectDir = args[1];
        new ConfigurationMetadataGenerator(buildDir, projectDir).execute();
    }
929926
protected static Map<String, String> initializeSystemProperties(final String[] args) {
        final Map<String, String> result = new HashMap<>();
        final Pattern pattern = Pattern.compile("-D(.+)=(.+)");
        for (final String arg : args) {
            final Matcher matcher = pattern.matcher(arg);
            if (matcher.matches()) {
                final String key = matcher.group(1);
                final String value = matcher.group(2);
                result.put(key, value);
                System.setProperty(key, value);
            }
        }
        return result;
    }
806347
public static void main(final String[] args) {
        String propertyFile = System.getProperty("file");
        if (propertyFile == null) {
            System.out.println("Property file not given, exiting.");
            System.exit(0);
        }
        final Properties properties = new Properties();
        try {
            properties.load(new FileInputStream(propertyFile));
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        } catch (IOException ie) {
            ie.printStackTrace();
        }
        recommend(properties);
    }
206533
protected void configure(String[] args) throws IOException {
    for (String arg : args) {
      if (arg.startsWith("--input=")) {
        FileRef ref = createInput();
        ref.setPath(arg.substring(arg.indexOf('=') + 1));
      } else if (arg.startsWith("--output=")) {
        FileRef ref = createOutput();
        ref.setPath(arg.substring(arg.indexOf('=') + 1));
      } else if (arg.startsWith("--libdefined=")) {
        FunctionNamePredicate libdefined = new FunctionNamePredicate();
        libdefined.setPattern(arg.substring(arg.indexOf('=') + 1));
        addConfiguredLibdefined(libdefined);
      } else {
        throw new IllegalArgumentException(arg);
      }
    }
  }
928967
public static void main(String[] args) throws Exception {
    Configuration conf = HBaseConfiguration.create();
    String[] otherArgs = new GenericOptionsParser(conf, args).getRemainingArgs();
    if (otherArgs.length < 2) {
      usage("Wrong number of arguments: " + otherArgs.length);
      System.exit(-1);
    }
    if (conf.get(BigtableOptionsFactory.PROJECT_ID_KEY) == null) {
      usage("Must specify the property " + BigtableOptionsFactory.PROJECT_ID_KEY);
      System.exit(-1);
    }
    if (conf.get(BigtableOptionsFactory.INSTANCE_ID_KEY) == null) {
      usage("Must specify the property" + BigtableOptionsFactory.INSTANCE_ID_KEY);
      System.exit(-1);
    }

    Job job = createSubmittableJob(conf, otherArgs);
    System.exit(job.waitForCompletion(true)? 0 : 1);
  }
90508
public static void main(String[] args) throws Exception {
		
		if(!parseParameters(args)) {
			return;
		}
	
		// set up execution environment
		ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
		
		// get input data
		DataSet<Point> points = getPointDataSet(env);
		DataSet<Centroid> centroids = getCentroidDataSet(env);
		
		// set number of bulk iterations for KMeans algorithm
		IterativeDataSet<Centroid> loop = centroids.iterate(numIterations);
		
		DataSet<Centroid> newCentroids = points
			// compute closest centroid for each point
			.map(new SelectNearestCenter()).withBroadcastSet(loop, "centroids")
			// count and sum point coordinates for each centroid
			.map(new CountAppender())
			.groupBy(0).reduce(new CentroidAccumulator())
			// compute new centroids from point counts and coordinate sums
			.map(new CentroidAverager());
		
		// feed new centroids back into next iteration
		DataSet<Centroid> finalCentroids = loop.closeWith(newCentroids);
		
		DataSet<Tuple2<Integer, Point>> clusteredPoints = points
				// assign points to final clusters
				.map(new SelectNearestCenter()).withBroadcastSet(finalCentroids, "centroids");
		
		// emit result
		if(fileOutput) {
			clusteredPoints.writeAsCsv(outputPath, "\n", " ");
		} else {
			clusteredPoints.print();
		}

		// execute program
		env.execute("KMeans Example");
		
	}
933657
@Override
  protected void setArgs(IndexSchema schema, Map<String, String> args) {
    followIndexAnalyzer = args.get(FOLLOW_INDEX_ANALYZER);
    defaultConfiguration = args.get(DEFAULT_CONFIGURATION);
    configurationFromField = args.get(CONFIGURATION_FROM_FIELD);
    setNumberOfTokens = args.get(SET_NUMBER_OF_TOKENS);
    setNumberOfPositions = args.get(SET_NUMBER_OF_POSITIONS);
    setSize = args.get(SET_SIZE);
    setError = args.get(SET_ERROR);
    setPrefix = args.get(SET_PREFIX);
    setPrefixNumbers = args.get(SET_PREFIX_NUMBERS);
    if (followIndexAnalyzer == null) {
      throw new RuntimeException("No " + FOLLOW_INDEX_ANALYZER
          + " for fieldType " + this.getTypeName());
    }
    args.remove(FOLLOW_INDEX_ANALYZER);
    args.remove(DEFAULT_CONFIGURATION);
    args.remove(CONFIGURATION_FROM_FIELD);
    args.remove(SET_NUMBER_OF_TOKENS);
    args.remove(SET_NUMBER_OF_POSITIONS);
    args.remove(SET_SIZE);
    args.remove(SET_ERROR);
    args.remove(SET_PREFIX);
    args.remove(SET_PREFIX_NUMBERS);
    super.setArgs(schema, args);
  }
501873
public static void main(String[] args) throws IOException {
    	String infile = "../example-data/data-lda.txt";
    	String stopwordfile = "../models/stopwords/stopwords.txt";
		BufferedReader in = new BufferedReader(new InputStreamReader(
				new FileInputStream(infile ), "utf8"));

		//		BufferedWriter out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(
//				outfile), enc2));
		StopWords sw = new StopWords(stopwordfile);
		
		LabelAlphabet dict = new LabelAlphabet();
		// words in documents
		ArrayList<TIntArrayList> documentsList= new ArrayList<TIntArrayList>();
		
		
		String line = null;
		while ((line = in.readLine()) != null) {
			line = line.trim();	
			if(line.length()==0)
				continue;
			String[] toks = line.split("\\s+");
			TIntArrayList wordlist = new TIntArrayList(); 
			for(int j=0;j<toks.length;j++){
				String tok = toks[j];
				if(sw.isStopWord(tok))
					continue;
				int idx = dict.lookupIndex(tok);
				wordlist.add(idx);
			}
			documentsList.add(wordlist);
		}
		in.close();
		int[][] documents;
		documents = new int[documentsList.size()][];
		for(int i=0;i<documents.length;i++){
			documents[i] = documentsList.get(i).toArray();
		}
        // vocabulary
        int V = dict.size();
        int M = documents.length;
        // # topics
        int K = 4;
        // good values alpha = 2, beta = .5
        float alpha = 2f;
        float beta = .5f;

        System.out.println("Latent Dirichlet Allocation using Gibbs Sampling.");

        LdaGibbsSampler lda = new LdaGibbsSampler(documents, V);
        lda.configure(10000, 2000, 100, 10);
        lda.gibbs(K, alpha, beta);

        float[][] theta = lda.getTheta();
        float[][] phi = lda.getPhi();

        System.out.println();
        System.out.println();
        System.out.println("Document--Topic Associations, Theta[d][k] (alpha="
            + alpha + ")");
        System.out.print("d\\k\t");
        for (int m = 0; m < theta[0].length; m++) {
            System.out.print("   " + m % 10 + "    ");
        }
        System.out.println();
        for (int m = 0; m < theta.length; m++) {
            System.out.print(m + "\t");
            for (int k = 0; k < theta[m].length; k++) {
                // System.out.print(theta[m][k] + " ");
                System.out.print(shadefloat(theta[m][k], 1) + " ");
            }
            System.out.println();
        }
        System.out.println();
        System.out.println("Topic--Term Associations, Phi[k][w] (beta=" + beta
            + ")");

        System.out.print("k\\w\t");
        for (int w = 0; w < phi[0].length; w++) {
            System.out.print("   " + dict.lookupString(w) + "    ");
        }
        System.out.println();
        for (int k = 0; k < phi.length; k++) {
            System.out.print(k + "\t");
            for (int w = 0; w < phi[k].length; w++) {
            	System.out.print(lnf.format(phi[k][w]) + " ");
//            	System.out.print(phi[k][w] + " ");
//                System.out.print(shadefloat(phi[k][w], 1) + " ");
            }
            System.out.println();
        }
        for (int k = 0; k < phi.length; k++) {
        	int[] top = MyArrays.sort(phi[k]);
        	
            for (int w = 0; w < 10; w++) {
            	System.out.print(dict.lookupString(top[w]) + " ");
            }
            System.out.println();
        }
    }
240460
public static void main(String[] args) {
        LOVEndpoint lov = new LOVEndpoint();
        String file = args.length > 0 ? args[1].trim() : "rdfunit-model/src/main/resources/org/aksw/rdfunit/configuration/schemaLOV.csv";
        lov.writeAllLOVEntriesToFile(file);
    }
619607
public static void main(String[] args) throws Exception {
    Options options = new Options();
    HelpFormatter hf = new HelpFormatter();
    hf.setWidth(100);
    options.addOption(
        Option.builder("i")
            .argName("in_path")
            .longOpt("input-file")
            .hasArg()
            .required()
            .desc("path to target jar/aar file")
            .build());
    options.addOption(
        Option.builder("p")
            .argName("pkg_name")
            .longOpt("package")
            .hasArg()
            .desc("qualified package name")
            .build());
    options.addOption(
        Option.builder("o")
            .argName("out_path")
            .longOpt("output-file")
            .hasArg()
            .required()
            .desc("path to processed jar/aar file")
            .build());
    options.addOption(
        Option.builder("h")
            .argName("help")
            .longOpt("help")
            .desc("print usage information")
            .build());
    options.addOption(
        Option.builder("d")
            .argName("debug")
            .longOpt("debug")
            .desc("print debug information")
            .build());
    options.addOption(
        Option.builder("v").argName("verbose").longOpt("verbose").desc("set verbosity").build());
    try {
      CommandLine line = new DefaultParser().parse(options, args);
      if (line.hasOption('h')) {
        hf.printHelp(appName, options, true);
        return;
      }
      String jarPath = line.getOptionValue('i');
      String pkgName = line.getOptionValue('p', "");
      String outPath = line.getOptionValue('o');
      boolean debug = line.hasOption('d');
      boolean verbose = line.hasOption('v');
      if (!pkgName.isEmpty()) {
        pkgName = "L" + pkgName.replaceAll("\\.", "/");
      }
      DefinitelyDerefedParamsDriver.run(jarPath, pkgName, outPath, debug, verbose);
      if (!new File(outPath).exists()) {
        System.out.println("Could not write jar file: " + outPath);
      }
    } catch (ParseException pe) {
      hf.printHelp(appName, options, true);
    }
  }
342677
@SuppressWarnings("unchecked")
	public static void main(String[] args)
	{
		List<File> filenames = new Vector<File>();
		List<File> pathnames = new Vector<File>();
		List<String> largs = Arrays.asList(args);
		VDMJ controller = null;
		Dialect dialect = Dialect.VDM_SL;
		String remoteName = null;
		Class<RemoteControl> remoteClass = null;
		String defaultName = null;

		Properties.init(); // Read properties file, if any
		Settings.usingCmdLine = true;
		
		if(largs.contains("-version"))
		{
			println(getOvertureVersion());
			System.exit(0);
		}
		
		for (Iterator<String> i = largs.iterator(); i.hasNext();)
		{
			String arg = i.next();

			if (arg.equals("-vdmsl"))
			{
				controller = new VDMSL();
				dialect = Dialect.VDM_SL;
			} else if (arg.equals("-vdmpp"))
			{
				controller = new VDMPP();
				dialect = Dialect.VDM_PP;
			} else if (arg.equals("-vdmrt"))
			{
				controller = new VDMRT();
				dialect = Dialect.VDM_RT;
			} else if (arg.equals("-w"))
			{
				warnings = false;
			} else if (arg.equals("-i"))
			{
				interpret = true;
			} else if (arg.equals("-p"))
			{
				pog = true;
			} else if (arg.equals("-q"))
			{
				quiet = true;
			} else if (arg.equals("-e"))
			{
				Settings.usingCmdLine = false;
				interpret = true;
				pog = false;

				if (i.hasNext())
				{
					script = i.next();
				} else
				{
					usage("-e option requires an expression");
				}
			} else if (arg.equals("-o"))
			{
				if (i.hasNext())
				{
					if (outfile != null)
					{
						usage("Only one -o option allowed");
					}

					outfile = i.next();
				} else
				{
					usage("-o option requires a filename");
				}
			} else if (arg.equals("-c"))
			{
				if (i.hasNext())
				{
					filecharset = validateCharset(i.next());
				} else
				{
					usage("-c option requires a charset name");
				}
			} else if (arg.equals("-t"))
			{
				if (i.hasNext())
				{
					Console.setCharset(validateCharset(i.next()));
				} else
				{
					usage("-t option requires a charset name");
				}
			} else if (arg.equals("-r"))
			{
				if (i.hasNext())
				{
					Settings.release = Release.lookup(i.next());

					if (Settings.release == null)
					{
						usage("-r option must be " + Release.list());
					}
				} else
				{
					usage("-r option requires a VDM release");
				}
			} else if (arg.equals("-pre"))
			{
				Settings.prechecks = false;
			} else if (arg.equals("-post"))
			{
				Settings.postchecks = false;
			} else if (arg.equals("-inv"))
			{
				Settings.invchecks = false;
			} else if (arg.equals("-dtc"))
			{
				// NB. Turn off both when no DTC
				Settings.invchecks = false;
				Settings.dynamictypechecks = false;
			} else if (arg.equals("-measures"))
			{
				Settings.measureChecks = false;
			} else if (arg.equals("-log"))
			{
				if (i.hasNext())
				{
					logfile = i.next();
				} else
				{
					usage("-log option requires a filename");
				}
			} else if (arg.equals("-remote"))
			{
				if (i.hasNext())
				{
					interpret = true;
					remoteName = i.next();
				} else
				{
					usage("-remote option requires a Java classname");
				}
			} else if (arg.equals("-default"))
			{
				if (i.hasNext())
				{
					defaultName = i.next();
				} else
				{
					usage("-default option requires a name");
				}
			} else if (arg.equals("-path"))
			{
				if (i.hasNext())
				{
					File path = new File(i.next());

					if (path.isDirectory())
					{
						pathnames.add(path);
					} else
					{
						usage(path + " is not a directory");
					}
				} else
				{
					usage("-path option requires a directory");
				}
			}else if (arg.equals("-baseDir"))
			{
				if (i.hasNext())
				{
					try
					{
						Settings.baseDir = new File(i.next());
					} catch (IllegalArgumentException e)
					{
						usage(e.getMessage() + ": " + arg);
					}
				} else
				{
					usage("-baseDir option requires a folder name");
				}
			}  else if (arg.startsWith("-"))
			{
				usage("Unknown option " + arg);
			} else
			{
				// It's a file or a directory
				File file = new File(arg);

				if (file.isDirectory())
				{
					for (File subFile : file.listFiles(dialect.getFilter()))
					{
						if (subFile.isFile())
						{
							filenames.add(subFile);
						}
					}
				} else
				{
					if (file.exists())
					{
						filenames.add(file);
					} else
					{
						boolean OK = false;

						for (File path : pathnames)
						{
							File pfile = new File(path, arg);

							if (pfile.exists())
							{
								filenames.add(pfile);
								OK = true;
								break;
							}
						}

						if (!OK)
						{
							usage("Cannot find file " + file);
						}

					}
				}
			}
		}

		if (controller == null)
		{
			usage("You must specify either -vdmsl, -vdmpp or -vdmrt");
		}

		if (logfile != null && !(controller instanceof VDMRT))
		{
			usage("The -log option can only be used with -vdmrt");
		}

		if (remoteName != null)
		{
			try
			{
				Class<?> cls = ClassLoader.getSystemClassLoader().loadClass(remoteName);
				remoteClass = (Class<RemoteControl>) cls;
			} catch (ClassNotFoundException e)
			{
				usage("Cannot locate " + remoteName + " on the CLASSPATH");
			}
		}

		ExitStatus status = null;

		if (filenames.isEmpty() && (!interpret || remoteClass != null))
		{
			usage("You didn't specify any files");
			status = ExitStatus.EXIT_ERRORS;
		} else
		{
			do
			{
				if (filenames.isEmpty())
				{
					status = controller.interpret(filenames, null);
				} else
				{
					status = controller.parse(filenames);

					if (status == ExitStatus.EXIT_OK)
					{
						status = controller.typeCheck();

						if (status == ExitStatus.EXIT_OK && interpret)
						{
							if (remoteClass == null)
							{
								status = controller.interpret(filenames, defaultName);
							} else
							{
								try
								{
									final RemoteControl remote = remoteClass.newInstance();
									Interpreter i = controller.getInterpreter();

									if (defaultName != null)
									{
										i.setDefaultName(defaultName);
									}

									i.init(null);

									try
									{
										// remote.run(new RemoteInterpreter(i, null));
										final RemoteInterpreter remoteInterpreter = new RemoteInterpreter(i, null);
										Thread remoteThread = new Thread(new Runnable()
										{

											public void run()
											{
												try
												{
													remote.run(remoteInterpreter);
												} catch (Exception e)
												{
													println(e.getMessage());
													// status = ExitStatus.EXIT_ERRORS;
												}
											}
										});
										remoteThread.setName("RemoteControl runner");
										remoteThread.setDaemon(true);
										remoteThread.start();
										remoteInterpreter.processRemoteCalls();
										status = ExitStatus.EXIT_OK;
									} catch (Exception e)
									{
										println(e.getMessage());
										status = ExitStatus.EXIT_ERRORS;
									}
								} catch (InstantiationException e)
								{
									usage("Cannot instantiate " + remoteName);
								} catch (Exception e)
								{
									usage(e.getMessage());
								}
							}
						}
					}
				}
			} while (status == ExitStatus.RELOAD);
		}

		if (interpret)
		{
			infoln("Bye");
		}

		System.exit(status == ExitStatus.EXIT_OK ? 0 : 1);
	}
152866
public void run(String[] args) {
    // Add and parse options.
    OptionParser parser = new OptionParser();
    initializeCommonOptions(parser);
    initializeOptions(parser);

    String errorMessage = null;
    try {
      parsedOptions = parser.parse(args);
    } catch (OptionException e) {
      errorMessage = e.getMessage();
    }

    boolean printHelp = false;
    if (errorMessage != null) {
      // If an error occurs, the options don't parse.
      // Therefore, we must manually check if the help option was
      // given.
      for (int i = 0; i < args.length; i++) {
        if (args[i].equals("--help")) {
          printHelp = true;
        }
      }
    }

    if (errorMessage != null && !printHelp) {
      System.err.println(errorMessage);
      System.err.println("Try --help for more information about options.");
      System.exit(1);
    }

    if (printHelp || parsedOptions.has(helpOpt)) {
      // If a help option is given, print help then quit.
      try {
        parser.printHelpOn(System.err);
      } catch (IOException ioException) {
        throw new RuntimeException(ioException);
      }
      System.exit(0);
    }

    // Log any passed-in options.
    if (!parsedOptions.has(noPrintOptions)) {
      System.out.println("Command-line options:");
      for (OptionSpec<?> optionSpec : parsedOptions.specs()) {
        if (parsedOptions.hasArgument(optionSpec)) {
          System.out.println("--" + Iterables.getFirst(optionSpec.options(), "") + " "
              + Joiner.on(" ").join(parsedOptions.valuesOf(optionSpec)));
        } else {
          System.out.println("--" + Iterables.getFirst(optionSpec.options(), ""));
        }
      }
      System.out.println("");
    }

    // Run the program.
    long startTime = System.currentTimeMillis();
    processOptions(parsedOptions);
    run(parsedOptions);
    long endTime = System.currentTimeMillis();

    if (!parsedOptions.has(noPrintOptions)) {
      System.out.println("Total time elapsed: " + TimeUtils.durationToString(endTime - startTime));
    }

    System.exit(0);
  }
1182446
public void parseArgument(Collection<String> args) throws CmdLineException {
        parseArgument(args.toArray(new String[args.size()]));
    }
762806
public static void main(String[] arg) {

        System.getProperties().put("sun.java2d.noddraw", "true");

        // (ulrivo): read all arguments from the command line
        String  lowerArg;
        String  urlid        = null;
        String  rcFile       = null;
        boolean autoConnect  = false;
        boolean urlidConnect = false;

        bMustExit = true;

        for (int i = 0; i < arg.length; i++) {
            lowerArg = arg[i].toLowerCase();

            if (lowerArg.startsWith("--")) {
                lowerArg = lowerArg.substring(1);
            }

            i++;

            if (lowerArg.equals("-driver")) {
                defDriver   = arg[i];
                autoConnect = true;
            } else if (lowerArg.equals("-url")) {
                defURL      = arg[i];
                autoConnect = true;
            } else if (lowerArg.equals("-user")) {
                defUser     = arg[i];
                autoConnect = true;
            } else if (lowerArg.equals("-password")) {
                defPassword = arg[i];
                autoConnect = true;
            } else if (lowerArg.equals("-urlid")) {
                urlid        = arg[i];
                urlidConnect = true;
            } else if (lowerArg.equals("-rcfile")) {
                rcFile       = arg[i];
                urlidConnect = true;
            } else if (lowerArg.equals("-dir")) {
                defDirectory = arg[i];
            } else if (lowerArg.equals("-script")) {
                defScript = arg[i];
            } else if (lowerArg.equals("-noexit")) {
                bMustExit = false;

                i--;
            } else if (lowerArg.equals("-help")) {
                showUsage();
                return;
            } else {
                /* Syntax ERRORS should either throw or exit with non-0 status.
                 * In our case, it may be unsafe to exit, so we throw.
                 * (I.e. should provide easy way for caller to programmatically
                 * determine that there was an invocation problem).
                 */

                throw new IllegalArgumentException(
                        "Try:  java... " + DatabaseManagerSwing.class.getName()
                        + " --help");
                // No reason to localize, since the main syntax message is
                // not localized.
            }
        }

        DatabaseManagerSwing m =
            new DatabaseManagerSwing(new JFrame("HSQL Database Manager"));

        // Added: (weconsultants@users): Need databaseManagerSwing for later Reference
        refForFontDialogSwing = m;

        m.main();

        Connection c = null;

        m.setWaiting("Initializing");

        try {
            if (autoConnect && urlidConnect) {
                throw new IllegalArgumentException(
                    "You may not specify both (urlid) AND (url/user/password).");
            }

            if (autoConnect) {
                c = ConnectionDialogSwing.createConnection(defDriver, defURL,
                        defUser, defPassword);
            } else if (urlidConnect) {
                if (urlid == null) {
                    throw new IllegalArgumentException(
                        "You must specify an 'urlid' to use an RC file");
                }

                autoConnect = true;

                String rcfilepath = (rcFile == null) ? DEFAULT_RCFILE
                                                     : rcFile;
                RCData rcdata     = new RCData(new File(rcfilepath), urlid);

                c = rcdata.getConnection(
                    null, System.getProperty("sqlfile.charset"),
                    System.getProperty("javax.net.ssl.trustStore"));
            } else {
                c = ConnectionDialogSwing.createConnection(m.jframe,
                        "Connect");
            }
        } catch (Exception e) {

            //  Added: (weconsultants@users)
            CommonSwing.errorMessage(e);
        } finally {
            m.setWaiting(null);
        }

        if (c != null) {
            m.connect(c);
        }

        // Added: (weconsultants@users): For preloadng FontDialogSwing
        FontDialogSwing.creatFontDialog(refForFontDialogSwing);
        m.start();
    }
792264
public static void main(String[] arg)
    {
        try
        {
            for (int i = 0; i < arg.length; i++)
                new XmlConfiguration(Resource.newResource(arg[i]).getURL()).newInstance();
        }
        catch (Exception e)
        {
            log.warn(LogSupport.EXCEPTION, e);
        }
    }