commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ebo...@apache.org
Subject svn commit: r680644 [2/2] - in /commons/proper/cli/branches/cli-1.x: ./ src/conf/ src/java/org/apache/commons/cli/ src/test/org/apache/commons/cli/
Date Tue, 29 Jul 2008 08:13:50 GMT
Modified: commons/proper/cli/branches/cli-1.x/src/java/org/apache/commons/cli/PosixParser.java
URL: http://svn.apache.org/viewvc/commons/proper/cli/branches/cli-1.x/src/java/org/apache/commons/cli/PosixParser.java?rev=680644&r1=680643&r2=680644&view=diff
==============================================================================
--- commons/proper/cli/branches/cli-1.x/src/java/org/apache/commons/cli/PosixParser.java (original)
+++ commons/proper/cli/branches/cli-1.x/src/java/org/apache/commons/cli/PosixParser.java Tue
Jul 29 01:13:48 2008
@@ -23,15 +23,14 @@
 import java.util.List;
 
 /**
- * The class PosixParser provides an implementation of the 
+ * The class PosixParser provides an implementation of the
  * {@link Parser#flatten(Options,String[],boolean) flatten} method.
  *
  * @author John Keyes (john at integralsource.com)
- * @see Parser
- * @version $Revision$
+ * @version $Revision$, $Date$
  */
