commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jke...@apache.org
Subject cvs commit: jakarta-commons/cli/src/java/org/apache/commons/cli CommandLineParser.java ArgumentBuilder.java Argument.java ArgumentImpl.java AnonymousArgumentImpl.java
Date Thu, 12 Jun 2003 21:22:49 GMT
jkeyes      2003/06/12 14:22:49

  Modified:    cli/src/test/org/apache/commons/cli Tag: cli_1_x
                        OptionBuilderTest.java ApplicationTest.java
                        UnitTestSuite.java ValueTest.java
                        AnonymousArgumentTest.java BugzillaTest.java
               cli/src/java/org/apache/commons/cli Tag: cli_1_x
                        CommandLineParser.java ArgumentBuilder.java
                        Argument.java ArgumentImpl.java
                        AnonymousArgumentImpl.java
  Added:       cli/src/test/org/apache/commons/cli Tag: cli_1_x
                        ArgumentTest.java
  Log:
  
- applied Robs patch for max and min value support
- removed some author tags (after reading
some mails on
  community@apache.org)
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.3.2.3   +16 -11    jakarta-commons/cli/src/test/org/apache/commons/cli/OptionBuilderTest.java
  
  Index: OptionBuilderTest.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/cli/src/test/org/apache/commons/cli/OptionBuilderTest.java,v
  retrieving revision 1.3.2.2
  retrieving revision 1.3.2.3
  diff -u -r1.3.2.2 -r1.3.2.3
  --- OptionBuilderTest.java	4 Jun 2003 01:21:54 -0000	1.3.2.2
  +++ OptionBuilderTest.java	12 Jun 2003 21:22:49 -0000	1.3.2.3
  @@ -86,7 +86,7 @@
       public void testCompleteOption() {
           Argument simple =
               abuilder
  -                .withSize(1)
  +                .withMaximumSize(1)
                   .withRequired(true)
                   .withValueType(Float.class)
                   .withDescription("this is a simple option")
  @@ -98,7 +98,8 @@
           assertEquals("simpleOption", simple.getLongName());
           assertEquals("this is a simple option", simple.getDescription());
           assertEquals(Float.class, simple.getValueType());
  -        assertEquals("one value", simple.getSize(), 1);
  +        assertEquals("one value", simple.getMinimumSize(), 1);
  +        assertEquals("one value", simple.getMaximumSize(), 1);
           assertTrue(simple.isRequired());
       }
   
  @@ -107,7 +108,7 @@
               abuilder
                   .withLongName("simple option")
                   .withRequired(true)
  -                .withSize(1)
  +                .withMaximumSize(1)
                   .withValueType(Float.class)
                   .withDescription("this is a simple option")
                   .withName("s")
  @@ -117,13 +118,14 @@
           assertEquals("simple option", simple.getLongName());
           assertEquals("this is a simple option", simple.getDescription());
           assertEquals(Float.class, simple.getValueType());
  -        assertEquals("one value", simple.getSize(), 1);
  +        assertEquals("one value", simple.getMinimumSize(), 1);
  +        assertEquals("one value", simple.getMaximumSize(), 1);
           assertTrue(simple.isRequired());
   
           simple =
               abuilder
                   .withLongName("dimple option")
  -                .withSize(1)
  +                .withMaximumSize(1)
                   .withDescription("this is a dimple option")
                   .withName("d")
                   .create();
  @@ -132,7 +134,8 @@
           assertEquals("dimple option", simple.getLongName());
           assertEquals("this is a dimple option", simple.getDescription());
           assertNull(simple.getValueType());
  -        assertEquals("one value", simple.getSize(), 1);
  +        assertEquals("one value", simple.getMinimumSize(), 1);
  +        assertEquals("one value", simple.getMaximumSize(), 1);
           assertTrue(!simple.isRequired());
       }
   
  @@ -186,10 +189,12 @@
           Argument opt =
               abuilder
                   .withDescription("option description")
  -                .withSize(2)
  +                .withMinimumSize(2)
  +                .withMaximumSize(2)
                   .withName("o")
                   .create();
  -        assertEquals(2, opt.getSize());
  +        assertEquals(2, opt.getMinimumSize());
  +        assertEquals(2, opt.getMaximumSize());
       }
   
       public void testIllegalOptions() {
  
  
  
  1.9.2.4   +4 -4      jakarta-commons/cli/src/test/org/apache/commons/cli/ApplicationTest.java
  
  Index: ApplicationTest.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/cli/src/test/org/apache/commons/cli/ApplicationTest.java,v
  retrieving revision 1.9.2.3
  retrieving revision 1.9.2.4
  diff -u -r1.9.2.3 -r1.9.2.4
  --- ApplicationTest.java	4 Jun 2003 01:21:54 -0000	1.9.2.3
  +++ ApplicationTest.java	12 Jun 2003 21:22:49 -0000	1.9.2.4
  @@ -266,7 +266,7 @@
   
       }
   
  -    public void XtestCVS() throws Exception {
  +    public void testCVS() throws Exception {
           OptionBuilder obuilder = new OptionBuilder();
           ArgumentBuilder abuilder = new ArgumentBuilder();
   
  
  
  
  1.1.2.2   +58 -4     jakarta-commons/cli/src/test/org/apache/commons/cli/Attic/UnitTestSuite.java
  
  Index: UnitTestSuite.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/cli/src/test/org/apache/commons/cli/Attic/UnitTestSuite.java,v
  retrieving revision 1.1.2.1
  retrieving revision 1.1.2.2
  diff -u -r1.1.2.1 -r1.1.2.2
  --- UnitTestSuite.java	19 May 2003 20:47:50 -0000	1.1.2.1
  +++ UnitTestSuite.java	12 Jun 2003 21:22:49 -0000	1.1.2.2
  @@ -1,8 +1,62 @@
   /*
  - * Created on Feb 20, 2003
  + * $Header$
  + * $Revision$
  + * $Date$
  + *
  + * ====================================================================
  + *
  + * The Apache Software License, Version 1.1
  + *
  + * Copyright (c) 1999-2003 The Apache Software Foundation.  All rights
  + * reserved.
  + *
  + * Redistribution and use in source and binary forms, with or without
  + * modification, are permitted provided that the following conditions
  + * are met:
  + *
  + * 1. Redistributions of source code must retain the above copyright
  + *    notice, this list of conditions and the following disclaimer.
  + *
  + * 2. Redistributions in binary form must reproduce the above copyright
  + *    notice, this list of conditions and the following disclaimer in
  + *    the documentation and/or other materials provided with the
  + *    distribution.
  + *
  + * 3. The end-user documentation included with the redistribution, if
  + *    any, must include the following acknowlegement:
  + *       "This product includes software developed by the
  + *        Apache Software Foundation (http://www.apache.org/)."
  + *    Alternately, this acknowlegement may appear in the software itself,
  + *    if and wherever such third-party acknowlegements normally appear.
  + *
  + * 4. The names "The Jakarta Project", "Commons", and "Apache Software
  + *    Foundation" must not be used to endorse or promote products derived
  + *    from this software without prior written permission. For written
  + *    permission, please contact apache@apache.org.
  + *
  + * 5. Products derived from this software may not be called "Apache"
  + *    nor may "Apache" appear in their names without prior written
  + *    permission of the Apache Group.
  + *
  + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
  + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  + * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
  + * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
  + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  + * SUCH DAMAGE.
  + * ====================================================================
  + *
  + * This software consists of voluntary contributions made by many
  + * individuals on behalf of the Apache Software Foundation.  For more
  + * information on the Apache Software Foundation, please see
  + * <http://www.apache.org/>;.
    *
  - * To change this generated comment go to 
  - * Window>Preferences>Java>Code Generation>Code Template
    */
   package org.apache.commons.cli;
   
  @@ -10,7 +64,6 @@
   import junit.framework.TestSuite;
   
   /**
  - * @author jkeyes
    */
   public class UnitTestSuite {
   
  @@ -19,6 +72,7 @@
   		//$JUnit-BEGIN$
   		suite.addTest(AnonymousArgumentTest.suite());
   		suite.addTest(ApplicationTest.suite());
  +        suite.addTest(ArgumentTest.suite());
   		suite.addTest(BugzillaTest.suite());
   		suite.addTest(ChildOptionTest.suite());
   		suite.addTest(CommandLineParserTest.suite());
  
  
  
  1.7.2.5   +11 -11    jakarta-commons/cli/src/test/org/apache/commons/cli/ValueTest.java
  
  Index: ValueTest.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/cli/src/test/org/apache/commons/cli/ValueTest.java,v
  retrieving revision 1.7.2.4
  retrieving revision 1.7.2.5
  diff -u -r1.7.2.4 -r1.7.2.5
  --- ValueTest.java	4 Jun 2003 01:21:54 -0000	1.7.2.4
  +++ ValueTest.java	12 Jun 2003 21:22:49 -0000	1.7.2.5
  @@ -104,36 +104,36 @@
   			.withName("d").withLongName("d").create();
   		opts.add(d);   
   			
  -		Argument e = abuilder.withOptionalValues(true)
  +		Argument e = abuilder.withMinimumSize(0)
   			.withName("e").create();
   		opts.add(e);   
   
  -		Argument fish = abuilder.withOptionalValues(true)
  +		Argument fish = abuilder.withMinimumSize(0)
   			.withLongName("fish").create();
   		opts.add(fish);   
   			
  -		Argument gravy = abuilder.withOptionalValues(true)
  -		    .withSize(100)
  +		Argument gravy = abuilder.withMinimumSize(0)
  +		    .withMaximumSize(100)
   			.withLongName("gravy").create();
   		opts.add(gravy);   
   
  -		Argument hide = abuilder.withOptionalValues(true)
  -		    .withSize(2)
  +		Argument hide = abuilder.withMinimumSize(0)
  +		    .withMaximumSize(2)
   			.withLongName("hide").create();
   		opts.add(hide);   
   
   
  -		Argument i = abuilder.withOptionalValues(true)
  -		    .withSize(2)
  +		Argument i = abuilder.withMinimumSize(0)
  +		    .withMaximumSize(2)
   			.withName("i").create();
   		opts.add(i);   
   
  -		Argument j = abuilder.withOptionalValues(true)
  -		    .withSize(2)
  +		Argument j = abuilder.withMinimumSize(0)
  +		    .withMaximumSize(2)
   			.withName("j").create();
   		opts.add(j);   
   			
  -		Argument k = abuilder.withOptionalValues(true)
  +		Argument k = abuilder.withMinimumSize(0)
   		    .withValueSeparator(',')
   			.withName("k").create();
   		opts.add(k);   
  
  
  
  1.1.2.5   +5 -4      jakarta-commons/cli/src/test/org/apache/commons/cli/Attic/AnonymousArgumentTest.java
  
  Index: AnonymousArgumentTest.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/cli/src/test/org/apache/commons/cli/Attic/AnonymousArgumentTest.java,v
  retrieving revision 1.1.2.4
  retrieving revision 1.1.2.5
  diff -u -r1.1.2.4 -r1.1.2.5
  --- AnonymousArgumentTest.java	8 Jun 2003 18:16:01 -0000	1.1.2.4
  +++ AnonymousArgumentTest.java	12 Jun 2003 21:22:49 -0000	1.1.2.5
  @@ -161,7 +161,8 @@
       public void testAccessors() throws Exception {
           ArgumentBuilder abuilder = new ArgumentBuilder();
           Argument anon = abuilder.createAnonymous("token");
  -        assertEquals(0, anon.getSize());
  +        assertEquals(0, anon.getMaximumSize());
  +        assertEquals(0, anon.getMinimumSize());
           assertEquals("token", anon.getValueName());
           try {
               anon.hasOptionalValues();
  
  
  
  1.1.2.6   +7 -11     jakarta-commons/cli/src/test/org/apache/commons/cli/Attic/BugzillaTest.java
  
  Index: BugzillaTest.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/cli/src/test/org/apache/commons/cli/Attic/BugzillaTest.java,v
  retrieving revision 1.1.2.5
  retrieving revision 1.1.2.6
  diff -u -r1.1.2.5 -r1.1.2.6
  --- BugzillaTest.java	8 Jun 2003 18:16:01 -0000	1.1.2.5
  +++ BugzillaTest.java	12 Jun 2003 21:22:49 -0000	1.1.2.6
  @@ -96,7 +96,7 @@
           Option p =
               builder
                   .withValueSeparator(':')
  -                .withSize(100)
  +                .withMaximumSize(100)
                   .withName("p")
                   .create();
           options.add(p);
  @@ -105,7 +105,7 @@
               new String[] { "-DJAVA_HOME=/opt/java", "-pfile1:file2:file3" };
   
           CommandLineParser parser = new CommandLineParser();
  -
  + 
           CommandLine cmd = parser.parse(options, args);
   
           java.util.Properties props = cmd.getProperties();
  @@ -376,12 +376,9 @@
           Options options = new Options();
   
           ArgumentBuilder builder = new ArgumentBuilder();
  -        Option a = builder.withOptionalValues(true).withName("a").create();
  -        //options.addOption( OptionBuilder.hasOptionalArg()
  -        //				   .create( 'a' ) );
  +        Option a = builder.withMinimumSize(0).withName("a").create();
           Option b = builder.withName("b").create();
  -        //options.addOption( OptionBuilder.hasArg()
  -        //				   .create( 'b' ) );
  +
           options.add(a);
           options.add(b);
           String[] args = new String[] { "-a", "-bvalue" };
  @@ -396,5 +393,4 @@
           cmd = parser.parse(options, args);
           assertEquals(cmd.getValue("-b"), "value");
       }
  -
   }
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.1   +144 -0    jakarta-commons/cli/src/test/org/apache/commons/cli/Attic/ArgumentTest.java
  
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.6.2.9   +25 -22    jakarta-commons/cli/src/java/org/apache/commons/cli/CommandLineParser.java
  
  Index: CommandLineParser.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/cli/src/java/org/apache/commons/cli/CommandLineParser.java,v
  retrieving revision 1.6.2.8
  retrieving revision 1.6.2.9
  diff -u -r1.6.2.8 -r1.6.2.9
  --- CommandLineParser.java	8 Jun 2003 18:16:01 -0000	1.6.2.8
  +++ CommandLineParser.java	12 Jun 2003 21:22:49 -0000	1.6.2.9
  @@ -381,30 +381,36 @@
           final List argList)
       throws MissingValueException {
           
  -        int size = argument.getSize();
  +        final int minimumSize = argument.getMinimumSize();
  +        final int maximumSize = argument.getMaximumSize();
           int processed = argList.size();
  -
  -        if (!iter.hasNext() && processed == 0) {
  -            if (argument.hasOptionalValues()) {
  -                return argList;
  -            }
  -            throw new MissingValueException(
  -                "Missing value for argument {" + argument.getName() + "}");
  -        }
  -
  -        while (processed < size && iter.hasNext()) {
  +        
  +        // grab all of the values
  +        while (processed < maximumSize && iter.hasNext()) {
               String arg = (String) iter.next();
               if (arg != null && ("-".equals(arg) || !arg.startsWith("-"))) {
  +                // add valid value to the list
                   argList.add(stripLeadingAndTrailingQuotes(arg));
                   processed++;
  -            } else if (!argument.hasOptionalValues()) {
  -                throw new MissingValueException(
  -                    "Missing value for argument {" + argument.getName() + "}");
  -            } else {
  +            }
  +            else {
  +                // backup one and abort the loop
                   iter.previous();
  -                return argList;
  +                break;
  +            }
  +        }
  +        
  +        // check that we have enough values
  +        if (processed < minimumSize) {
  +            String name = argument.getLongName();
  +            
  +            if (name == null) {
  +                // use the short version
  +                name = argument.getName();
               }
  +            throw new MissingValueException(name);
           }
  +
           return argList;
       }
   
  @@ -422,9 +428,6 @@
   
           while (iter.hasNext()) {
               String value = (String) iter.next();
  -            //if( value.startsWith("-") ) {
  -            //throw new ParseException( "option str in anonymous values" );
  -            //}
               args.add(value);
           }
           return args;
  
  
  
  1.1.2.7   +30 -32    jakarta-commons/cli/src/java/org/apache/commons/cli/Attic/ArgumentBuilder.java
  
  Index: ArgumentBuilder.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/cli/src/java/org/apache/commons/cli/Attic/ArgumentBuilder.java,v
  retrieving revision 1.1.2.6
  retrieving revision 1.1.2.7
  diff -u -r1.1.2.6 -r1.1.2.7
  --- ArgumentBuilder.java	9 Jun 2003 22:39:50 -0000	1.1.2.6
  +++ ArgumentBuilder.java	12 Jun 2003 21:22:49 -0000	1.1.2.7
  @@ -67,7 +67,6 @@
    * the state is reset so no settings from previous calls will
    * be preserved.
    * 
  - * @author John Keyes
    * @since 2.0
    */
   public class ArgumentBuilder {
  @@ -96,15 +95,15 @@
       /** a textual description of the value */
       private String valueName;
   
  -    /** the number of values this argument has */
  -    private int size = 1;
  +    /** the minimum number of values this argument has */
  +    private int minimumSize = 1;
  +    
  +    /** the maximum number of values this argument has */
  +    private int maximumSize = 1;
   
       /** the type of the argument value */
       private Class type;
   
  -    /** specifies whether the values can be omitted, by default false */
  -    private boolean hasOptionalValues;
  -    
       /** TODO: javadoc */
       private ValueValidator valueValidator;
   
  @@ -129,11 +128,11 @@
                   this.longName,
                   this.description,
                   this.required,
  -                this.size,
  +                this.minimumSize,
  +                this.maximumSize,
                   this.type,
                   this.valueSeparator,
                   this.valueName,
  -                this.hasOptionalValues,
                   this.options,
                   this.valueValidator);
           } finally {
  @@ -259,43 +258,42 @@
       }
       
       /**
  -     * Sets the number of values the next Argument created will have.
  +     * Sets the maximum number of values the next Argument created will have.
        * 
        * @param size
        *     the number of values
        * 
        * @return the ArgumentBuilder
  -     */
  -    public ArgumentBuilder withSize(final int size) {
  -        this.size = size;
  +     */    
  +    public ArgumentBuilder withMaximumSize(final int size) {
  +        this.maximumSize = size;
           return this;
       }
  -
  +    
       /**
  -     * Sets the type of the value of the next Argument to be created.
  +     * Sets the maximum number of values the next Argument created will have.
        * 
  -     * @param type
  -     *     the class type of the argument value e.g. Integer.class
  +     * @param size
  +     *     the number of values
        * 
        * @return the ArgumentBuilder
  -     */
  -    public ArgumentBuilder withValueType(final Class type) {
  -        this.type = type;
  +     */    
  +    public ArgumentBuilder withMinimumSize(final int size) {
  +        this.minimumSize = size;
           return this;
       }
  +    
   
       /**
  -     * Sets whether the values of the next Argument to be created
  -     * are required or not.
  +     * Sets the type of the value of the next Argument to be created.
  +     * 
  +     * @param type
  +     *     the class type of the argument value e.g. Integer.class
        * 
  -     * @param optional
  -     *     if true, the next Argument must be present when the command line
  -     *     is parsed, otherwise it does not
  -     *
        * @return the ArgumentBuilder
        */
  -    public ArgumentBuilder withOptionalValues(final boolean optional) {
  -        this.hasOptionalValues = optional;
  +    public ArgumentBuilder withValueType(final Class type) {
  +        this.type = type;
           return this;
       }
   
  @@ -310,9 +308,9 @@
           this.valueSeparator = (char) 0;
           this.valueName = null;
           this.valueValidator = null;
  -        this.size = 1;
  +        this.minimumSize = 1;
  +        this.maximumSize = 1;
           this.type = null;
  -        this.hasOptionalValues = false;
           this.description = null;
       }
   }
  
  
  
  1.1.2.5   +19 -12    jakarta-commons/cli/src/java/org/apache/commons/cli/Attic/Argument.java
  
  Index: Argument.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/cli/src/java/org/apache/commons/cli/Attic/Argument.java,v
  retrieving revision 1.1.2.4
  retrieving revision 1.1.2.5
  diff -u -r1.1.2.4 -r1.1.2.5
  --- Argument.java	9 Jun 2003 22:39:50 -0000	1.1.2.4
  +++ Argument.java	12 Jun 2003 21:22:49 -0000	1.1.2.5
  @@ -64,7 +64,6 @@
    * An Argument is a command line Option that also has an associated
    * value or values.
    * 
  - * @author John Keyes
    * @since 2.0
    */
   public interface Argument extends Option {
  @@ -97,14 +96,6 @@
       String getValueName();
   
       /**
  -     * Returns the number of values that this argument is permitted
  -     * to have.
  -     * 
  -     * @return the number of argument values
  -     */
  -    int getSize();
  -
  -    /**
        * Returns whether the values of this argument are optional.
        * If they are optional the argument is effectively an Option.
        * 
  @@ -112,6 +103,22 @@
        */
       boolean hasOptionalValues();
       
  +    /**
  +     * Returns the minimum number of values that this argument is permitted
  +     * to have.
  +     *
  +     * @return the minimum number of argument values
  +     */
  +    int getMinimumSize();
  +
  +    /**
  +     * Returns the maximum number of values that this argument is permitted
  +     * to have.
  +     *
  +     * @return the maximum number of argument values
  +     */
  +    int getMaximumSize();
  +
       /** TODO: javadoc */
       ValueValidator getValueValidator();
   }
  
  
  
  1.1.2.6   +21 -16    jakarta-commons/cli/src/java/org/apache/commons/cli/Attic/ArgumentImpl.java
  
  Index: ArgumentImpl.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/cli/src/java/org/apache/commons/cli/Attic/ArgumentImpl.java,v
  retrieving revision 1.1.2.5
  retrieving revision 1.1.2.6
  diff -u -r1.1.2.5 -r1.1.2.6
  --- ArgumentImpl.java	9 Jun 2003 22:39:51 -0000	1.1.2.5
  +++ ArgumentImpl.java	12 Jun 2003 21:22:49 -0000	1.1.2.6
  @@ -68,7 +68,8 @@
   class ArgumentImpl extends OptionImpl implements Argument {
   
       /** the number of values */
  -    private final int size;
  +    private final int minimumSize;
  +    private final int maximumSize;
   
       /** the value separator */
       private final char valueSeparator;
  @@ -79,9 +80,6 @@
       /** the type of the value(s) */
       private final Class type;
   
  -    /** whether this argument has optional values */
  -    private final boolean hasOptionalValues;
  -    
       /** TODO: javadoc */
       private final ValueValidator validator;
   
  @@ -124,29 +122,36 @@
           final String longName,
           final String description,
           final boolean required,
  -        final int size,
  +        final int minimumSize,
  +        final int maximumSize,
           final Class type,
           final char valueSeparator,
           final String valueName,
  -        final boolean hasOptionalValues,
           final Options options,
           final ValueValidator validator) {
  -
  +            
           super(name, longName, description, required, options);
   
  -        this.size = size;
  +        this.minimumSize = minimumSize;
  +        this.maximumSize = maximumSize;
           this.type = type;
           this.valueSeparator = valueSeparator;
           this.valueName = valueName;
  -        this.hasOptionalValues = hasOptionalValues;
           this.validator = validator;
       }
   
       /**
  -     * @see Argument#getSize()
  +     * @see Argument#getMaximumSize()
  +     */
  +    public int getMaximumSize() {
  +        return this.maximumSize;
  +    }
  +    
  +    /**
  +     * @see Argument#getMinimumSize()
        */
  -    public int getSize() {
  -        return this.size;
  +    public int getMinimumSize() {
  +        return this.minimumSize;
       }
   
       /**
  @@ -174,7 +179,7 @@
        * @see Argument#hasOptionalValues()
        */
       public boolean hasOptionalValues() {
  -        return this.hasOptionalValues;
  +        return minimumSize<maximumSize;
       }
   
       /**
  
  
  
  1.1.2.8   +13 -9     jakarta-commons/cli/src/java/org/apache/commons/cli/Attic/AnonymousArgumentImpl.java
  
  Index: AnonymousArgumentImpl.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/cli/src/java/org/apache/commons/cli/Attic/AnonymousArgumentImpl.java,v
  retrieving revision 1.1.2.7
  retrieving revision 1.1.2.8
  diff -u -r1.1.2.7 -r1.1.2.8
  --- AnonymousArgumentImpl.java	9 Jun 2003 22:39:51 -0000	1.1.2.7
  +++ AnonymousArgumentImpl.java	12 Jun 2003 21:22:49 -0000	1.1.2.8
  @@ -110,15 +110,19 @@
       }
   
       /**
  -     * @task implement this method
  -     * Returns the number of values for this Argument.
  -     * 
  -     * @return the number of values
  +     * @see org.apache.commons.cli.Argument#getMaximumSize()
        */
  -    public int getSize() {
  +    public int getMaximumSize(){
           return 0;
       }
  -
  +    
  +    /**
  +     * @see org.apache.commons.cli.Argument#getMinimumSize()
  +     */
  +    public int getMinimumSize(){
  +        return 0;
  +    }
  +    
       /**
        * @task this should be implemented by the getDescription
        *       method
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message