public static void main ( String [ ] args ) { // Use the command line parser to evaluate the command line. CommandLineParser commandLine = new CommandLineParser ( new String [ ] [ ] { { "s" , "The sequence definition." , "[m:...:n](:sample=s)(:exp)" , "true" , MathUtils . SEQUENCE_REGEXP } , { "d" , "The duration definition." , "dDhHmMsS" , "false" , MathUtils . DURATION_REGEXP } } ) ; // Capture the command line arguments or display errors and correct usage and then exit. ParsedProperties options = null ; try { options = new ParsedProperties ( commandLine . parseCommandLine ( args ) ) ; } catch ( IllegalArgumentException e ) { // It is noted that the command line is illegal, so the exception can be ignored. e = null ; System . out . println ( commandLine . getErrors ( ) ) ; System . out . println ( commandLine . getUsage ( ) ) ; System . exit ( - 1 ) ; } // Extract the command line options. String sequence = options . getProperty ( "s" ) ; String durationString = options . getProperty ( "d" ) ; System . out . println ( "Sequence is: " + printArray ( parseSequence ( sequence ) ) ) ; if ( durationString != null ) { System . out . println ( "Duration is: " + parseDuration ( durationString ) ) ; } }
Runs a quick test of the sequence generation methods to confirm that they work as expected .