本文整理汇总了Java中net.sourceforge.argparse4j.inf.Namespace.getList方法的典型用法代码示例。如果您正苦于以下问题:Java Namespace.getList方法的具体用法?Java Namespace.getList怎么用?Java Namespace.getList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.sourceforge.argparse4j.inf.Namespace
的用法示例。
在下文中一共展示了Namespace.getList方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: run
import net.sourceforge.argparse4j.inf.Namespace; //导入方法依赖的package包/类
private void run(String... args) throws Exception {
Namespace namespace;
try {
namespace = argumentParser.parseArgs(args);
} catch (ArgumentParserException e) {
argumentParser.handleError(e);
return;
}
List<String> urls = namespace.getList(urlKey);
try {
Set<HttpUrl> allUrls = argResolver.getAllUrls(urls);
if (allUrls.isEmpty())
LOG.info("No playlists found! Check your args: " + Arrays.toString(args));
for (HttpUrl url : allUrls)
getHandler(url).join();
} catch (Throwable t) {
LOG.info("Error {}: {}", t.getClass().getSimpleName(), t.getMessage());
LOG.debug("Detailed error output", t);
} finally {
theClosener.close();
}
}
示例2: execute
import net.sourceforge.argparse4j.inf.Namespace; //导入方法依赖的package包/类
public static void execute(final Namespace parsedArgs) throws IOException, ValidationException {
final Map<String, Object> inputMap = new HashMap<>();
for (String input : parsedArgs.<String>getList("input")) {
String[] keyValue = input.split("=", 2);
if (keyValue.length == 2) {
inputMap.put(keyValue[0], keyValue[1]);
} else {
LOG.warn("Invalid input string '{}' - expecting KEY=VALUE");
}
}
LOG.trace("Have {} input parameters", inputMap.size());
final String name = parsedArgs.getString("name"), script = parsedArgs.getString("script");
final Map<String, ?> outcome = name != null ?
evaluateNamespace(parsedArgs, name, inputMap) : evaluateStandalone(parsedArgs, script, inputMap);
if (outcome != null) {
System.out.println(
Planout4jTool.getGson(new Namespace(ImmutableMap.<String, Object>of("pretty", Boolean.TRUE)))
.toJson(outcome));
}
}
示例3: main
import net.sourceforge.argparse4j.inf.Namespace; //导入方法依赖的package包/类
/**
* Cluster the C-alpha chains of a set of PDB ids.
* @param args the input args - currently none taken
* @throws IOException an error reading from the URL or the seqeunce file
*/
public static void main(String[] args) throws IOException {
// Read the arguments
Namespace ns = parseArgs(args);
// Get the actual arguments
String alignMethod = ns.getString("align");
String filePath = ns.getString("hadoop");
int minLength = ns.getInt("minlength");
double sample = ns.getDouble("sample");
boolean useFiles = ns.getBoolean("files");
// Get the list of PDB ids
List<String> pdbIdList = ns.<String> getList("pdbId");
// Get the chains that correpspond to that
JavaPairRDD<String, Atom[]> chainRDD;
if(pdbIdList.size()>0){
if(useFiles==true){
StructureDataRDD structureDataRDD = new StructureDataRDD(
BiojavaSparkUtils.getFromList(convertToFiles(pdbIdList))
.mapToPair(t -> new Tuple2<String, StructureDataInterface>(t._1, BiojavaSparkUtils.convertToStructDataInt(t._2))));
chainRDD = BiojavaSparkUtils.getChainRDD(structureDataRDD, minLength);
}
else{
chainRDD = BiojavaSparkUtils.getChainRDD(pdbIdList, minLength);
}
}
else if(!filePath.equals(defaultPath)){
chainRDD = BiojavaSparkUtils.getChainRDD(filePath, minLength, sample);
}
else{
System.out.println("Must specify PDB ids or an hadoop sequence file");
return;
}
System.out.println("Analysisng " + chainRDD.count() + " chains");
JavaPairRDD<Tuple2<String,Atom[]>,Tuple2<String, Atom[]>> comparisons = SparkUtils.getHalfCartesian(chainRDD, chainRDD.getNumPartitions());
JavaRDD<Tuple3<String, String, AFPChain>> similarities = comparisons.map(t -> new Tuple3<String, String, AFPChain>(t._1._1, t._2._1,
AlignmentTools.getBiojavaAlignment(t._1._2, t._2._2, alignMethod)));
JavaRDD<Tuple6<String, String, Double, Double, Double, Double>> allScores = similarities.map(t -> new Tuple6<String, String, Double, Double, Double, Double>(
t._1(), t._2(), t._3().getTMScore(), t._3().getTotalRmsdOpt(), (double) t._3().getTotalLenOpt(), t._3().getAlignScore())).cache();
if(alignMethod.equals("DUMMY")){
JavaDoubleRDD doubleDist = allScores.mapToDouble(t -> t._3());
System.out.println("Average dist: "+doubleDist.mean());
}
else{
writeData(allScores);
}
}
示例4: run
import net.sourceforge.argparse4j.inf.Namespace; //导入方法依赖的package包/类
@Override
protected void run(Environment environment, Namespace namespace, EmoConfiguration configuration)
throws Exception {
String id = namespace.getString("id");
AllTablesReportOptions options = new AllTablesReportOptions();
options.setReadOnly(namespace.getBoolean("readOnly"));
List<String> placements = namespace.getList("placements");
if (placements != null && !placements.isEmpty()) {
options.setPlacements(ImmutableSet.copyOf(placements));
}
Integer shardId = namespace.getInt("shard");
if (shardId != null) {
options.setFromShardId(shardId);
}
String table = namespace.getString("table");
if (table != null) {
options.setFromTableUuid(TableUuidFormat.decode(table));
}
Injector injector = Guice.createInjector(new EmoModule(configuration, environment, EmoServiceMode.CLI_TOOL));
ContainerLifeCycle containerLifeCycle = new ContainerLifeCycle();
environment.lifecycle().attach(containerLifeCycle);
containerLifeCycle.start();
try {
AllTablesReportGenerator generator = injector.getInstance(AllTablesReportGenerator.class);
AllTablesReportResult result = generator.runReport(id, options);
System.out.println(result);
} finally {
containerLifeCycle.stop();
}
}
示例5: run
import net.sourceforge.argparse4j.inf.Namespace; //导入方法依赖的package包/类
@Override
protected void run(Bootstrap<EmoConfiguration> bootstrap, Namespace namespace, EmoConfiguration config)
throws Exception {
String host = namespace.getString("host");
int limit = namespace.getInt("limit");
String subscription = namespace.getString("subscription");
String apiKey = namespace.getString("api_key");
Set<String> tables = Sets.newHashSet(namespace.<String>getList("table"));
List<String> keys = namespace.getList("key");
Set<String> keySet = keys != null ? Sets.newHashSet(keys) : null;
System.out.println("Connecting...");
URI uri = URI.create(host).resolve(DatabusClient.SERVICE_PATH + "/_raw");
MetricRegistry metricRegistry = bootstrap.getMetricRegistry();
Client client = createDefaultJerseyClient(config.getHttpClientConfiguration(), metricRegistry, "");
QueueService databus = QueueServiceAuthenticator.proxied(new QueueClient(uri, new JerseyEmoClient(client)))
.usingCredentials(apiKey);
for (;;) {
List<Message> events = databus.peek(subscription, 5000);
List<String> ids = Lists.newArrayList();
for (Message event : events) {
//noinspection unchecked
Map<String, String> coord = (Map<String, String>) checkNotNull(event.getPayload());
String table = checkNotNull(coord.get("table"));
String key = checkNotNull(coord.get("key"));
if (tables.contains(table) && (keySet == null || keySet.contains(key))) {
ids.add(event.getId());
if (--limit <= 0) {
break;
}
}
}
if (ids.isEmpty()) {
System.out.println("All matching events of the first " + events.size() + " have been purged.");
break;
}
System.out.println("Purging " + ids.size() + " events...");
databus.acknowledge(subscription, ids);
if (limit == 0) {
System.out.println("Limit reached.");
break;
}
}
}