本文整理汇总了Java中jargs.gnu.CmdLineParser.OptionException方法的典型用法代码示例。如果您正苦于以下问题:Java CmdLineParser.OptionException方法的具体用法?Java CmdLineParser.OptionException怎么用?Java CmdLineParser.OptionException使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类jargs.gnu.CmdLineParser
的用法示例。
在下文中一共展示了CmdLineParser.OptionException方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: parseCmd
import jargs.gnu.CmdLineParser; //导入方法依赖的package包/类
public void parseCmd(String[] args){
//System.out.println("*** running ArduinoClient standalone WparseCmd");
CmdLineParser parser = new CmdLineParser();
CmdLineParser.Option debugOption = parser.addBooleanOption('X', "debug");
CmdLineParser.Option arduinoServerOption = parser.addStringOption('s', "arduinoServer");
try {
parser.parse(args);
}
catch ( CmdLineParser.OptionException e ) {
System.err.println(e.getMessage());
System.out.println("parseCmd had an error\n"+ usage );
System.exit(2);
}
// String portname = args[0]; // e.g. "/dev/cu.KeySerial1", or "COM5" or "192.168.1.1:5002"
arduinoServer = (((String)parser.getOptionValue(arduinoServerOption)));
Boolean debugBool = (Boolean)parser.getOptionValue(debugOption,new Boolean(false));
setDebug(debugBool.booleanValue());
//System.out.println("debug is ("+isDebug()+")");
//System.out.println("*** end of parseCmd");
}
示例2: process_cmdline_args
import jargs.gnu.CmdLineParser; //导入方法依赖的package包/类
private static void process_cmdline_args(String[] args) {
CmdLineParser parser = new CmdLineParser();
CmdLineParser.Option optionCodons = parser.addStringOption('c', "codons");
CmdLineParser.Option optionMatrixFile = parser.addStringOption('m', "matrix-file");
CmdLineParser.Option optionServerIPname = parser.addStringOption('s', "server");
CmdLineParser.Option optionAuto = parser.addBooleanOption('a', "autogen");
CmdLineParser.Option optionCodonLength = parser.addIntegerOption('n', "protein-length");
CmdLineParser.Option optionIterCount = parser.addIntegerOption('r', "iteration");
try {
parser.parse(args);
} catch (CmdLineParser.OptionException e) {
System.err.println(e.getMessage());
printUsage();
System.exit(2);
}
clientCodons = (String) parser.getOptionValue(optionCodons, new String("A"));
matrixFile = (String) parser.getOptionValue(optionMatrixFile, new String("matrices/Simple"));
autogen = (Boolean) parser.getOptionValue(optionAuto, false);
n = ((Integer) parser.getOptionValue(optionCodonLength, new Integer(100))).intValue();
ProgClient.serverIPname = (String) parser.getOptionValue(optionServerIPname, new String("localhost"));
Program.iterCount = ((Integer) parser.getOptionValue(optionIterCount, new Integer(1))).intValue();
}
示例3: process_cmdline_args
import jargs.gnu.CmdLineParser; //导入方法依赖的package包/类
private static void process_cmdline_args(String[] args) {
CmdLineParser parser = new CmdLineParser();
CmdLineParser.Option optionAuto = parser.addBooleanOption('a', "autogen");
CmdLineParser.Option optionDNALength = parser.addIntegerOption('n', "DNALength");
CmdLineParser.Option optionSigma = parser.addIntegerOption('g', "sigma");
try {
parser.parse(args);
} catch (CmdLineParser.OptionException e) {
System.err.println(e.getMessage());
printUsage();
System.exit(2);
}
// dna = (String) parser.getOptionValue(optionDNA, new String("AGCT"));
// EditDistanceServer.L = ((Integer) parser.getOptionValue(optionL, 5)).intValue();
autogen = (Boolean) parser.getOptionValue(optionAuto, false);
n = ((Integer) parser.getOptionValue(optionDNALength, new Integer(100))).intValue();
EditDistanceCommon.sigma = ((Integer) parser.getOptionValue(optionSigma, new Integer(2))).intValue();
}
示例4: process_cmdline_args
import jargs.gnu.CmdLineParser; //导入方法依赖的package包/类
private static void process_cmdline_args(String[] args) {
CmdLineParser parser = new CmdLineParser();
CmdLineParser.Option optionCodons = parser.addStringOption('c', "codons");
CmdLineParser.Option optionMatrixFile = parser.addStringOption('m', "matrix-file");
CmdLineParser.Option optionAuto = parser.addBooleanOption('a', "autogen");
CmdLineParser.Option optionCodonLength = parser.addIntegerOption('n', "protein-length");
try {
parser.parse(args);
} catch (CmdLineParser.OptionException e) {
System.err.println(e.getMessage());
printUsage();
System.exit(2);
}
serverCodons = (String) parser.getOptionValue(optionCodons, new String("A"));
matrixFile = (String) parser.getOptionValue(optionMatrixFile, new String("matrices/blosum20x20"));
autogen = (Boolean) parser.getOptionValue(optionAuto, false);
n = ((Integer) parser.getOptionValue(optionCodonLength, new Integer(100))).intValue();
}
示例5: process_cmdline_args
import jargs.gnu.CmdLineParser; //导入方法依赖的package包/类
private static void process_cmdline_args(String[] args) {
CmdLineParser parser = new CmdLineParser();
CmdLineParser.Option optionServerIPname = parser.addStringOption('s', "server");
CmdLineParser.Option optionAuto = parser.addBooleanOption('a', "autogen");
CmdLineParser.Option optionDNALength = parser.addIntegerOption('n', "DNALength");
CmdLineParser.Option optionIterCount = parser.addIntegerOption('r', "iteration");
CmdLineParser.Option optionSigma = parser.addIntegerOption('g', "sigma");
try {
parser.parse(args);
} catch (CmdLineParser.OptionException e) {
System.err.println(e.getMessage());
printUsage();
System.exit(2);
}
autogen = (Boolean) parser.getOptionValue(optionAuto, false);
n = ((Integer) parser.getOptionValue(optionDNALength, new Integer(100))).intValue();
ProgClient.serverIPname = (String) parser.getOptionValue(optionServerIPname, new String("localhost"));
Program.iterCount = ((Integer) parser.getOptionValue(optionIterCount, new Integer(10))).intValue();
EditDistanceCommon.sigma = ((Integer) parser.getOptionValue(optionSigma, new Integer(2))).intValue();
}
示例6: process_cmdline_args
import jargs.gnu.CmdLineParser; //导入方法依赖的package包/类
private static void process_cmdline_args(String[] args) {
CmdLineParser parser = new CmdLineParser();
CmdLineParser.Option optionKeyFile = parser.addStringOption('k', "key-file");
CmdLineParser.Option optionAuto = parser.addBooleanOption('a', "autogen");
try {
parser.parse(args);
} catch (CmdLineParser.OptionException e) {
System.err.println(e.getMessage());
printUsage();
System.exit(2);
}
keyFile = (String) parser.getOptionValue(optionKeyFile, new String("key"));
autogen = (Boolean) parser.getOptionValue(optionAuto, false);
}
示例7: process_cmdline_args
import jargs.gnu.CmdLineParser; //导入方法依赖的package包/类
private static void process_cmdline_args(String[] args) {
CmdLineParser parser = new CmdLineParser();
CmdLineParser.Option optionServerIPname = parser.addStringOption('s', "server");
CmdLineParser.Option optionAuto = parser.addBooleanOption('a', "autogen");
CmdLineParser.Option optionIterCount = parser.addIntegerOption('r', "iteration");
try {
parser.parse(args);
} catch (CmdLineParser.OptionException e) {
System.err.println(e.getMessage());
printUsage();
System.exit(2);
}
autogen = (Boolean) parser.getOptionValue(optionAuto, false);
ProgClient.serverIPname = (String) parser.getOptionValue(optionServerIPname, new String("localhost"));
Program.iterCount = ((Integer) parser.getOptionValue(optionIterCount, new Integer(1))).intValue();
}
示例8: process_cmdline_args
import jargs.gnu.CmdLineParser; //导入方法依赖的package包/类
private static void process_cmdline_args(String[] args) {
CmdLineParser parser = new CmdLineParser();
CmdLineParser.Option optionServerIPname = parser.addStringOption('s', "server");
CmdLineParser.Option optionBitLength = parser.addIntegerOption('n', "bit-Length");
CmdLineParser.Option optionIterCount = parser.addIntegerOption('r', "iteration");
try {
parser.parse(args);
} catch (CmdLineParser.OptionException e) {
System.err.println(e.getMessage());
printUsage();
System.exit(2);
}
ProgClient.serverIPname = (String) parser.getOptionValue(optionServerIPname, new String("localhost"));
Program.iterCount = ((Integer) parser.getOptionValue(optionIterCount, new Integer(1))).intValue();
}
示例9: process_cmdline_args
import jargs.gnu.CmdLineParser; //导入方法依赖的package包/类
private static void process_cmdline_args(String[] args) {
CmdLineParser parser = new CmdLineParser();
CmdLineParser.Option optionServerIPname = parser.addStringOption('s', "server");
CmdLineParser.Option optionBitLength = parser.addIntegerOption('n', "bit-Length");
CmdLineParser.Option optionIterCount = parser.addIntegerOption('r', "iteration");
try {
parser.parse(args);
} catch (CmdLineParser.OptionException e) {
System.err.println(e.getMessage());
printUsage();
System.exit(2);
}
n = ((Integer) parser.getOptionValue(optionBitLength, new Integer(900))).intValue();
ProgClient.serverIPname = (String) parser.getOptionValue(optionServerIPname, new String("localhost"));
Program.iterCount = ((Integer) parser.getOptionValue(optionIterCount, new Integer(5))).intValue();
}
示例10: parseCmd
import jargs.gnu.CmdLineParser; //导入方法依赖的package包/类
public void parseCmd(String[] args){
//System.out.println("*** start of AudioLocalizerClient WparseCmd");
CmdLineParser parser = new CmdLineParser();
CmdLineParser.Option debugOption = parser.addBooleanOption('X', "debug");
CmdLineParser.Option localizerServerOption = parser.addStringOption('l', "localizerServer");
CmdLineParser.Option localizerPortNumOption = parser.addIntegerOption('p', "localizerPortNum");
try {
parser.parse(args);
}
catch ( CmdLineParser.OptionException e ) {
System.err.println(e.getMessage());
System.out.println("parseCmd had an error\n"+ usage );
System.exit(2);
}
// String portname = args[0]; // e.g. "/dev/cu.KeySerial1", or "COM5" or "192.168.1.1"
setLocalizerServer(((String)parser.getOptionValue(localizerServerOption)));
setLocalizerPortNum(((Integer)parser.getOptionValue(localizerPortNumOption, getLocalizerPortNum())).intValue());
// String cmd = args[1+argOffset];
Boolean debugBool = (Boolean)parser.getOptionValue(debugOption,new Boolean(false));
setDebug(debugBool.booleanValue());
System.out.println("debug is ("+isDebug()+")");
//System.out.println("*** end of parseCmd");
}
示例11: RoombaCommGUI
import jargs.gnu.CmdLineParser; //导入方法依赖的package包/类
/**
* Instantiates a new RoombaComm GUI with any args by use of jargs.
*
* @param args the args<br />
* --hwhandshake boolean value (true,false)<br />
* -d,--debug boolean value to increase STDOUT<br />
* -h,--help print usage input and exit<br />
*/
public RoombaCommGUI(String[] args) {
AutoHelpParser parser = new AutoHelpParser();
CmdLineParser.Option hwhandshake_opt = parser.addHelp(parser.addBooleanOption("hwhandshake"),"Use this to turn on the hardware hand shake");
CmdLineParser.Option debug_opt = parser.addHelp(parser.addBooleanOption('d', "debug"),"output more information at runtime");
CmdLineParser.Option help_opt = parser.addHelp(parser.addBooleanOption('h', "help"),"Show this help message");
if (args != null){
String[] org_args = args;
try {
parser.parse(args);
}
catch ( CmdLineParser.OptionException e ) {
System.err.println(e.getMessage());
parser.printUsage();
System.exit(2);
}
if ( Boolean.TRUE.equals(parser.getOptionValue(hwhandshake_opt))) {
hwhandshake = true;
}
if ( Boolean.TRUE.equals(parser.getOptionValue(debug_opt))) {
debug = true;
}
if (debug){
for( int i=0; i < org_args.length; i++ ) {
System.out.println(i+": "+org_args[i]);
}
}
if ( Boolean.TRUE.equals(parser.getOptionValue(help_opt))) {
parser.printUsage();
System.exit(0);
}
}
// Schedule a job for the event dispatch thread:
// creating and showing this application's GUI.
javax.swing.SwingUtilities.invokeLater(new Runnable() {
public void run() {
createAndShowGUI(debug);
}
});
}
示例12: main
import jargs.gnu.CmdLineParser; //导入方法依赖的package包/类
public static void main(String args[]) {
CmdLineParser parser = new CmdLineParser();
CmdLineParser.Option inFile = parser.addStringOption('f', "file");
CmdLineParser.Option outFile = parser.addStringOption('o', "output");
CmdLineParser.Option window = parser.addIntegerOption('w', "window");
CmdLineParser.Option step = parser.addIntegerOption('s', "step");
try {
parser.parse(args);
}
catch (CmdLineParser.OptionException e) {
System.err.println(e.getMessage());
printUsage();
System.exit(2);
}
windowSize =
(Integer) parser.getOptionValue(window, 5);
windowStep =
(Integer) parser.getOptionValue(step, 1);
SequenceGC sequence = new SequenceGC();
String inPath = (String) parser.getOptionValue(inFile);
String outPath = (String) parser.getOptionValue(outFile);
if (!(inPath == null))
sequence.ProcessPath(inPath, outPath);
else
printUsage();
}
示例13: main
import jargs.gnu.CmdLineParser; //导入方法依赖的package包/类
public static void main( String[] args ) {
CmdLineParser parser = new CmdLineParser();
CmdLineParser.Option date =
parser.addOption(new ShortDateOption('d', "date"));
try {
parser.parse(args);
}
catch ( CmdLineParser.OptionException e ) {
System.err.println(e.getMessage());
printUsage();
System.exit(2);
}
// Extract the values entered for the various options -- if the
// options were not specified, the corresponding values will be
// null.
Date dateValue = (Date)parser.getOptionValue(date);
// For testing purposes, we just print out the option values
System.out.println("date: " + dateValue);
// Extract the trailing command-line arguments ('a_number') in the
// usage string above.
String[] otherArgs = parser.getRemainingArgs();
System.out.println("remaining args: ");
for ( int i = 0; i < otherArgs.length; ++i ) {
System.out.println(otherArgs[i]);
}
// In a real program, one would pass the option values and other
// arguments to a function that does something more useful.
System.exit(0);
}
示例14: process_cmdline_args
import jargs.gnu.CmdLineParser; //导入方法依赖的package包/类
private static void process_cmdline_args(String[] args) {
CmdLineParser parser = new CmdLineParser();
CmdLineParser.Option optionBitLength = parser.addIntegerOption('n', "bit-length");
try {
parser.parse(args);
} catch (CmdLineParser.OptionException e) {
System.err.println(e.getMessage());
printUsage();
System.exit(2);
}
n = ((Integer) parser.getOptionValue(optionBitLength, new Integer(900))).intValue();
}
示例15: process_cmdline_args
import jargs.gnu.CmdLineParser; //导入方法依赖的package包/类
private static void process_cmdline_args(String[] args) {
CmdLineParser parser = new CmdLineParser();
CmdLineParser.Option optionBitLength = parser.addIntegerOption('n', "bit-length");
try {
parser.parse(args);
} catch (CmdLineParser.OptionException e) {
System.err.println(e.getMessage());
printUsage();
System.exit(2);
}
nBits = ((Integer) parser.getOptionValue(optionBitLength, new Integer(128))).intValue();
}