Clover coverage report -
Coverage timestamp: Sun Nov 1 2009 23:08:24 UTC
file stats: LOC: 78   Methods: 5
NCLOC: 41   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
ArgTokenizer.java 30% 47.4% 80% 47.1%
coverage coverage
 1    /*
 2    * Licensed to the Apache Software Foundation (ASF) under one or more
 3    * contributor license agreements. See the NOTICE file distributed with
 4    * this work for additional information regarding copyright ownership.
 5    * The ASF licenses this file to You under the Apache License, Version 2.0
 6    * (the "License"); you may not use this file except in compliance with
 7    * the License. You may obtain a copy of the License at
 8    *
 9    * http://www.apache.org/licenses/LICENSE-2.0
 10    *
 11    * Unless required by applicable law or agreed to in writing, software
 12    * distributed under the License is distributed on an "AS IS" BASIS,
 13    * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 14    * See the License for the specific language governing permissions and
 15    * limitations under the License.
 16    *
 17    * $Id: ArgTokenizer.java 541508 2007-05-25 01:54:12Z vgritsenko $
 18    */
 19   
 20    package org.apache.xindice.tools;
 21   
 22    import java.util.StringTokenizer;
 23   
 24    /**
 25    * ArgTokenizer performs the difficult task of parsing
 26    * command-line arguments from various sources.
 27    *
 28    * @version $Revision: 541508 $, $Date: 2007-05-24 18:54:12 -0700 (Thu, 24 May 2007) $
 29    */
 30    public final class ArgTokenizer {
 31   
 32    private int idx;
 33    private String[] args;
 34   
 35   
 36  3 public ArgTokenizer(String[] args) {
 37  3 this.args = args;
 38    }
 39   
 40  0 public ArgTokenizer(String argString) {
 41  0 StringTokenizer st = new StringTokenizer(argString);
 42  0 args = new String[st.countTokens()];
 43  0 for (int i = 0; st.hasMoreTokens(); i++) {
 44  0 args[i] = st.nextToken();
 45    }
 46    }
 47   
 48  20 public boolean hasMoreTokens() {
 49  20 return idx < args.length;
 50    }
 51   
 52  3 public String nextSwitchToken() {
 53  3 if (hasMoreTokens()) {
 54  3 StringBuffer sb = new StringBuffer();
 55  3 sb.append(args[idx++]);
 56  3 while (hasMoreTokens()) {
 57  0 String nt = args[idx];
 58  0 if (nt.startsWith("-")) {
 59  0 break;
 60    }
 61   
 62  0 sb.append(' ').append(args[idx++]);
 63    }
 64   
 65  3 return sb.toString();
 66    }
 67   
 68  0 return "";
 69    }
 70   
 71  6 public String nextToken() {
 72  6 if (hasMoreTokens()) {
 73  6 return args[idx++];
 74    } else {
 75  0 return "";
 76    }
 77    }
 78    }