com.github.javacliparser.FlagOption Java Examples

The following examples show how to use com.github.javacliparser.FlagOption. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: LocalDoTask.java    From incubator-samoa with Apache License 2.0 5 votes vote down vote up
/**
 * The main method.
 * 
 * @param args
 *          the arguments
 */
public static void main(String[] args) {

  // ArrayList<String> tmpArgs = new ArrayList<String>(Arrays.asList(args));

  // args = tmpArgs.toArray(new String[0]);

  FlagOption suppressStatusOutOpt = new FlagOption("suppressStatusOut", 'S', SUPPRESS_STATUS_OUT_MSG);

  FlagOption suppressResultOutOpt = new FlagOption("suppressResultOut", 'R', SUPPRESS_RESULT_OUT_MSG);

  IntOption statusUpdateFreqOpt = new IntOption("statusUpdateFrequency", 'F', STATUS_UPDATE_FREQ_MSG, 1000, 0,
      Integer.MAX_VALUE);

  Option[] extraOptions = new Option[] { suppressStatusOutOpt, suppressResultOutOpt, statusUpdateFreqOpt };

  StringBuilder cliString = new StringBuilder();
  for (String arg : args) {
    cliString.append(" ").append(arg);
  }
  logger.debug("Command line string = {}", cliString.toString());
  System.out.println("Command line string = " + cliString.toString());

  Task task;
  try {
    task = ClassOption.cliStringToObject(cliString.toString(), Task.class, extraOptions);
    logger.info("Successfully instantiating {}", task.getClass().getCanonicalName());
  } catch (Exception e) {
    logger.error("Fail to initialize the task", e);
    System.out.println("Fail to initialize the task" + e);
    return;
  }
  task.setFactory(new SimpleComponentFactory());
  task.init();
  SimpleEngine.submitTopology(task.getTopology());
}
 
Example #2
Source File: AbstractClusterer.java    From incubator-samoa with Apache License 2.0 5 votes vote down vote up
public AbstractClusterer() {
  if (isRandomizable()) {
    this.randomSeedOption = new IntOption("randomSeed", 'r',
        "Seed for random behaviour of the Clusterer.", 1);
  }

  if (implementsMicroClusterer()) {
    this.evaluateMicroClusteringOption =
        new FlagOption("evaluateMicroClustering", 'M',
            "Evaluate the underlying microclustering instead of the macro clustering");
  }
}
 
Example #3
Source File: AbstractClusterer.java    From moa with GNU General Public License v3.0 5 votes vote down vote up
public AbstractClusterer() {
	if (isRandomizable()) {
		this.randomSeedOption = new IntOption("randomSeed", 'r',
				"Seed for random behaviour of the Clusterer.", 1);
	}

       if( implementsMicroClusterer()){
           this.evaluateMicroClusteringOption =
                   new FlagOption("evaluateMicroClustering", 'M',
                   "Evaluate the underlying microclustering instead of the macro clustering");
       }
}
 
Example #4
Source File: LocalDoTask.java    From samoa with Apache License 2.0 5 votes vote down vote up
/**
 * The main method.
 * 
 * @param args
 *            the arguments
 */
public static void main(String[] args) {

    // ArrayList<String> tmpArgs = new ArrayList<String>(Arrays.asList(args));

    // args = tmpArgs.toArray(new String[0]);

    FlagOption suppressStatusOutOpt = new FlagOption("suppressStatusOut", 'S', SUPPRESS_STATUS_OUT_MSG);

    FlagOption suppressResultOutOpt = new FlagOption("suppressResultOut", 'R', SUPPRESS_RESULT_OUT_MSG);

    IntOption statusUpdateFreqOpt = new IntOption("statusUpdateFrequency", 'F', STATUS_UPDATE_FREQ_MSG, 1000, 0, Integer.MAX_VALUE);

    Option[] extraOptions = new Option[] { suppressStatusOutOpt, suppressResultOutOpt, statusUpdateFreqOpt };

    StringBuilder cliString = new StringBuilder();
    for (String arg : args) {
        cliString.append(" ").append(arg);
    }
    logger.debug("Command line string = {}", cliString.toString());
    System.out.println("Command line string = " + cliString.toString());

    Task task;
    try {
        task = ClassOption.cliStringToObject(cliString.toString(), Task.class, extraOptions);
        logger.info("Successfully instantiating {}", task.getClass().getCanonicalName());
    } catch (Exception e) {
        logger.error("Fail to initialize the task", e);
        System.out.println("Fail to initialize the task" + e);
        return;
    }
    task.setFactory(new SimpleComponentFactory());
    task.init();
    SimpleEngine.submitTopology(task.getTopology());
}
 
Example #5
Source File: AbstractClusterer.java    From samoa with Apache License 2.0 5 votes vote down vote up
public AbstractClusterer() {
	if (isRandomizable()) {
		this.randomSeedOption = new IntOption("randomSeed", 'r',
				"Seed for random behaviour of the Clusterer.", 1);
	}

       if( implementsMicroClusterer()){
           this.evaluateMicroClusteringOption =
                   new FlagOption("evaluateMicroClustering", 'M',
                   "Evaluate the underlying microclustering instead of the macro clustering");
       }
}
 
Example #6
Source File: FlagOptionEditComponent.java    From moa with GNU General Public License v3.0 4 votes vote down vote up
public FlagOptionEditComponent(Option opt) {
    FlagOption option = (FlagOption) opt;
    this.editedOption = option;
    setEditState(this.editedOption.getValueAsCLIString());
}