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/cli2/impl GroupImpl.java
Date Fri, 05 Mar 2004 01:53:01 GMT
jkeyes      2004/03/04 17:53:01

  Modified:    cli/src/java/org/apache/commons/cli2/impl Tag:
                        RESEARCH_CLI_2_ROXSPRING GroupImpl.java
  Log:
  - simplified canProcess method
  
  Revision  Changes    Path
  No                   revision
  No                   revision
  1.1.2.7   +10 -11    jakarta-commons/cli/src/java/org/apache/commons/cli2/impl/Attic/GroupImpl.java
  
  Index: GroupImpl.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/cli/src/java/org/apache/commons/cli2/impl/Attic/GroupImpl.java,v
  retrieving revision 1.1.2.6
  retrieving revision 1.1.2.7
  diff -u -r1.1.2.6 -r1.1.2.7
  --- GroupImpl.java	24 Feb 2004 02:01:40 -0000	1.1.2.6
  +++ GroupImpl.java	5 Mar 2004 01:53:01 -0000	1.1.2.7
  @@ -102,25 +102,24 @@
               return false;
           }
   
  +        // if arg does not require bursting
           if (optionMap.containsKey(arg)) {
               return true;
           }
   
  -        final Iterator i = optionMap.tailMap(arg).entrySet().iterator();
  -        while (i.hasNext()) {
  -            final Map.Entry entry = (Map.Entry)i.next();
  -            final Option option = (Option)entry.getValue();
  +        // check if bursting is required
  +        for (final Iterator iter = optionMap.values().iterator();
  +            iter.hasNext();) {
  +            
  +            final Option option = (Option) iter.next();
               if (option.canProcess(arg)) {
                   return true;
               }
           }
  -
  -        final ListIterator j = anonymous.listIterator();
  -        while (j.hasNext()) {
  -            final Option option = (Option)j.next();
  -            if (option.canProcess(arg)) {
  -                return true;
  -            }
  +        
  +        // anonymous argument(s) means we can process it
  +        if (anonymous.size() > 0) {
  +            return true;
           }
   
           return false;
  
  
  

---------------------------------------------------------------------
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