/*
Copyright 2004-2007 Paul R. Holser, Jr. All rights reserved.
Licensed under the Academic Free License version 3.0
*/
package joptsimple;
/**
* Wrapper for an array of command line arguments.
*
* @since 1.0
* @author <a href="mailto:pholser@alumni.rice.edu">Paul Holser</a>
* @version $Id: ArgumentList.java,v 1.10 2007/04/10 20:06:25 pholser Exp $
*/
class ArgumentList {
private final String[] arguments;
private int currentIndex;
ArgumentList( String[] arguments ) {
this.arguments = (String[]) arguments.clone();
}
boolean hasMore() {
return currentIndex < arguments.length;
}
String next() {
return arguments[ currentIndex++ ];
}
String peek() {
return arguments[ currentIndex ];
}
// TODO: give the list a ParserRules to eliminate this duplication?
void treatNextAsLongOption() {
if ( '-' != arguments[ currentIndex ].charAt( 0 ) )
arguments[ currentIndex ] = "--" + arguments[ currentIndex ];
}
}
|