List of usage examples for com.google.common.collect ImmutableList copyOf
public static <E> ImmutableList<E> copyOf(E[] elements)
From source file:io.bazel.rules.closure.ClosureUberAlles.java
public static void main(String[] args) { System.exit(new BazelWorker(new ClosureUberAlles(), "Closure").apply(ImmutableList.copyOf(args))); }
From source file:com.github.hilcode.versionator.impl.DefaultTool.java
public static final void main(final String[] args) { new DefaultTool().run(ImmutableList.copyOf(args)); }
From source file:org.immutables.generator.processor.RunParser.java
public static void main(String... args) { Parser templateParser = Parboiled.createParser(Parser.class); ParsingResult<Object> result = new ReportingParseRunner<>(templateParser.Unit()).run(input2); ImmutableList<Object> copy = ImmutableList.copyOf(result.valueStack.iterator()); if (!copy.isEmpty()) { Unit unit = (Unit) copy.get(0);//from w w w. j a va2 s . co m Unit balance = Balancing.balance(unit); System.out.println(balance); } if (result.hasErrors()) { System.err.println(ErrorUtils.printParseErrors(result.parseErrors)); } // System.out.println(ParseTreeUtils.printNodeTree(result)); }
From source file:name.martingeisse.minimal.simulation.MCodeMain.java
/** * The main method.//from ww w .j a v a 2 s.c om * @param args command-line arguments * @throws Exception ... */ public static void main(final String[] args) throws Exception { // compile ImmutableList<MCodeEntry> code = null; { final ClassNode node = new ClassNode(); new ClassReader(Experiment1.class.getName()).accept(node, Opcodes.ASM5); for (final Object untypedMethodNode : node.methods) { final MethodNode methodNode = (MethodNode) untypedMethodNode; if (methodNode.name.equals("main")) { final Compiler compiler = new Compiler(); code = compiler.compile(methodNode); break; } } if (code == null) { throw new RuntimeException("could not find main method to compile"); } } // run final LwjglWindow window = new LwjglWindow(800, 600); final Subject subject = new FullySimulatedSubject(window); final DirectMCodeEngine engine = new DirectMCodeEngine(ImmutableList.copyOf(code), new SubjectNativeCallHandler(subject)); engine.run(); }
From source file:com.icosilune.fnexample.simple.Example.java
public static void main(String args[]) throws Exception { JFrame frame = new JFrame("womp womp"); NodeGraph graph = new NodeGraph(new TimestampContextFactory()); List<AbstractFn> fns = ImmutableList .copyOf(Iterables.concat(ImmutableList.of(new TimestampFn()), Fn_Index.INSTANCES.values())); // need to add constants & sinks List<NodeFactory.NodeKey> nodeKeys = new ArrayList<>(); nodeKeys.add(NodeFactory.ConstantNodeKey.create(FnType.fromString("double"), 0.0)); nodeKeys.add(NodeFactory.SinkNodeKey.create(FnType.fromString("double"))); nodeKeys.addAll(NodeFactory.FnNodeKey.fromInstances(fns)); NodeGraphEvaluatorPanel graphPanel = new NodeGraphEvaluatorPanel(graph, nodeKeys); // AbstractNode node1 = new FnNode(graph, new Fn_Multiply()); // AbstractNode node2 = new ConstantNode(graph, FnType.fromString("double"), 10.0); // AbstractNode node3 = new ConstantNode(graph, FnType.fromString("double"), 10.0); // AbstractNode sink = new SinkNode(graph, FnType.fromString("double")); // graph.addNode(node1); // graph.addNode(node2); // graph.addNode(node3); // graph.addNode(sink); ////from w w w.j a v a2 s . c om // graph.addConnection(node1, node2, "output", "x"); // graph.addConnection(node1, node2, "output", "y"); // graph.addConnection(sink, node1, "out", "in"); graphPanel.setPreferredSize(new Dimension(500, 500)); frame.add(graphPanel); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.pack(); frame.setVisible(true); }
From source file:org.thelq.pircbotx.ReplayServerImpl.java
public static void main(String[] args) throws Exception { //Load properties String filename = "thelq-pircbotx.toml"; File file = new File(filename); if (!file.exists()) file = new File("src/main/resources/" + filename); if (!file.exists()) throw new RuntimeException("Cannot find file " + filename); Toml properties = new Toml().parse(file); List<String> adminNicks = ImmutableList.copyOf(properties.getTable("admin").getList("nicks", String.class)); ReplayServerImpl.replayFile(new File("test.log"), ReplayServer.generateConfig().setListenerManager(new ThreadedListenerManager()) .addListener(new HelpCommand()).addListener(new IdentifiedCommand()) .addListener(new UptimeCommand()).addListener(new LevelsListCommand()) .addListener(new MyLevelsCommand()).addListener(new CountdownCommand()) .addListener(new NewYearsCommand()) //.addListener(new StatsCommand()) .addListener(new NickUpdateListener()).addListener(new ModeCommands()) .addListener(Main.admins = new AdminsCommand(adminNicks))); }
From source file:com.github.hilcode.versionator.Main.java
public static final void main(final String[] args) throws Exception { final PomParser pomParser = new DefaultPomParser(); final PomFinder pomFinder = new DefaultPomFinder(pomParser); final CommandLineInterface.Basics basics = new CommandLineInterface.Basics(); final JCommander commander = new JCommander(basics); final CommandLineInterface.CommandList commandList = new CommandLineInterface.CommandList(); commander.addCommand(CommandLineInterface.CommandList.COMMAND, commandList); final CommandSetVersion commandSetVersion = new CommandSetVersion(); commander.addCommand(CommandSetVersion.COMMAND, commandSetVersion); final CommandRelease commandRelease = new CommandRelease(); commander.addCommand(CommandRelease.COMMAND, commandRelease); try {/*from w w w .j a v a 2s. c om*/ commander.parse(args); if (basics.help != null || basics.version != null) { if (basics.version != null) { System.out.println( String.format("Versionator %s\n%s", Versionator.VERSION, Versionator.RELEASE_DATE)); } if (basics.help != null) { commander.usage(); } return; } if (CommandLineInterface.CommandList.COMMAND.equals(commander.getParsedCommand())) { final Command.List list = new Command.List(new File(commandList.rootDir), ImmutableList.copyOf(commandList.patterns), commandList.verbose ? Command.Verbosity.VERBOSE : Command.Verbosity.NORMAL, commandList.groupByPom ? Command.Grouping.BY_POM : Command.Grouping.BY_GAV); new ListExecutor(pomParser, pomFinder, list).execute(); } else if (CommandSetVersion.COMMAND.equals(commander.getParsedCommand())) { final Command.SetVersion setVersion = new Command.SetVersion(new File(commandSetVersion.rootDir), commandSetVersion.dryRun ? Command.RunType.DRY_RUN : Command.RunType.ACTUAL, commandSetVersion.interactive ? Command.Interactivity.INTERACTIVE : Command.Interactivity.NOT_INTERACTIVE, commandSetVersion.colourless ? Command.Colour.NO_COLOUR : Command.Colour.COLOUR, ImmutableList.<String>copyOf(commandSetVersion.gavs)); final Model model = Model.BUILDER.build(pomFinder.findAllPoms(setVersion.rootDir)); final ImmutableList.Builder<Gav> changedGavsBuilder = ImmutableList.builder(); for (final String gavAsText : setVersion.gavs) { changedGavsBuilder.add(Gav.BUILDER.build(gavAsText)); } final Model result = model.apply(changedGavsBuilder.build()); final ModelWriter modelWriter = new ModelWriter(new VersionSetter(), new PropertySetter()); modelWriter.write(model, result); } else if (CommandRelease.COMMAND.equals(commander.getParsedCommand())) { final Command.Release release = new Command.Release(new File(commandRelease.rootDir), commandRelease.dryRun ? Command.RunType.DRY_RUN : Command.RunType.ACTUAL, commandRelease.interactive ? Command.Interactivity.INTERACTIVE : Command.Interactivity.NOT_INTERACTIVE, commandRelease.colourless ? Command.Colour.NO_COLOUR : Command.Colour.COLOUR, ImmutableList.<String>copyOf(commandRelease.exclusions)); final ImmutableSet.Builder<GroupArtifact> exclusionsBuilder = ImmutableSet.builder(); for (final String exclusionAsText : release.exclusions) { exclusionsBuilder.add(GroupArtifact.BUILDER.build(exclusionAsText)); } final ImmutableSet<GroupArtifact> exclusions = exclusionsBuilder.build(); final Model model = Model.BUILDER.build(pomFinder.findAllPoms(release.rootDir)); final Model result = model.release(exclusions); final ModelWriter modelWriter = new ModelWriter(new VersionSetter(), new PropertySetter()); modelWriter.write(model, result); } else { System.err.println("No command provided. Perhaps try --help?"); } } catch (final ParameterException e) { System.err.println(e.getMessage()); } }
From source file:com.google.devtools.build.lib.worker.ExampleWorker.java
public static void main(String[] args) throws Exception { if (ImmutableSet.copyOf(args).contains("--persistent_worker")) { OptionsParser parser = OptionsParser.newOptionsParser(ExampleWorkerOptions.class); parser.setAllowResidue(false);/*from w w w. java 2 s . co m*/ parser.parse(args); ExampleWorkerOptions workerOptions = parser.getOptions(ExampleWorkerOptions.class); Preconditions.checkState(workerOptions.persistentWorker); runPersistentWorker(workerOptions); } else { // This is a single invocation of the example that exits after it processed the request. processRequest(ImmutableList.copyOf(args)); } }
From source file:org.thelq.pircbotx.Main.java
@SuppressWarnings("unchecked") public static void main(String[] args) throws Exception { //Load properties String filename = "thelq-pircbotx.toml"; File file = new File(filename); if (!file.exists()) file = new File("src/main/resources/" + filename); if (!file.exists()) throw new RuntimeException("Cannot find file " + filename); Toml properties = new Toml().parse(file); ImmutableList<String> adminNicks = ImmutableList .copyOf(properties.getTable("admin").getList("nicks", String.class)); //Initial configuration Configuration.Builder templateConfig = new Configuration.Builder().setLogin("LQ").setAutoNickChange(true) .addListener(new HelpCommand()).addListener(new IdentifiedCommand()) .addListener(new UptimeCommand()).addListener(new LevelsListCommand()) .addListener(new MyLevelsCommand()).addListener(new CountdownCommand()) .addListener(new NewYearsCommand()).addListener(new StatsCommand()) .addListener(new NickUpdateListener()).addListener(new ModeCommands()).addListener(new RawCommand()) .addListener(admins = new AdminsCommand(adminNicks)); templateConfig.getListenerManager().setExceptionHandler(new AdminManagerExceptionHandler()); if (PRODUCTION) templateConfig.setName("TheLQ-PircBotX"); else//from w ww.j a v a 2s . com templateConfig.setName("TheLQ-BotTest"); //Join servers for (Toml serverArgsRaw : properties.getTables("server")) { ServerConfig serverArgs = serverArgsRaw.to(ServerConfig.class); log.debug("hostname " + serverArgs.hostname); log.debug("channels " + serverArgs.channels); log.debug("nickserv " + serverArgs.nickserv); MANAGER.addBot(new Configuration.Builder(templateConfig).addServer(serverArgs.hostname) .addAutoJoinChannels(serverArgs.channels).setNickservPassword(serverArgs.nickserv) .buildConfiguration()); } startWebServer(properties); if (PRODUCTION) { JenkinsKeepAlive.create(); } //Connect MANAGER.start(); }
From source file:io.bazel.rules.closure.webfiles.server.WebfilesServer.java
public static void main(String[] args) throws Exception { ExecutorService executor = Executors.newCachedThreadPool(); try {/*w w w .j a v a2 s. com*/ DaggerWebfilesServer_Server.builder().args(ImmutableList.copyOf(args)).executor(executor) .fs(FileSystems.getDefault()).serverSocketFactory(ServerSocketFactory.getDefault()).build() .server().run(); } finally { executor.shutdownNow(); } }