Coverage Report - joptsimple.ArgumentList
 
Classes in this File Line Coverage Branch Coverage Complexity
ArgumentList
100%
9/9
100%
4/4
1.2
 
 1  
 /*
 2  
  Copyright 2004-2008 Paul R. Holser, Jr.  All rights reserved.
 3  
  Licensed under the Academic Free License version 3.0
 4  
  */
 5  
 
 6  
 package joptsimple;
 7  
 
 8  
 /**
 9  
  * <p>Wrapper for an array of command line arguments.</p>
 10  
  *
 11  
  * @since 1.0
 12  
  * @author <a href="mailto:pholser@alumni.rice.edu">Paul Holser</a>
 13  
  * @version $Id: ArgumentList.java,v 1.1 2008/03/15 14:45:40 pholser Exp $
 14  
  */
 15  
 class ArgumentList {
 16  
     private final String[] arguments;
 17  
     private int currentIndex;
 18  
 
 19  266
     ArgumentList( String[] arguments ) {
 20  266
         this.arguments = (String[]) arguments.clone();
 21  264
     }
 22  
 
 23  
     boolean hasMore() {
 24  1040
         return currentIndex < arguments.length;
 25  
     }
 26  
 
 27  
     String next() {
 28  758
         return arguments[ currentIndex++ ];
 29  
     }
 30  
 
 31  
     String peek() {
 32  92
         return arguments[ currentIndex ];
 33  
     }
 34  
 
 35  
     void treatNextAsLongOption() {
 36  24
         if ( ParserRules.HYPHEN_CHAR != arguments[ currentIndex ].charAt( 0 ) )
 37  18
             arguments[ currentIndex ] =
 38  
                 ParserRules.DOUBLE_HYPHEN + arguments[ currentIndex ];
 39  20
     }
 40  
 }