/** * Returns all arguments defined by <code>addLine</code>, <code>addValue</code> or the argument object. */ public String[] getArguments() { Vector<String> result = new Vector<String>( arguments.size() * 2 ); for ( int i = 0; i < arguments.size(); i++ ) { Arg arg = arguments.elementAt( i ); String[] s = arg.getParts(); if ( s != null ) { for ( String value : s ) { result.addElement( value ); } } } String[] res = new String[result.size()]; result.copyInto( res ); return res; }
/** * <p>Return the number of arguments that preceded this marker.</p> * * <p>The name of the executable - if set - is counted as the very first argument.</p> */ public int getPosition() { if ( realPos == -1 ) { realPos = ( getLiteralExecutable() == null ? 0 : 1 ); for ( int i = 0; i < position; i++ ) { Arg arg = (Arg) arguments.elementAt( i ); realPos += arg.getParts().length; } } return realPos; } }