You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by ro...@apache.org on 2003/10/23 01:33:13 UTC
cvs commit: jakarta-commons-sandbox/cli/src/java/org/apache/commons/cli2 ArgumentImpl.java
roxspring 2003/10/22 16:33:13
Modified: cli/src/java/org/apache/commons/cli2 ArgumentImpl.java
Log:
Uncommented the processValues(...) method as it was never supposed to be committed without it.
Revision Changes Path
1.4 +38 -38 jakarta-commons-sandbox/cli/src/java/org/apache/commons/cli2/ArgumentImpl.java
Index: ArgumentImpl.java
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/cli/src/java/org/apache/commons/cli2/ArgumentImpl.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- ArgumentImpl.java 21 Oct 2003 20:23:21 -0000 1.3
+++ ArgumentImpl.java 22 Oct 2003 23:33:13 -0000 1.4
@@ -65,6 +65,7 @@
import java.util.List;
import java.util.ListIterator;
import java.util.Set;
+import java.util.StringTokenizer;
import org.apache.commons.cli2.validation.InvalidArgumentException;
import org.apache.commons.cli2.validation.Validator;
@@ -136,40 +137,40 @@
/* (non-Javadoc)
* @see org.apache.commons.cli2.Argument#processValues(org.apache.commons.cli2.CommandLine, java.util.ListIterator)
*/
- // public void processValues(
- // final CommandLine commandLine,
- // final ListIterator arguments)
- // throws OptionException {
- //
- // commandLine.addOption(this);
- // int argumentCount = commandLine.getValues(this).size();
- // while (arguments.hasNext() && argumentCount < maximum) {
- //
- // final String allValues = (String) arguments.next();
- //
- // if (commandLine.looksLikeOption(allValues)) {
- // arguments.previous();
- // break;
- // }
- //
- // final StringTokenizer values =
- // new StringTokenizer(
- // allValues,
- // String.valueOf(subsequentSepatator));
- //
- // while (values.hasMoreTokens() && argumentCount < maximum) {
- // ++argumentCount;
- // commandLine.addValue(this, values.nextToken());
- // }
- // if (values.hasMoreTokens()) {
- // throw new UnexpectedValueException(this, values.nextToken());
- // }
- // }
- //
- // if (argumentCount < minimum) {
- // throw new MissingValueException(this);
- // }
- // }
+ public void processValues(
+ final CommandLine commandLine,
+ final ListIterator arguments)
+ throws OptionException {
+
+ commandLine.addOption(this);
+ int argumentCount = commandLine.getValues(this).size();
+ while (arguments.hasNext() && argumentCount < maximum) {
+
+ final String allValues = (String) arguments.next();
+
+ if (commandLine.looksLikeOption(allValues)) {
+ arguments.previous();
+ break;
+ }
+
+ final StringTokenizer values =
+ new StringTokenizer(
+ allValues,
+ String.valueOf(subsequentSepatator));
+
+ while (values.hasMoreTokens() && argumentCount < maximum) {
+ ++argumentCount;
+ commandLine.addValue(this, values.nextToken());
+ }
+ if (values.hasMoreTokens()) {
+ throw new UnexpectedValueException(this, values.nextToken());
+ }
+ }
+
+ if (argumentCount < minimum) {
+ throw new MissingValueException(this);
+ }
+ }
/* (non-Javadoc)
* @see org.apache.commons.cli2.Argument#getName()
@@ -186,7 +187,6 @@
if (initialSplit)
{
-
final String argument = (String)args.next();
final int initialIndex = argument.indexOf(initialSeparator);
if (initialIndex > 0)
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org