com.github.javacliparser.IntOption Java Examples
The following examples show how to use
com.github.javacliparser.IntOption.
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 |
/** * 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 |
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: AbstractClassifier.java From incubator-samoa with Apache License 2.0 | 5 votes |
/** * Creates an classifier and setups the random seed option if the classifier is randomizable. */ public AbstractClassifier() { if (isRandomizable()) { this.randomSeedOption = new IntOption("randomSeed", 'r', "Seed for random behaviour of the classifier.", 1); } }
Example #4
Source File: AbstractClusterer.java From moa with GNU General Public License v3.0 | 5 votes |
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 #5
Source File: AbstractClassifier.java From moa with GNU General Public License v3.0 | 5 votes |
/** * Creates an classifier and setups the random seed option * if the classifier is randomizable. */ public AbstractClassifier() { if (isRandomizable()) { this.randomSeedOption = new IntOption("randomSeed", 'r', "Seed for random behaviour of the classifier.", 1); } }
Example #6
Source File: LocalDoTask.java From samoa with Apache License 2.0 | 5 votes |
/** * 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 #7
Source File: AbstractClusterer.java From samoa with Apache License 2.0 | 5 votes |
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 #8
Source File: AbstractClassifier.java From samoa with Apache License 2.0 | 5 votes |
/** * Creates an classifier and setups the random seed option * if the classifier is randomizable. */ public AbstractClassifier() { if (isRandomizable()) { this.randomSeedOption = new IntOption("randomSeed", 'r', "Seed for random behaviour of the classifier.", 1); } }
Example #9
Source File: IntOptionEditComponent.java From moa with GNU General Public License v3.0 | 4 votes |
@Override public void setEditState(String cliString) { this.spinner.setValue(IntOption.cliStringToInt(cliString)); }
Example #10
Source File: SimpleCSVStream.java From moa with GNU General Public License v3.0 | 4 votes |
@Override public void restart() { try { if (fileReader != null) { fileReader.close(); } InputStream fileStream = new FileInputStream( this.csvFileOption.getFile()); this.fileProgressMonitor = new InputStreamProgressMonitor( fileStream); this.fileReader = new BufferedReader(new InputStreamReader( fileProgressMonitor)); String line; do { line = this.fileReader.readLine(); if (line == null) { break; } line = line.trim(); } while (line.isEmpty() || line.charAt(0) == '%' || line.charAt(0) == '@'); if (line != null) { StringTokenizer token = new StringTokenizer(line, splitCharOption.getValue()); this.numTokens = token.countTokens(); this.numAttributes = this.numTokens - (classIndexOption.isSet() ? 1 : 0) + 1; ArrayList<Attribute> attributes = new ArrayList<Attribute>( this.numAttributes); for (int i = 1; i < this.numAttributes; i++) { attributes.add(new Attribute("Dim " + i)); } ArrayList<String> classLabels = new ArrayList<String>(); classLabels.add("0"); attributes.add(new Attribute("class", classLabels)); this.dataset = new Instances(csvFileOption.getFile().getName(), attributes, 0); this.dataset.setClassIndex(this.numAttributes - 1); numAttsOption = new IntOption("numAtts", 'a', "", this.numAttributes); double[] value = new double[this.numAttributes]; for (int i = 0; i < this.numTokens && token.hasMoreTokens(); i++) { value[i] = Double.valueOf(token.nextToken()); } this.lastInstanceRead = new InstanceExample(new DenseInstance(1, value)); this.lastInstanceRead.getData().setDataset(this.dataset); this.numInstancesRead = 0; this.hitEndOfFile = false; } else { this.lastInstanceRead = null; this.numInstancesRead = 0; this.hitEndOfFile = true; } } catch (IOException ioe) { throw new RuntimeException("SimpleCSVStream restart failed.", ioe); } }