List of usage examples for java.lang Integer valueOf
@HotSpotIntrinsicCandidate public static Integer valueOf(int i)
From source file:com.twitter.heron.healthmgr.HealthManager.java
public static void main(String[] args) throws Exception { CommandLineParser parser = new DefaultParser(); Options slaManagerCliOptions = constructCliOptions(); // parse the help options first. Options helpOptions = constructHelpOptions(); CommandLine cmd = parser.parse(helpOptions, args, true); if (cmd.hasOption("h")) { usage(slaManagerCliOptions);/*w ww. j ava 2 s . c o m*/ return; } try { cmd = parser.parse(slaManagerCliOptions, args); } catch (ParseException e) { usage(slaManagerCliOptions); throw new RuntimeException("Error parsing command line options: ", e); } HealthManagerMode mode = HealthManagerMode.cluster; if (hasOption(cmd, CliArgs.MODE)) { mode = HealthManagerMode.valueOf(getOptionValue(cmd, CliArgs.MODE)); } Config config; switch (mode) { case cluster: config = Config.toClusterMode(Config.newBuilder().putAll(ConfigLoader.loadClusterConfig()) .putAll(commandLineConfigs(cmd)).build()); break; case local: if (!hasOption(cmd, CliArgs.HERON_HOME) || !hasOption(cmd, CliArgs.CONFIG_PATH)) { throw new IllegalArgumentException("Missing heron_home or config_path argument"); } String heronHome = getOptionValue(cmd, CliArgs.HERON_HOME); String configPath = getOptionValue(cmd, CliArgs.CONFIG_PATH); config = Config.toLocalMode( Config.newBuilder().putAll(ConfigLoader.loadConfig(heronHome, configPath, null, null)) .putAll(commandLineConfigs(cmd)).build()); break; default: throw new IllegalArgumentException("Invalid mode: " + getOptionValue(cmd, CliArgs.MODE)); } setupLogging(cmd, config); LOG.info("Static Heron config loaded successfully "); LOG.fine(config.toString()); // load the default config value and override with any command line values String metricSourceClassName = config.getStringValue(PolicyConfigKey.METRIC_SOURCE_TYPE.key()); metricSourceClassName = getOptionValue(cmd, CliArgs.METRIC_SOURCE_TYPE, metricSourceClassName); String metricsUrl = config.getStringValue(PolicyConfigKey.METRIC_SOURCE_URL.key()); metricsUrl = getOptionValue(cmd, CliArgs.METRIC_SOURCE_URL, metricsUrl); AbstractModule module = buildMetricsProviderModule(metricsUrl, metricSourceClassName); HealthManager healthManager = new HealthManager(config, module); LOG.info("Initializing health manager"); healthManager.initialize(); LOG.info("Starting Health Manager metirc posting thread"); HealthManagerMetrics publishingMetricsRunnable = null; if (hasOption(cmd, CliArgs.METRICSMGR_PORT)) { publishingMetricsRunnable = new HealthManagerMetrics( Integer.valueOf(getOptionValue(cmd, CliArgs.METRICSMGR_PORT))); } LOG.info("Starting Health Manager"); PoliciesExecutor policyExecutor = new PoliciesExecutor(healthManager.healthPolicies); ScheduledFuture<?> future = policyExecutor.start(); if (publishingMetricsRunnable != null) { new Thread(publishingMetricsRunnable).start(); } try { future.get(); } finally { policyExecutor.destroy(); if (publishingMetricsRunnable != null) { publishingMetricsRunnable.close(); } } }
From source file:com.antbrains.crf.hadoop.ParallelTraining.java
public static void main(String[] args) throws Exception { Configuration conf = new Configuration(); String[] otherArgs = new GenericOptionsParser(conf, args).getRemainingArgs(); if (otherArgs.length != 4) { System.err.println("ParallelTraining <instanceDir> <outDir> <featurecount> <training-params>"); System.exit(-1);/*from www . j a v a2 s . co m*/ } int featureCount = Integer.valueOf(otherArgs[2]); // conf.set("tc", object2String(tc)); conf.set("pt.iterate", "1"); conf.set("pt.featureCount", featureCount + ""); TrainingParams params = SgdCrf.loadParams(otherArgs[3]); System.out.println(new Gson().toJson(params)); conf.set("pt.params", object2String(params)); Job job = new Job(conf, ParallelTraining.class.getSimpleName()); job.setJarByClass(ParallelTraining.class); job.setMapperClass(TrainingMapper.class); job.setReducerClass(TrainingReducer.class); job.setOutputFormatClass(SequenceFileOutputFormat.class); job.setOutputKeyClass(NullWritable.class); job.setOutputValueClass(TrainingWeights.class); FileInputFormat.addInputPath(job, new Path(otherArgs[0])); FileOutputFormat.setOutputPath(job, new Path(otherArgs[1])); System.exit(job.waitForCompletion(true) ? 0 : 1); }
From source file:org.biopax.validator.BiopaxValidatorClient.java
/** * Checks BioPAX files using the online BioPAX Validator. * //from w w w .j a v a2 s . c o m * @see <a href="http://www.biopax.org/validator">BioPAX Validator Webservice</a> * * @param argv * @throws IOException */ public static void main(String[] argv) throws IOException { if (argv.length == 0) { System.err.println("Available parameters: \n" + "<path> <output> [xml|html|biopax] [auto-fix] [only-errors] [maxerrors=n] [notstrict]\n" + "\t- validate a BioPAX file/directory (up to ~25MB in total size, -\n" + "\totherwise, please use the biopax-validator.jar instead)\n" + "\tin the directory using the online BioPAX Validator service\n" + "\t(generates html or xml report, or gets the processed biopax\n" + "\t(cannot fix all errros though) see http://www.biopax.org/validator)"); System.exit(-1); } final String input = argv[0]; final String output = argv[1]; File fileOrDir = new File(input); if (!fileOrDir.canRead()) { System.err.println("Cannot read from " + input); System.exit(-1); } if (output == null || output.isEmpty()) { System.err.println("No output file specified (for the validation report)."); System.exit(-1); } // default options RetFormat outf = RetFormat.HTML; boolean fix = false; Integer maxErrs = null; Behavior level = null; //will report both errors and warnings String profile = null; // match optional arguments for (int i = 2; i < argv.length; i++) { if ("html".equalsIgnoreCase(argv[i])) { outf = RetFormat.HTML; } else if ("xml".equalsIgnoreCase(argv[i])) { outf = RetFormat.XML; } else if ("biopax".equalsIgnoreCase(argv[i])) { outf = RetFormat.OWL; } else if ("auto-fix".equalsIgnoreCase(argv[i])) { fix = true; } else if ("only-errors".equalsIgnoreCase(argv[i])) { level = Behavior.ERROR; } else if ((argv[i]).toLowerCase().startsWith("maxerrors=")) { String num = argv[i].substring(10); maxErrs = Integer.valueOf(num); } else if ("notstrict".equalsIgnoreCase(argv[i])) { profile = "notstrict"; } } // collect files Collection<File> files = new HashSet<File>(); if (fileOrDir.isDirectory()) { // validate all the OWL files in the folder FilenameFilter filter = new FilenameFilter() { public boolean accept(File dir, String name) { return (name.endsWith(".owl")); } }; for (String s : fileOrDir.list(filter)) { files.add(new File(fileOrDir.getCanonicalPath() + File.separator + s)); } } else { files.add(fileOrDir); } // upload and validate using the default URL: http://www.biopax.org/biopax-validator/check.html if (!files.isEmpty()) { BiopaxValidatorClient val = new BiopaxValidatorClient(); val.validate(fix, profile, outf, level, maxErrs, null, files.toArray(new File[] {}), new FileOutputStream(output)); } }
From source file:edu.msu.cme.rdp.alignment.pairwise.PairwiseKNN.java
public static void main(String[] args) throws Exception { File queryFile;/* www . j av a 2 s . c o m*/ File refFile; AlignmentMode mode = AlignmentMode.glocal; int k = 1; int wordSize = 0; int prefilter = 10; // The top p closest protein targets PrintStream out = new PrintStream(System.out); Options options = new Options(); options.addOption("m", "mode", true, "Alignment mode {global, glocal, local, overlap, overlap_trimmed} (default= glocal)"); options.addOption("k", true, "K-nearest neighbors to return. (default = 1)"); options.addOption("o", "out", true, "Redirect output to file instead of stdout"); options.addOption("p", "prefilter", true, "The top p closest targets from kmer prefilter step. Set p=0 to disable the prefilter step. (default = 10) "); options.addOption("w", "word-size", true, "The word size used to find closest targets during prefilter. (default " + ProteinWordGenerator.WORDSIZE + " for protein, " + GoodWordIterator.DEFAULT_WORDSIZE + " for nucleotide)"); try { CommandLine line = new PosixParser().parse(options, args); if (line.hasOption("mode")) { mode = AlignmentMode.valueOf(line.getOptionValue("mode")); } if (line.hasOption('k')) { k = Integer.valueOf(line.getOptionValue('k')); if (k < 1) { throw new Exception("k must be at least 1"); } } if (line.hasOption("word-size")) { wordSize = Integer.parseInt(line.getOptionValue("word-size")); if (wordSize < 3) { throw new Exception("Word size must be at least 3"); } } if (line.hasOption("prefilter")) { prefilter = Integer.parseInt(line.getOptionValue("prefilter")); // prefilter == 0 means no prefilter if (prefilter > 0 && prefilter < k) { throw new Exception("prefilter must be at least as big as k " + k); } } if (line.hasOption("out")) { out = new PrintStream(line.getOptionValue("out")); } args = line.getArgs(); if (args.length != 2) { throw new Exception("Unexpected number of command line arguments"); } queryFile = new File(args[0]); refFile = new File(args[1]); } catch (Exception e) { new HelpFormatter().printHelp("PairwiseKNN <options> <queryFile> <dbFile>", options); System.err.println("ERROR: " + e.getMessage()); return; } PairwiseKNN theObj = new PairwiseKNN(queryFile, refFile, out, mode, k, wordSize, prefilter); theObj.match(); }
From source file:io.anserini.index.UserPostFrequencyDistribution.java
@SuppressWarnings("static-access") public static void main(String[] args) throws Exception { Options options = new Options(); options.addOption(new Option(HELP_OPTION, "show help")); options.addOption(new Option(STORE_TERM_VECTORS_OPTION, "store term vectors")); options.addOption(OptionBuilder.withArgName("collection").hasArg() .withDescription("source collection directory").create(COLLECTION_OPTION)); options.addOption(OptionBuilder.withArgName("property").hasArg() .withDescription("source collection directory").create("property")); options.addOption(OptionBuilder.withArgName("collection_pattern").hasArg() .withDescription("source collection directory").create("collection_pattern")); CommandLine cmdline = null;/*from w w w. jav a2s.com*/ CommandLineParser parser = new GnuParser(); try { cmdline = parser.parse(options, args); } catch (ParseException exp) { System.err.println("Error parsing command line: " + exp.getMessage()); System.exit(-1); } if (cmdline.hasOption(HELP_OPTION) || !cmdline.hasOption(COLLECTION_OPTION)) { HelpFormatter formatter = new HelpFormatter(); formatter.printHelp(UserPostFrequencyDistribution.class.getName(), options); System.exit(-1); } String collectionPath = cmdline.getOptionValue(COLLECTION_OPTION); final FieldType textOptions = new FieldType(); textOptions.setIndexOptions(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS); textOptions.setStored(true); textOptions.setTokenized(true); textOptions.setStoreTermVectors(true); LOG.info("collection: " + collectionPath); LOG.info("collection_pattern " + cmdline.getOptionValue("collection_pattern")); LOG.info("property " + cmdline.getOptionValue("property")); LongOpenHashSet deletes = null; long startTime = System.currentTimeMillis(); File file = new File(collectionPath); if (!file.exists()) { System.err.println("Error: " + file + " does not exist!"); System.exit(-1); } final JsonStatusCorpusReader stream = new JsonStatusCorpusReader(file, cmdline.getOptionValue("collection_pattern")); Runtime.getRuntime().addShutdownHook(new Thread() { public void run() { try { stream.close(); } catch (IOException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } ; System.out.println("# of users indexed this round: " + userIndexedCount); System.out.println("Shutting down"); } }); Status status; boolean readerNotInitialized = true; try { Properties prop = new Properties(); while ((status = stream.next()) != null) { // try{ // status = DataObjectFactory.createStatus(s); // if (status==null||status.getText() == null) { // continue; // }}catch(Exception e){ // // } // boolean pittsburghRelated = false; try { if (Math.abs(status.getLongitude() - pittsburghLongitude) < 0.05d && Math.abs(status.getlatitude() - pittsburghLatitude) < 0.05d) pittsburghRelated = true; } catch (Exception e) { } try { if (status.getPlace().contains("Pittsburgh, PA")) pittsburghRelated = true; } catch (Exception e) { } try { if (status.getUserLocation().contains("Pittsburgh, PA")) pittsburghRelated = true; } catch (Exception e) { } try { if (status.getText().contains("Pittsburgh")) pittsburghRelated = true; } catch (Exception e) { } if (pittsburghRelated) { int previousPostCount = 0; if (prop.containsKey(String.valueOf(status.getUserid()))) { previousPostCount = Integer .valueOf(prop.getProperty(String.valueOf(status.getUserid())).split(" ")[1]); } prop.setProperty(String.valueOf(status.getUserid()), String.valueOf(status.getStatusesCount()) + " " + (1 + previousPostCount)); if (prop.size() > 0 && prop.size() % 1000 == 0) { Runtime runtime = Runtime.getRuntime(); runtime.gc(); System.out.println("Property size " + prop.size() + "Memory used: " + ((runtime.totalMemory() - runtime.freeMemory()) / (1024L * 1024L)) + " MB\n"); } OutputStream output = new FileOutputStream(cmdline.getOptionValue("property"), false); prop.store(output, null); output.close(); } } // prop.store(output, null); LOG.info(String.format("Total of %s statuses added", userIndexedCount)); LOG.info("Total elapsed time: " + (System.currentTimeMillis() - startTime) + "ms"); } catch (Exception e) { e.printStackTrace(); } finally { stream.close(); } }
From source file:Pathway2RDFv2.java
public static void main(String[] args) throws ParserConfigurationException, SAXException, IOException, ServiceException, ClassNotFoundException, IDMapperException, ParseException { int softwareVersion = 0; int schemaVersion = 0; int latestRevision = 0; BioDataSource.init();//from w ww .j ava 2 s. co m Class.forName("org.bridgedb.rdb.IDMapperRdb"); File dir = new File("/Users/andra/Downloads/bridge"); File[] bridgeDbFiles = dir.listFiles(); IDMapperStack mapper = new IDMapperStack(); for (File bridgeDbFile : bridgeDbFiles) { System.out.println(bridgeDbFile.getAbsolutePath()); mapper.addIDMapper("idmapper-pgdb:" + bridgeDbFile.getAbsolutePath()); } Model bridgeDbmodel = ModelFactory.createDefaultModel(); InputStream in = new FileInputStream("/tmp/BioDataSource.ttl"); bridgeDbmodel.read(in, "", "TURTLE"); WikiPathwaysClient client = new WikiPathwaysClient( new URL("http://www.wikipathways.org/wpi/webservice/webservice.php")); basicCalls.printMemoryStatus(); //Map wikipathway organisms to NCBI organisms HashMap<String, String> organismTaxonomy = wpRelatedCalls.getOrganismsTaxonomyMapping(); //HashMap<String, String> miriamSources = new HashMap<String, String>(); // HashMap<String, Str ing> miriamLinks = basicCalls.getMiriamUriBridgeDb(); //Document wikiPathwaysDom = basicCalls.openXmlFile(args[0]); Document wikiPathwaysDom = basicCalls.openXmlFile("/tmp/WpGPML.xml"); //initiate the Jena model to be populated Model model = ModelFactory.createDefaultModel(); Model voidModel = ModelFactory.createDefaultModel(); voidModel.setNsPrefix("xsd", XSD.getURI()); voidModel.setNsPrefix("void", Void.getURI()); voidModel.setNsPrefix("wprdf", "http://rdf.wikipathways.org/"); voidModel.setNsPrefix("pav", Pav.getURI()); voidModel.setNsPrefix("prov", Prov.getURI()); voidModel.setNsPrefix("dcterms", DCTerms.getURI()); voidModel.setNsPrefix("biopax", Biopax_level3.getURI()); voidModel.setNsPrefix("gpml", Gpml.getURI()); voidModel.setNsPrefix("wp", Wp.getURI()); voidModel.setNsPrefix("foaf", FOAF.getURI()); voidModel.setNsPrefix("hmdb", "http://identifiers.org/hmdb/"); voidModel.setNsPrefix("freq", Freq.getURI()); voidModel.setNsPrefix("dc", DC.getURI()); setModelPrefix(model); //Populate void.ttl Calendar now = Calendar.getInstance(); Literal nowLiteral = voidModel.createTypedLiteral(now); Literal titleLiteral = voidModel.createLiteral("WikiPathways-RDF VoID Description", "en"); Literal descriptionLiteral = voidModel .createLiteral("This is the VoID description for a WikiPathwyas-RDF dataset.", "en"); Resource voidBase = voidModel.createResource("http://rdf.wikipathways.org/"); Resource identifiersOrg = voidModel.createResource("http://identifiers.org"); Resource wpHomeBase = voidModel.createResource("http://www.wikipathways.org/"); Resource authorResource = voidModel .createResource("http://semantics.bigcat.unimaas.nl/figshare/search_author.php?author=waagmeester"); Resource apiResource = voidModel .createResource("http://www.wikipathways.org/wpi/webservice/webservice.php"); Resource mainDatadump = voidModel.createResource("http://rdf.wikipathways.org/wpContent.ttl.gz"); Resource license = voidModel.createResource("http://creativecommons.org/licenses/by/3.0/"); Resource instituteResource = voidModel.createResource("http://dbpedia.org/page/Maastricht_University"); voidBase.addProperty(RDF.type, Void.Dataset); voidBase.addProperty(DCTerms.title, titleLiteral); voidBase.addProperty(DCTerms.description, descriptionLiteral); voidBase.addProperty(FOAF.homepage, wpHomeBase); voidBase.addProperty(DCTerms.license, license); voidBase.addProperty(Void.uriSpace, voidBase); voidBase.addProperty(Void.uriSpace, identifiersOrg); voidBase.addProperty(Pav.importedBy, authorResource); voidBase.addProperty(Pav.importedFrom, apiResource); voidBase.addProperty(Pav.importedOn, nowLiteral); voidBase.addProperty(Void.dataDump, mainDatadump); voidBase.addProperty(Voag.frequencyOfChange, Freq.Irregular); voidBase.addProperty(Pav.createdBy, authorResource); voidBase.addProperty(Pav.createdAt, instituteResource); voidBase.addLiteral(Pav.createdOn, nowLiteral); voidBase.addProperty(DCTerms.subject, Biopax_level3.Pathway); voidBase.addProperty(Void.exampleResource, voidModel.createResource("http://identifiers.org/ncbigene/2678")); voidBase.addProperty(Void.exampleResource, voidModel.createResource("http://identifiers.org/pubmed/15215856")); voidBase.addProperty(Void.exampleResource, voidModel.createResource("http://identifiers.org/hmdb/HMDB02005")); voidBase.addProperty(Void.exampleResource, voidModel.createResource("http://rdf.wikipathways.org/WP15")); voidBase.addProperty(Void.exampleResource, voidModel.createResource("http://identifiers.org/obo.chebi/17242")); for (String organism : organismTaxonomy.values()) { voidBase.addProperty(DCTerms.subject, voidModel.createResource("http://dbpedia.org/page/" + organism.replace(" ", "_"))); } voidBase.addProperty(Void.vocabulary, Biopax_level3.NAMESPACE); voidBase.addProperty(Void.vocabulary, voidModel.createResource(Wp.getURI())); voidBase.addProperty(Void.vocabulary, voidModel.createResource(Gpml.getURI())); voidBase.addProperty(Void.vocabulary, FOAF.NAMESPACE); voidBase.addProperty(Void.vocabulary, Pav.NAMESPACE); //Custom Properties String baseUri = "http://rdf.wikipathways.org/"; NodeList pathwayElements = wikiPathwaysDom.getElementsByTagName("Pathway"); //BioDataSource.init(); for (int i = 0; i < pathwayElements.getLength(); i++) { Model pathwayModel = createPathwayModel(); String wpId = pathwayElements.item(i).getAttributes().getNamedItem("identifier").getTextContent(); String revision = pathwayElements.item(i).getAttributes().getNamedItem("revision").getTextContent(); String pathwayOrganism = ""; if (pathwayElements.item(i).getAttributes().getNamedItem("Organism") != null) pathwayOrganism = pathwayElements.item(i).getAttributes().getNamedItem("Organism").getTextContent() .trim(); if (Integer.valueOf(revision) > latestRevision) { latestRevision = Integer.valueOf(revision); } File f = new File("/tmp/" + args[0] + "/" + wpId + "_r" + revision + ".ttl"); System.out.println(f.getName()); if (!f.exists()) { Resource voidPwResource = wpRelatedCalls.addVoidTriples(voidModel, voidBase, pathwayElements.item(i), client); Resource pwResource = wpRelatedCalls.addPathwayLevelTriple(pathwayModel, pathwayElements.item(i), organismTaxonomy); // Get the comments NodeList commentElements = ((Element) pathwayElements.item(i)).getElementsByTagName("Comment"); wpRelatedCalls.addCommentTriples(pathwayModel, pwResource, commentElements, wpId, revision); // Get the Groups NodeList groupElements = ((Element) pathwayElements.item(i)).getElementsByTagName("Group"); for (int n = 0; n < groupElements.getLength(); n++) { wpRelatedCalls.addGroupTriples(pathwayModel, pwResource, groupElements.item(n), wpId, revision); } // Get all the Datanodes NodeList dataNodesElement = ((Element) pathwayElements.item(i)).getElementsByTagName("DataNode"); for (int j = 0; j < dataNodesElement.getLength(); j++) { wpRelatedCalls.addDataNodeTriples(pathwayModel, pwResource, dataNodesElement.item(j), wpId, revision, bridgeDbmodel, mapper); } // Get all the lines NodeList linesElement = ((Element) pathwayElements.item(i)).getElementsByTagName("Line"); for (int k = 0; k < linesElement.getLength(); k++) { wpRelatedCalls.addLineTriples(pathwayModel, pwResource, linesElement.item(k), wpId, revision); } //Get all the labels NodeList labelsElement = ((Element) pathwayElements.item(i)).getElementsByTagName("Label"); for (int l = 0; l < labelsElement.getLength(); l++) { wpRelatedCalls.addLabelTriples(pathwayModel, pwResource, labelsElement.item(l), wpId, revision); } NodeList referenceElements = ((Element) pathwayElements.item(i)) .getElementsByTagName("bp:PublicationXref"); for (int m = 0; m < referenceElements.getLength(); m++) { wpRelatedCalls.addReferenceTriples(pathwayModel, pwResource, referenceElements.item(m), wpId, revision); } NodeList referenceElements2 = ((Element) pathwayElements.item(i)) .getElementsByTagName("bp:publicationXref"); for (int m = 0; m < referenceElements2.getLength(); m++) { wpRelatedCalls.addReferenceTriples(pathwayModel, pwResource, referenceElements2.item(m), wpId, revision); } NodeList referenceElements3 = ((Element) pathwayElements.item(i)) .getElementsByTagName("bp:PublicationXRef"); for (int m = 0; m < referenceElements3.getLength(); m++) { wpRelatedCalls.addReferenceTriples(pathwayModel, pwResource, referenceElements3.item(m), wpId, revision); } NodeList ontologyElements = ((Element) pathwayElements.item(i)) .getElementsByTagName("bp:openControlledVocabulary"); for (int n = 0; n < ontologyElements.getLength(); n++) { wpRelatedCalls.addPathwayOntologyTriples(pathwayModel, pwResource, ontologyElements.item(n)); } System.out.println(wpId); basicCalls.saveRDF2File(pathwayModel, "/tmp/" + args[0] + "/" + wpId + "_r" + revision + ".ttl", "TURTLE"); model.add(pathwayModel); pathwayModel.removeAll(); } } Date myDate = new Date(); SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd"); String myDateString = sdf.format(myDate); FileUtils.writeStringToFile(new File("latestVersion.txt"), "v" + schemaVersion + "." + softwareVersion + "." + latestRevision + "_" + myDateString); basicCalls.saveRDF2File(model, "/tmp/wpContent_v" + schemaVersion + "." + softwareVersion + "." + latestRevision + "_" + myDateString + ".ttl", "TURTLE"); basicCalls.saveRDF2File(voidModel, "/tmp/void.ttl", "TURTLE"); }
From source file:de.tudarmstadt.ukp.teaching.uima.nounDecompounding.web1t.LuceneIndexer.java
/** * Execute the indexer. Following parameter are allowed: * //w w w. j av a2s . co m * * --web1t The folder with all extracted n-gram files * * --outputPath The lucene index folder * * --index (optional) Number of how many indexes should be created. Default: 1 * * @param args */ @SuppressWarnings("static-access") public static void main(String[] args) { Options options = new Options(); options.addOption(OptionBuilder.withLongOpt("web1t") .withDescription("Folder with the web1t extracted documents").hasArg().isRequired().create()); options.addOption(OptionBuilder.withLongOpt("outputPath") .withDescription("File, where the index should be created").hasArg().isRequired().create()); options.addOption(OptionBuilder.withLongOpt("index") .withDescription("(optional) Number of how many indexes should be created. Default: 1").hasArg() .create()); options.addOption(OptionBuilder.withLongOpt("igerman98").withDescription( "(optional) If this argument is set, only words of the german dictionary will be added to the index") .create()); CommandLineParser parser = new PosixParser(); try { CommandLine cmd = parser.parse(options, args); int i = 1; if (cmd.hasOption("index")) { i = Integer.valueOf(cmd.getOptionValue("index")); } LuceneIndexer indexer = new LuceneIndexer(new File(cmd.getOptionValue("web1t")), new File(cmd.getOptionValue("outputPath")), i); if (cmd.hasOption("igerman98")) { indexer.setDictionary(new IGerman98Dictionary(new File("src/main/resources/de_DE.dic"), new File("src/main/resources/de_DE.aff"))); } indexer.index(); } catch (Exception e) { System.err.println("Error: " + e.getMessage()); HelpFormatter formatter = new HelpFormatter(); formatter.printHelp("LuceneIndexer", options); } }
From source file:Main.java
public static void staticMethod() { Integer intObj1 = Integer.valueOf(100); Integer intObj2 = Integer.valueOf("2014"); Double doubleObj1 = Double.valueOf(10.45); Double doubleObj2 = Double.valueOf("234.56"); Character charObj1 = Character.valueOf('A'); }
From source file:Main.java
public static int parseInt(String integer) { return Integer.valueOf(integer); }
From source file:Main.java
public static int calcRegistID(String strID) { int intID = Integer.valueOf(strID).intValue(); return (intID - 65535) / 255; }