-public class PosixParser extends Parser {
-
+public class PosixParser extends Parser
+{
     /** holder for flattened tokens */
     private List tokens = new ArrayList();
 
@@ -71,14 +70,14 @@
      *  is a valid {@link Option} id.  If it is a valid id, then add the
      *  entry to the list of processed tokens and set the current {@link Option}
      *  member.  If it is not a valid id and <code>stopAtNonOption</code>
-     *  is true, then the remaining entries are copied to the list of 
+     *  is true, then the remaining entries are copied to the list of
      *  processed tokens.  Otherwise, the current entry is ignored.</li>
      *  <li>if the current <code>arguments</code> entry is more than two
      *  characters in length and the first character is "<b>-</b>" then
      *  we need to burst the entry to determine its constituents.  For more
-     *  information on the bursting algorithm see 
+     *  information on the bursting algorithm see
      *  {@link PosixParser#burstToken(String, boolean) burstToken}.</li>
-     *  <li>if the current <code>arguments</code> entry is not handled

+     *  <li>if the current <code>arguments</code> entry is not handled
      *  by any of the previous rules, then the entry is added to the list
      *  of processed tokens.</li>
      * </ol>
@@ -117,7 +116,8 @@
                 else
                 {
                     tokens.add(opt);
-                    if (pos != -1) {
+                    if (pos != -1)
+                    {
                         tokens.add(token.substring(pos + 1));
                     }
                 }
@@ -212,26 +212,26 @@
     }
 
     /**
-     * <p>Breaks <code>token</code> into its constituent parts
+     * Breaks <code>token</code> into its constituent parts
      * using the following algorithm.
+     *
      * <ul>
      *  <li>ignore the first character ("<b>-</b>")</li>
      *  <li>foreach remaining character check if an {@link Option}
      *  exists with that id.</li>
      *  <li>if an {@link Option} does exist then add that character
      *  prepended with "<b>-</b>" to the list of processed tokens.</li>
-     *  <li>if the {@link Option} can have an argument value and there 
-     *  are remaining characters in the token then add the remaining 
+     *  <li>if the {@link Option} can have an argument value and there
+     *  are remaining characters in the token then add the remaining
      *  characters as a token to the list of processed tokens.</li>
-     *  <li>if an {@link Option} does <b>NOT</b> exist <b>AND</b>

+     *  <li>if an {@link Option} does <b>NOT</b> exist <b>AND</b>
      *  <code>stopAtNonOption</code> <b>IS</b> set then add the special
token
-     *  "<b>--</b>" followed by the remaining characters and also 
+     *  "<b>--</b>" followed by the remaining characters and also
      *  the remaining tokens directly to the processed tokens list.</li>
      *  <li>if an {@link Option} does <b>NOT</b> exist <b>AND</b>
      *  <code>stopAtNonOption</code> <b>IS NOT</b> set then add that
      *  character prepended with "<b>-</b>".</li>
      * </ul>
-     * </p>
      *
      * @param token The current token to be <b>burst</b>
      * @param stopAtNonOption Specifies whether to stop processing
@@ -240,7 +240,7 @@
     protected void burstToken(String token, boolean stopAtNonOption)
     {
         Option currentOption;
-        
+
         for (int i = 1; i < token.length(); i++)
         {
             String ch = String.valueOf(token.charAt(i));

Modified: commons/proper/cli/branches/cli-1.x/src/java/org/apache/commons/cli/TypeHandler.java
URL: http://svn.apache.org/viewvc/commons/proper/cli/branches/cli-1.x/src/java/org/apache/commons/cli/TypeHandler.java?rev=680644&r1=680643&r2=680644&view=diff
==============================================================================
--- commons/proper/cli/branches/cli-1.x/src/java/org/apache/commons/cli/TypeHandler.java (original)
+++ commons/proper/cli/branches/cli-1.x/src/java/org/apache/commons/cli/TypeHandler.java Tue
Jul 29 01:13:48 2008
@@ -1,4 +1,4 @@
-/*
+/**
  * Licensed to the Apache Software Foundation (ASF) under one or more
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
@@ -14,6 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+
 package org.apache.commons.cli;
 
 import java.io.File;
@@ -24,16 +25,16 @@
 import java.util.Date;
 
 /**
-  * This is a temporary implementation. TypeHandler will handle the 
-  * pluggableness of OptionTypes and it will direct all of these types 
-  * of conversion functionalities to ConvertUtils component in Commons 
-  * alreayd. BeanUtils I think.
+  * This is a temporary implementation. TypeHandler will handle the
+  * pluggableness of OptionTypes and it will direct all of these types
+  * of conversion functionalities to ConvertUtils component in Commons
+  * already. BeanUtils I think.
   *
   * @author Henri Yandell (bayard @ generationjava.com)
-  * @version $Revision$
+  * @version $Revision$, $Date$
   */
-public class TypeHandler {
-
+public class TypeHandler
+{
     /**
      * Returns the <code>Object</code> of type <code>obj</code>
      * with the value of <code>str</code>.
@@ -105,7 +106,7 @@
       * Create an Object from the classname and empty constructor.
       *
       * @param str the argument value
-      * @return the initialised object, or null if it couldn't create 
+      * @return the initialised object, or null if it couldn't create
       * the Object.
       */
     public static Object createObject(String str)
@@ -138,7 +139,7 @@
     }
 
     /**
-     * Create a number from a String. If a . is present, it creates a 
+     * Create a number from a String. If a . is present, it creates a
      * Double, otherwise a Long.
      *
      * @param str the value
@@ -149,7 +150,7 @@
     {
         try
         {
-            if( str.indexOf('.') != -1 )
+            if (str.indexOf('.') != -1)
             {
                 return Double.valueOf(str);
             }

Modified: commons/proper/cli/branches/cli-1.x/src/java/org/apache/commons/cli/UnrecognizedOptionException.java
URL: http://svn.apache.org/viewvc/commons/proper/cli/branches/cli-1.x/src/java/org/apache/commons/cli/UnrecognizedOptionException.java?rev=680644&r1=680643&r2=680644&view=diff
==============================================================================
--- commons/proper/cli/branches/cli-1.x/src/java/org/apache/commons/cli/UnrecognizedOptionException.java
(original)
+++ commons/proper/cli/branches/cli-1.x/src/java/org/apache/commons/cli/UnrecognizedOptionException.java
Tue Jul 29 01:13:48 2008
@@ -22,7 +22,7 @@
  * option was seen.
  *
  * @author bob mcwhiter (bob @ werken.com)
- * @version $Revision$
+ * @version $Revision$, $Date$
  */
 public class UnrecognizedOptionException extends ParseException
 {
@@ -57,6 +57,7 @@
     /**
      * Returns the unrecognized option.
      *
+     * @return the related option
      * @since 1.2
      */
     public String getOption()

Modified: commons/proper/cli/branches/cli-1.x/src/java/org/apache/commons/cli/Util.java
URL: http://svn.apache.org/viewvc/commons/proper/cli/branches/cli-1.x/src/java/org/apache/commons/cli/Util.java?rev=680644&r1=680643&r2=680644&view=diff
==============================================================================
--- commons/proper/cli/branches/cli-1.x/src/java/org/apache/commons/cli/Util.java (original)
+++ commons/proper/cli/branches/cli-1.x/src/java/org/apache/commons/cli/Util.java Tue Jul
29 01:13:48 2008
@@ -14,18 +14,20 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+
 package org.apache.commons.cli;
 
 /**
  * Contains useful helper methods for classes within this package.
  *
  * @author John Keyes (john at integralsource.com)
+ * @version $Revision$, $Date$
  */
-class Util {
-
+class Util
+{
     /**
-     * <p>Remove the hyphens from the begining of <code>str</code> and
-     * return the new String.</p>
+     * Remove the hyphens from the begining of <code>str</code> and
+     * return the new String.
      *
      * @param str The string from which the hyphens should be removed.
      *
@@ -33,7 +35,8 @@
      */
     static String stripLeadingHyphens(String str)
     {
-        if (str == null) {
+        if (str == null)
+        {
             return null;
         }
         if (str.startsWith("--"))
@@ -59,12 +62,14 @@
      */
     static String stripLeadingAndTrailingQuotes(String str)
     {
-        if (str.startsWith("\"")) {
+        if (str.startsWith("\""))
+        {
             str = str.substring(1, str.length());
         }
-        if (str.endsWith("\"")) {
-            str = str.substring(0, str.length()-1);
+        if (str.endsWith("\""))
+        {
+            str = str.substring(0, str.length() - 1);
         }
         return str;
     }
-}
\ No newline at end of file
+}

Modified: commons/proper/cli/branches/cli-1.x/src/test/org/apache/commons/cli/ArgumentIsOptionTest.java
URL: http://svn.apache.org/viewvc/commons/proper/cli/branches/cli-1.x/src/test/org/apache/commons/cli/ArgumentIsOptionTest.java?rev=680644&r1=680643&r2=680644&view=diff
==============================================================================
--- commons/proper/cli/branches/cli-1.x/src/test/org/apache/commons/cli/ArgumentIsOptionTest.java
(original)
+++ commons/proper/cli/branches/cli-1.x/src/test/org/apache/commons/cli/ArgumentIsOptionTest.java
Tue Jul 29 01:13:48 2008
@@ -42,8 +42,7 @@
         CommandLine cl = parser.parse(options, args);
         assertTrue("Confirm -p is set", cl.hasOption("p"));
         assertTrue("Confirm -attr is set", cl.hasOption("attr"));
-        assertTrue("Confirm arg of -attr",
-                cl.getOptionValue("attr").equals("p"));
+        assertTrue("Confirm arg of -attr", cl.getOptionValue("attr").equals("p"));
         assertTrue("Confirm all arguments recognized", cl.getArgs().length == 0);
     }
 

Modified: commons/proper/cli/branches/cli-1.x/src/test/org/apache/commons/cli/UtilTest.java
URL: http://svn.apache.org/viewvc/commons/proper/cli/branches/cli-1.x/src/test/org/apache/commons/cli/UtilTest.java?rev=680644&r1=680643&r2=680644&view=diff
==============================================================================
--- commons/proper/cli/branches/cli-1.x/src/test/org/apache/commons/cli/UtilTest.java (original)
+++ commons/proper/cli/branches/cli-1.x/src/test/org/apache/commons/cli/UtilTest.java Tue
Jul 29 01:13:48 2008
@@ -22,16 +22,18 @@
 /**
  * @author brianegge
  */
-public class UtilTest extends TestCase {
-
-    public void testStripLeadingHyphens() {
+public class UtilTest extends TestCase
+{
+    public void testStripLeadingHyphens()
+    {
         assertEquals("f", Util.stripLeadingHyphens("-f"));
         assertEquals("foo", Util.stripLeadingHyphens("--foo"));
         assertEquals("-foo", Util.stripLeadingHyphens("---foo"));
         assertNull(Util.stripLeadingHyphens(null));
     }
 
-    public void testStripLeadingAndTrailingQuotes() {
+    public void testStripLeadingAndTrailingQuotes()
+    {
         assertEquals("foo", Util.stripLeadingAndTrailingQuotes("\"foo\""));
     }
 }



Mime
View raw message