List of usage examples for java.lang IllegalArgumentException IllegalArgumentException
public IllegalArgumentException(Throwable cause)
From source file:net.anthonypoon.ngram.rollingregression.Main.java
public static void main(String[] args) throws Exception { Options options = new Options(); options.addOption("a", "action", true, "Action"); options.addOption("i", "input", true, "input"); options.addOption("o", "output", true, "output"); //options.addOption("f", "format", true, "Format"); options.addOption("u", "upbound", true, "Year up bound"); options.addOption("l", "lowbound", true, "Year low bound"); options.addOption("r", "range", true, "Range"); options.addOption("T", "threshold", true, "Threshold - min count for regression"); options.addOption("p", "positive-only", false, "Write positive slope only"); // default faluse CommandLineParser parser = new GnuParser(); CommandLine cmd = parser.parse(options, args); Configuration conf = new Configuration(); if (cmd.hasOption("range")) { conf.set("range", cmd.getOptionValue("range")); }/*from w ww. j a v a 2s. c om*/ if (cmd.hasOption("upbound")) { conf.set("upbound", cmd.getOptionValue("upbound")); } else { conf.set("upbound", "9999"); } if (cmd.hasOption("lowbound")) { conf.set("lowbound", cmd.getOptionValue("lowbound")); } else { conf.set("lowbound", "0"); } if (cmd.hasOption("threshold")) { conf.set("threshold", cmd.getOptionValue("threshold")); } if (cmd.hasOption("positive-only")) { conf.set("positive-only", "true"); } Job job = Job.getInstance(conf); /** if (cmd.hasOption("format")) { switch (cmd.getOptionValue("format")) { case "compressed": job.setInputFormatClass(SequenceFileAsTextInputFormat.class); break; case "text": job.setInputFormatClass(KeyValueTextInputFormat.class); break; } }**/ job.setJarByClass(Main.class); switch (cmd.getOptionValue("action")) { case "get-regression": job.setOutputKeyClass(Text.class); job.setOutputValueClass(Text.class); for (String inputPath : cmd.getOptionValue("input").split(",")) { MultipleInputs.addInputPath(job, new Path(inputPath), KeyValueTextInputFormat.class, RollingRegressionMapper.class); } job.setReducerClass(RollingRegressionReducer.class); break; default: throw new IllegalArgumentException("Missing action"); } String timestamp = new SimpleDateFormat("yyyy_MM_dd_HH_mm_ss").format(new Date()); //FileInputFormat.setInputPaths(job, new Path(cmd.getOptionValue("input"))); FileOutputFormat.setOutputPath(job, new Path(cmd.getOptionValue("output") + "/" + timestamp)); System.exit(job.waitForCompletion(true) ? 0 : 1); /** double[] nazismBaseLine = {3, 12, 12, 18, 233, 239, 386, 333, 593, 1244, 1925, 3013, 3120, 3215, 3002, 3355, 2130, 1828, 1406, 1751, 1433, 1033, 881, 1330, 1029, 760, 1288, 1013, 1014}; InputStream inStream = Main.class.getResourceAsStream("/1g-matrix.txt"); BufferedReader br = new BufferedReader(new InputStreamReader(inStream)); String line = ""; Map<String, Double> result = new HashMap(); while ((line = br.readLine()) != null) { String[] strArray = line.split("\t"); double[] compareArray = new double[nazismBaseLine.length]; for (int i = 0; i < nazismBaseLine.length; i ++) { compareArray[i] = Double.valueOf(strArray[i + 24]); } result.put(strArray[0], new PearsonsCorrelation().correlation(nazismBaseLine, compareArray)); } List<Map.Entry<String, Double>> toBeSorted = new ArrayList(); for (Map.Entry pair : result.entrySet()) { toBeSorted.add(pair); } Collections.sort(toBeSorted, new Comparator<Map.Entry<String, Double>>(){ @Override public int compare(Map.Entry<String, Double> o1, Map.Entry<String, Double> o2) { return o2.getValue().compareTo(o1.getValue()); } }); for (Map.Entry<String, Double> pair : toBeSorted) { if (!Double.isNaN(pair.getValue())) { System.out.println(pair.getKey() + "\t" + pair.getValue()); } }**/ }
From source file:com.schnobosoft.semeval.cortical.SemEvalTextSimilarity.java
public static void main(String[] args) throws IOException, ApiException { /* read command line arguments (input file and API key) */ String apiKey;//from w w w .jav a 2 s . com File inputFile; Retina retinaName; if (args.length >= 2) { inputFile = new File(args[0]); assert inputFile.getName().startsWith(INPUT_FILE_PREFIX); apiKey = args[1]; retinaName = (args.length > 2 && args[2].toLowerCase().startsWith("syn")) ? EN_SYNONYMOUS : DEFAULT_RETINA_NAME; } else { throw new IllegalArgumentException( "Call: " + SemEvalTextSimilarity.class.getCanonicalName() + " <input file> <api key> [<syn>]"); } LOG.info("Using Retina " + retinaName.name().toLowerCase() + " at " + Util.RETINA_IP + "."); CompareModels[] input = readInput(inputFile); RetinaApis api = Util.getApi(apiKey, retinaName, Util.RETINA_IP); Metric[] scores = compare(input, api); assert input.length == scores.length; saveScores(scores, inputFile, retinaName); }
From source file:uk.dsxt.voting.tests.TestDataGenerator.java
public static void main(String[] args) { try {/*from w w w . ja v a 2s .c o m*/ if (args.length == 1) { generateCredentialsJSON(); return; } if (args.length > 0 && args.length < 10) { System.out.println( "<name> <totalParticipant> <holdersCount> <vmCount> <levelsCount> <minutes> <generateVotes> <victimsCount>"); throw new IllegalArgumentException("Invalid arguments count exception."); } int argId = 0; String name = args.length == 0 ? "ss_10_100000_30" : args[argId++]; int totalParticipant = args.length == 0 ? 100000 : Integer.parseInt(args[argId++]); int holdersCount = args.length == 0 ? 10 : Integer.parseInt(args[argId++]); int vmCount = args.length == 0 ? 1 : Integer.parseInt(args[argId++]); int levelsCount = args.length == 0 ? 3 : Integer.parseInt(args[argId++]); int minutes = args.length == 0 ? 30 : Integer.parseInt(args[argId++]); boolean generateVotes = args.length == 0 ? true : Boolean.parseBoolean(args[argId++]); int victimsCount = args.length == 0 ? 0 : Integer.parseInt(args[argId++]); boolean generateDisconnect = args.length == 0 ? false : Boolean.parseBoolean(args[argId++]); int disconnectNodes = args.length == 0 ? 0 : Integer.parseInt(args[argId]); TestDataGenerator generator = new TestDataGenerator(); generator.generate(name, totalParticipant, holdersCount, vmCount, levelsCount, minutes, generateVotes, victimsCount, generateDisconnect, disconnectNodes); } catch (Exception e) { log.error("Test generation was failed.", e); } }
From source file:com.l2jfree.loginserver.tools.L2GameServerRegistrar.java
/** * Launches the interactive game server registration. * /*from www . ja va 2 s . c o m*/ * @param args ignored */ public static void main(String[] args) { // LOW rework this crap Util.printSection("Game Server Registration"); _log.info("Please choose:"); _log.info("list - list registered game servers"); _log.info("reg - register a game server"); _log.info("rem - remove a registered game server"); _log.info("hexid - generate a legacy hexid file"); _log.info("quit - exit this application"); BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); L2GameServerRegistrar reg = new L2GameServerRegistrar(); String line; try { RegistrationState next = RegistrationState.INITIAL_CHOICE; while ((line = br.readLine()) != null) { line = line.trim().toLowerCase(); switch (reg.getState()) { case GAMESERVER_ID: try { int id = Integer.parseInt(line); if (id < 1 || id > 127) throw new IllegalArgumentException("ID must be in [1;127]."); reg.setId(id); reg.setState(next); } catch (RuntimeException e) { _log.info("You must input a number between 1 and 127"); } if (reg.getState() == RegistrationState.ALLOW_BANS) { Connection con = null; try { con = L2Database.getConnection(); PreparedStatement ps = con .prepareStatement("SELECT allowBans FROM gameserver WHERE id = ?"); ps.setInt(1, reg.getId()); ResultSet rs = ps.executeQuery(); if (rs.next()) { _log.info("A game server is already registered on ID " + reg.getId()); reg.setState(RegistrationState.INITIAL_CHOICE); } else _log.info("Allow account bans from this game server? [y/n]:"); ps.close(); } catch (SQLException e) { _log.error("Could not remove a game server!", e); } finally { L2Database.close(con); } } else if (reg.getState() == RegistrationState.REMOVE) { Connection con = null; try { con = L2Database.getConnection(); PreparedStatement ps = con.prepareStatement("DELETE FROM gameserver WHERE id = ?"); ps.setInt(1, reg.getId()); int cnt = ps.executeUpdate(); if (cnt == 0) _log.info("No game server registered on ID " + reg.getId()); else _log.info("Game server removed."); ps.close(); } catch (SQLException e) { _log.error("Could not remove a game server!", e); } finally { L2Database.close(con); } reg.setState(RegistrationState.INITIAL_CHOICE); } else if (reg.getState() == RegistrationState.GENERATE) { Connection con = null; try { con = L2Database.getConnection(); PreparedStatement ps = con .prepareStatement("SELECT authData FROM gameserver WHERE id = ?"); ps.setInt(1, reg.getId()); ResultSet rs = ps.executeQuery(); if (rs.next()) { reg.setAuth(rs.getString("authData")); byte[] b = HexUtil.hexStringToBytes(reg.getAuth()); Properties pro = new Properties(); pro.setProperty("ServerID", String.valueOf(reg.getId())); pro.setProperty("HexID", HexUtil.hexToString(b)); BufferedOutputStream os = new BufferedOutputStream( new FileOutputStream("hexid.txt")); pro.store(os, "the hexID to auth into login"); IOUtils.closeQuietly(os); _log.info("hexid.txt has been generated."); } else _log.info("No game server registered on ID " + reg.getId()); rs.close(); ps.close(); } catch (SQLException e) { _log.error("Could not generate hexid.txt!", e); } finally { L2Database.close(con); } reg.setState(RegistrationState.INITIAL_CHOICE); } break; case ALLOW_BANS: try { if (line.length() != 1) throw new IllegalArgumentException("One char required."); else if (line.charAt(0) == 'y') reg.setTrusted(true); else if (line.charAt(0) == 'n') reg.setTrusted(false); else throw new IllegalArgumentException("Invalid choice."); byte[] auth = Rnd.nextBytes(new byte[BYTES]); reg.setAuth(HexUtil.bytesToHexString(auth)); Connection con = null; try { con = L2Database.getConnection(); PreparedStatement ps = con.prepareStatement( "INSERT INTO gameserver (id, authData, allowBans) VALUES (?, ?, ?)"); ps.setInt(1, reg.getId()); ps.setString(2, reg.getAuth()); ps.setBoolean(3, reg.isTrusted()); ps.executeUpdate(); ps.close(); _log.info("Registered game server on ID " + reg.getId()); _log.info("The authorization string is:"); _log.info(reg.getAuth()); _log.info("Use it when registering this login server."); _log.info("If you need a legacy hexid file, use the 'hexid' command."); } catch (SQLException e) { _log.error("Could not register gameserver!", e); } finally { L2Database.close(con); } reg.setState(RegistrationState.INITIAL_CHOICE); } catch (IllegalArgumentException e) { _log.info("[y/n]?"); } break; default: if (line.equals("list")) { Connection con = null; try { con = L2Database.getConnection(); PreparedStatement ps = con.prepareStatement("SELECT id, allowBans FROM gameserver"); ResultSet rs = ps.executeQuery(); while (rs.next()) _log.info("ID: " + rs.getInt("id") + ", trusted: " + rs.getBoolean("allowBans")); rs.close(); ps.close(); } catch (SQLException e) { _log.error("Could not register gameserver!", e); } finally { L2Database.close(con); } reg.setState(RegistrationState.INITIAL_CHOICE); } else if (line.equals("reg")) { _log.info("Enter the desired ID:"); reg.setState(RegistrationState.GAMESERVER_ID); next = RegistrationState.ALLOW_BANS; } else if (line.equals("rem")) { _log.info("Enter game server ID:"); reg.setState(RegistrationState.GAMESERVER_ID); next = RegistrationState.REMOVE; } else if (line.equals("hexid")) { _log.info("Enter game server ID:"); reg.setState(RegistrationState.GAMESERVER_ID); next = RegistrationState.GENERATE; } else if (line.equals("quit")) Shutdown.exit(TerminationStatus.MANUAL_SHUTDOWN); else _log.info("Incorrect command."); break; } } } catch (IOException e) { _log.fatal("Could not process input!", e); } finally { IOUtils.closeQuietly(br); } }
From source file:client.tools.ClientRecovery.java
/** * Starts the recovery process at the given client folder. * /*from ww w . ja va 2 s . com*/ * @param args * the path to the configuration file. */ public static void main(String[] args) { Path configPath; if (args.length != 1) { throw new IllegalArgumentException("Path to configuration file must be present!"); } configPath = Paths.get(args[0]); try { ClientConfiguration config = ClientConfiguration.parse(configPath); ClientRecovery recovery = new ClientRecovery(Paths.get(config.getRootPath()), Paths.get(config.getSyncPath())); recovery.execute(); } catch (IOException | ParseException e) { e.printStackTrace(); } }
From source file:evalita.q4faq.baseline.Index.java
/** * @param args the command line arguments *//*from w w w . j a v a 2 s . c om*/ public static void main(String[] args) { try { if (args.length > 1) { Reader in = new FileReader(args[0]); IndexWriterConfig config = new IndexWriterConfig(Version.LATEST, new ItalianAnalyzer()); IndexWriter writer = new IndexWriter(FSDirectory.open(new File(args[1])), config); Iterable<CSVRecord> records = CSVFormat.EXCEL.withHeader().withDelimiter(';').parse(in); for (CSVRecord record : records) { int id = Integer.parseInt(record.get("id")); String question = record.get("question"); String answer = record.get("answer"); String tag = record.get("tag"); Document doc = new Document(); doc.add(new StringField("id", String.valueOf(id), Field.Store.YES)); doc.add(new TextField("question", question, Field.Store.NO)); doc.add(new TextField("answer", answer, Field.Store.NO)); doc.add(new TextField("tag", tag.replace(",", " "), Field.Store.NO)); writer.addDocument(doc); } writer.close(); } else { throw new IllegalArgumentException("Number of arguments not valid"); } } catch (IOException | IllegalArgumentException ex) { Logger.getLogger(Index.class.getName()).log(Level.SEVERE, null, ex); } }
From source file:net.recommenders.plista.client.Client.java
/** * This method starts the server//ww w. jav a2 s . c o m * * @param args * @throws Exception */ public static void main(String[] args) throws Exception { final Properties properties = new Properties(); String fileName = ""; String recommenderClass = null; String handlerClass = null; if (args.length < 3) { fileName = System.getProperty("propertyFile"); } else { fileName = args[0]; recommenderClass = args[1]; handlerClass = args[2]; } // load the team properties try { properties.load(new FileInputStream(fileName)); } catch (IOException e) { logger.error(e.getMessage()); } catch (Exception e) { logger.error(e.getMessage()); } Recommender recommender = null; recommenderClass = (recommenderClass != null ? recommenderClass : properties.getProperty("plista.recommender")); System.out.println(recommenderClass); lognum = Integer.parseInt(properties.getProperty("plista.lognum")); try { final Class<?> transformClass = Class.forName(recommenderClass); recommender = (Recommender) transformClass.newInstance(); } catch (Exception e) { logger.error(e.getMessage()); throw new IllegalArgumentException("No recommender specified or recommender not available."); } // configure log4j /*if (args.length >= 4 && args[3] != null) { PropertyConfigurator.configure(args[0]); } else { PropertyConfigurator.configure("log4j.properties"); }*/ // set up and start server AbstractHandler handler = null; handlerClass = (handlerClass != null ? handlerClass : properties.getProperty("plista.handler")); System.out.println(handlerClass); try { final Class<?> transformClass = Class.forName(handlerClass); handler = (AbstractHandler) transformClass.getConstructor(Properties.class, Recommender.class) .newInstance(properties, recommender); } catch (Exception e) { logger.error(e.getMessage()); e.printStackTrace(); throw new IllegalArgumentException("No handler specified or handler not available."); } final Server server = new Server(Integer.parseInt(properties.getProperty("plista.port", "8080"))); server.setHandler(handler); logger.debug("Serverport " + server.getConnectors()[0].getPort()); server.start(); server.join(); }
From source file:org.datagator.tools.importer.Main.java
public static void main(String[] args) throws IOException { int columnHeaders = 0; // cli input int rowHeaders = 0; // cli input try {// w w w . j a v a 2 s . c o m CommandLine cmds = parser.parse(opts, args); if (cmds.hasOption("filter")) { throw new UnsupportedOperationException("Not supported yet."); } if (cmds.hasOption("layout")) { String[] layout = cmds.getOptionValues("layout"); if ((layout == null) || (layout.length != 2)) { throw new IllegalArgumentException("Bad layout."); } try { columnHeaders = Integer.valueOf(layout[0]); rowHeaders = Integer.valueOf(layout[1]); if ((columnHeaders < 0) || (rowHeaders < 0)) { throw new IllegalArgumentException("Bad layout."); } } catch (NumberFormatException ex) { throw new IllegalArgumentException(ex); } } if (cmds.hasOption("help")) { help.printHelp("importer", opts, true); System.exit(EX_OK); } // positional arguments, i.e., input file name(s) args = cmds.getArgs(); } catch (ParseException ex) { throw new IllegalArgumentException(ex); } catch (IllegalArgumentException ex) { help.printHelp("importer", opts, true); throw ex; } JsonGenerator jg = json.createGenerator(System.out, JsonEncoding.UTF8); jg.setPrettyPrinter(new StandardPrinter()); final Extractor extractor; if (args.length == 1) { extractor = new FileExtractor(new File(args[0])); } else if (args.length > 1) { throw new UnsupportedOperationException("Not supported yet."); } else { throw new IllegalArgumentException("Missing input."); } int columnsCount = -1; int matrixCount = 0; ArrayDeque<String> stack = new ArrayDeque<String>(); AtomType token = extractor.nextAtom(); while (token != null) { switch (token) { case FLOAT: case INTEGER: case STRING: case NULL: jg.writeObject(extractor.getCurrentAtomData()); break; case START_RECORD: jg.writeStartArray(); break; case END_RECORD: int _numFields = (Integer) extractor.getCurrentAtomData(); if (columnsCount < 0) { columnsCount = _numFields; } else if (columnsCount != _numFields) { throw new RuntimeException(String.format("row %s has different length than previous rows", String.valueOf(_numFields - 1))); } jg.writeEndArray(); break; case START_GROUP: stack.push(String.valueOf(extractor.getCurrentAtomData())); jg.writeStartObject(); jg.writeStringField("kind", "datagator#Matrix"); jg.writeNumberField("columnHeaders", columnHeaders); jg.writeNumberField("rowHeaders", rowHeaders); jg.writeFieldName("rows"); jg.writeStartArray(); break; case END_GROUP: int rowsCount = (Integer) extractor.getCurrentAtomData(); if (rowsCount == 0) { jg.writeStartArray(); jg.writeEndArray(); rowsCount = 1; columnsCount = 0; } jg.writeEndArray(); jg.writeNumberField("rowsCount", rowsCount); jg.writeNumberField("columnsCount", columnsCount); jg.writeEndObject(); matrixCount += 1; stack.pop(); break; default: break; } token = extractor.nextAtom(); } jg.close(); System.exit(EX_OK); }
From source file:Manifest.java
public static void main(String[] args) throws Exception { // Set the default values of the command-line arguments boolean verify = false; // Verify manifest or create one? String manifestfile = "MANIFEST"; // Manifest file name String digestAlgorithm = "MD5"; // Algorithm for message digests String signername = null; // Signer. No sig. by default String signatureAlgorithm = "DSA"; // Algorithm for digital sig. String password = null; // Private keys are protected File keystoreFile = null; // Where are keys stored String keystoreType = null; // What kind of keystore String keystorePassword = null; // How to access keystore List filelist = new ArrayList(); // The files to digest // Parse the command-line arguments, overriding the defaults above for (int i = 0; i < args.length; i++) { if (args[i].equals("-v")) verify = true;//from www . ja va 2 s. c om else if (args[i].equals("-m")) manifestfile = args[++i]; else if (args[i].equals("-da") && !verify) digestAlgorithm = args[++i]; else if (args[i].equals("-s") && !verify) signername = args[++i]; else if (args[i].equals("-sa") && !verify) signatureAlgorithm = args[++i]; else if (args[i].equals("-p")) password = args[++i]; else if (args[i].equals("-keystore")) keystoreFile = new File(args[++i]); else if (args[i].equals("-keystoreType")) keystoreType = args[++i]; else if (args[i].equals("-keystorePassword")) keystorePassword = args[++i]; else if (!verify) filelist.add(args[i]); else throw new IllegalArgumentException(args[i]); } // If certain arguments weren't supplied, get default values. if (keystoreFile == null) { File dir = new File(System.getProperty("user.home")); keystoreFile = new File(dir, ".keystore"); } if (keystoreType == null) keystoreType = KeyStore.getDefaultType(); if (keystorePassword == null) keystorePassword = password; if (!verify && signername != null && password == null) { System.out.println("Use -p to specify a password."); return; } // Get the keystore we'll use for signing or verifying signatures // If no password was provided, then assume we won't be dealing with // signatures, and skip the keystore. KeyStore keystore = null; if (keystorePassword != null) { keystore = KeyStore.getInstance(keystoreType); InputStream in = new BufferedInputStream(new FileInputStream(keystoreFile)); keystore.load(in, keystorePassword.toCharArray()); } // If -v was specified or no file were given, verify a manifest // Otherwise, create a new manifest for the specified files if (verify || (filelist.size() == 0)) verify(manifestfile, keystore); else create(manifestfile, digestAlgorithm, signername, signatureAlgorithm, keystore, password, filelist); }
From source file:com.incapture.rapgen.GenApi.java
public static void main(String[] args) { Options options = new Options(); options.addOption("l", true, "Language to generate"); options.addOption("o", true, "Output root folder for kernel files"); options.addOption("a", true, "Output root folder for api files"); options.addOption("w", true, "Output root folder for web files"); options.addOption("d", true, "Template dir to use (use either this or 't')"); options.addOption("t", true, "Template file to use (use either this or 'd')"); options.addOption("g", true, "The type of grammar to generate, current options are 'SDK' or 'API'"); options.addOption("mainApiFile", true, "FileName specifying the api"); options.addOption("codeSamplesJava", true, "A path to search for files that have Java code samples"); options.addOption("codeSamplesPython", true, "A path to search for files that have Python code samples"); CommandLineParser cparser = new PosixParser(); try {//from w w w . j ava 2 s . c om CommandLine cmd = cparser.parse(options, args); String mainApiFile = cmd.getOptionValue("mainApiFile"); String outputKernelFolder = cmd.getOptionValue('o'); String outputApiFolder = cmd.getOptionValue('a'); String outputWebFolder = cmd.getOptionValue('w'); String codeSamplesJava = cmd.getOptionValue("codeSamplesJava"); String codeSamplesPython = cmd.getOptionValue("codeSamplesPython"); GenType genType = GenType.valueOf(cmd.getOptionValue('g')); // The language will ultimately choose the walker class String language = cmd.getOptionValue('l'); if (cmd.hasOption('d') && cmd.hasOption('t')) { throw new IllegalArgumentException( "Cannot define both a template folder ('d') and file ('t'). Please use one OR the other."); } // And off we go TLexer lexer = new TLexer(); ResourceBasedApiReader apiReader = new ResourceBasedApiReader(); lexer.setApiReader(apiReader); lexer.setCharStream(apiReader.read(mainApiFile)); // Using the lexer as the token source, we create a token // stream to be consumed by the parser // CommonTokenStream tokens = new CommonTokenStream(lexer); // Now we need an instance of our parser // TParser parser = new TParser(tokens); hmxdef_return psrReturn = parser.hmxdef(); // load in T.stg template group, put in templates variable StringTemplateGroup templates = null; if (!isSlateMd(language)) { templates = TemplateRepo.getTemplates(language, genType); } Tree t = psrReturn.getTree(); CommonTreeNodeStream ns = new CommonTreeNodeStream(t); ns.setTokenStream(tokens); if (templates != null) { templates.registerRenderer(String.class, new UpCaseRenderer()); } AbstractTTree walker = TreeFactory.createTreeWalker(ns, templates, language); System.out.println("Generating files with a " + walker.getClass().getName()); if (walker instanceof TTree) { if (genType.equals(GenType.API)) { ((TTree) walker).apiGen(); } else { ((TTree) walker).sdkGen(); } } else if (walker instanceof TTreeRuby) { System.out.println("Running for Ruby"); /* TTreeRuby.hmxdef_return out = */ ((TTreeRuby) walker).hmxdef(); } else if (walker instanceof TTreeJS) { System.out.println("Running for JavaScript"); /* TTreeJS.hmxdef_return out = */ ((TTreeJS) walker).hmxdef(); } else if (walker instanceof TTreeDoc) { System.out.println("Running for Documentation"); /* TTreeDoc.hmxdef_return out = */ ((TTreeDoc) walker).hmxdef(); } else if (walker instanceof TTreeVB) { System.out.println("Running for VB"); /* TTreeVB.hmxdef_return out = */ ((TTreeVB) walker).hmxdef(); } else if (walker instanceof TTreeGo) { System.out.println("Running for Go"); /* TTreeGo.hmxdef_return out = */ ((TTreeGo) walker).hmxdef(); } else if (walker instanceof TTreeCpp) { System.out.println("Running for Cpp"); /* TTreeGo.hmxdef_return out = */ ((TTreeCpp) walker).hmxdef(); } else if (walker instanceof TTreePython) { System.out.println("Running for Python"); /* TTreePython.hmxdef_return out = */ ((TTreePython) walker).hmxdef(); } else if (walker instanceof TTreeSlateMd) { System.out.println("Running for Slate Markdown"); TTreeSlateMd slateMdWalker = (TTreeSlateMd) walker; slateMdWalker.setupCodeParser(codeSamplesJava, codeSamplesPython); slateMdWalker.hmxdef(); } else if (walker instanceof TTreeDotNet) { System.out.println("Running for DotNet"); ((TTreeDotNet) walker).apiGen(); } else if (walker instanceof TTreeCurtisDoc) { System.out.println("Running for CurtisDoc"); ((TTreeCurtisDoc) walker).apiGen(); } // Now dump the files out System.out.println("Genereated source output locations:"); System.out.println(String.format("kernel: [%s]", outputKernelFolder)); System.out.println(String.format("api: [%s]", outputApiFolder)); System.out.println(String.format("web: [%s]", outputWebFolder)); walker.dumpFiles(outputKernelFolder, outputApiFolder, outputWebFolder); } catch (ParseException e) { System.err.println("Error parsing command line - " + e.getMessage()); System.out.println("Usage: " + options.toString()); } catch (IOException | RecognitionException e) { System.err.println("Error running GenApi: " + ExceptionToString.format(e)); } }