Java 类org.kohsuke.args4j.spi.Messages 实例源码

项目:basekb-search    文件:SearchTester.java   
public SearchTester(String[] args) throws Exception {
    CmdLineParser argparser = new CmdLineParser(this);
    String home = null;
    String ranker_name = null;

    try {
        argparser.parseArgument(args);

        if (posargs.size() != 3) {
            throw new CmdLineException(argparser, Messages.ILLEGAL_LIST, "Command line fail");
        }
        home = posargs.get(0);
        ranker_name = posargs.get(1);
        query_file = posargs.get(2);

        if (home == null) {
            throw new CmdLineException(argparser, Messages.ILLEGAL_PATH, "No home given");
        }
        if (ranker_name == null) {
            throw new CmdLineException(argparser, Messages.ILLEGAL_OPERAND, "No ranker given");
        }
        if (query_file == null) {
            throw new CmdLineException(argparser, Messages.ILLEGAL_PATH, "No query file given");
        }

    } catch (CmdLineException cle) {
        System.err.println(cle.getMessage());
        argparser.printUsage(System.err);
        System.err.println();
    }

    fbs = new FreebaseSearcher(new FreebaseIndexer(home));
    Class myClass = Class.forName(ranker_name);
    Class[] types = {IndexSearcher.class, Analyzer.class, Integer.TYPE};
    Constructor constructor = myClass.getConstructor(types);
    ranker = (Ranker)constructor.newInstance(fbs.getIndexSearcher(), fbs.fbi.getIndexAnalyzer(), search_depth);
}
项目:p3-batchrefine    文件:SplitOptionHandler.java   
@Override
public ImmutablePair parse(String argument) throws CmdLineException, NumberFormatException {

    String[] typeParams = argument.split(":");

    if (typeParams.length != 2)
        throw new CmdLineException(owner, Messages.ILLEGAL_OPERAND, option.toString(), argument);

    Split type = null;
    for (Split o : Split.class.getEnumConstants())
        if (o.name().equalsIgnoreCase(typeParams[0])) {
            type = o;
            break;
        }

    List<Integer> parameters = new ArrayList<>();
    try {
        for (String p : typeParams[1].split(",")) {
            parameters.add(Integer.parseInt(p));
        }
    } catch (NumberFormatException e) {
        throw new CmdLineException(owner, Messages.ILLEGAL_OPERAND, option.toString(), argument);
    }

    if (type == null || parameters.size() == 0) {
        throw new CmdLineException(owner, Messages.ILLEGAL_OPERAND, option.toString(), argument);
    }

    return new ImmutablePair(type, typeParams[1]);

}
项目:sette-tool    文件:ToolOptionHandler.java   
@Override
protected SetteToolConfiguration parse(@NonNull String toolName)
        throws NumberFormatException, CmdLineException {
    Optional<SetteToolConfiguration> toolConfig = configuration.getToolConfigurations()
            .stream()
            .filter(tc -> tc.getName().equalsIgnoreCase(toolName))
            .findAny();

    if (toolConfig.isPresent()) {
        return toolConfig.get();
    } else {
        throw new CmdLineException(owner, Messages.ILLEGAL_OPERAND, option.toString(),
                toolName);
    }
}
项目:sette-tool    文件:TimeInMsOptionHandler.java   
@Override
protected Integer parse(@NonNull String time) throws NumberFormatException, CmdLineException {
    if (time.endsWith("ms")) {
        return Integer.parseInt(time.substring(0, time.length() - 2));
    } else if (time.endsWith("s")) {
        return Integer.parseInt(time.substring(0, time.length() - 1)) * 1000;
    } else {
        throw new CmdLineException(owner, Messages.ILLEGAL_OPERAND, option.toString(), time);
    }
}
项目:hyst    文件:SplittingElementArrayOptionHandler.java   
@Override
public String getDefaultMetaVariable()
{
    return Messages.DEFAULT_META_STRING_ARRAY_OPTION_HANDLER.format();
}
项目:hyst    文件:HyperPointArrayOptionHandler.java   
@Override
public String getDefaultMetaVariable()
{
    return Messages.DEFAULT_META_STRING_ARRAY_OPTION_HANDLER.format();
}
项目:hyst    文件:StringPairsWithSpacesArrayOptionHandler.java   
/**
 * Returns {@code "STRING[]"}.
 *
 * @return return "STRING[]";
 */
@Override
public String getDefaultMetaVariable()
{
    return Messages.DEFAULT_META_STRING_ARRAY_OPTION_HANDLER.format();
}
项目:hyst    文件:HyperRectangleArrayOptionHandler.java   
@Override
public String getDefaultMetaVariable()
{
    return Messages.DEFAULT_META_STRING_ARRAY_OPTION_HANDLER.format();
}
项目:hyst    文件:StringWithSpacesArrayOptionHandler.java   
/**
 * Returns {@code "STRING[]"}.
 *
 * @return return "STRING[]";
 */
@Override
public String getDefaultMetaVariable()
{
    return Messages.DEFAULT_META_STRING_ARRAY_OPTION_HANDLER.format();
}
项目:hyst    文件:DoubleArrayOptionHandler.java   
@Override
public String getDefaultMetaVariable()
{
    return Messages.DEFAULT_META_STRING_ARRAY_OPTION_HANDLER.format();
}
项目:hyst    文件:ExpressionValueArrayOptionHandler.java   
@Override
public String getDefaultMetaVariable()
{
    return Messages.DEFAULT_META_STRING_ARRAY_OPTION_HANDLER.format();
}
项目:hyst    文件:PairStringOptionHandler.java   
@Override
public String getDefaultMetaVariable()
{
    return Messages.DEFAULT_META_STRING_ARRAY_OPTION_HANDLER.format();
}
项目:buck    文件:QueryMultiSetOptionHandler.java   
/**
 * Returns {@code "STRING[]"}.
 *
 * @return return "STRING[]";
 */
@Override
public String getDefaultMetaVariable() {
  return Messages.DEFAULT_META_STRING_ARRAY_OPTION_HANDLER.format();
}