commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From simonetrip...@apache.org
Subject svn commit: r1227719 [3/3] - in /commons/proper/validator/trunk/src/main/java/org/apache/commons/validator: ./ routines/ routines/checkdigit/ util/
Date Thu, 05 Jan 2012 17:45:52 GMT
Modified: commons/proper/validator/trunk/src/main/java/org/apache/commons/validator/routines/checkdigit/ModulusCheckDigit.java
URL: http://svn.apache.org/viewvc/commons/proper/validator/trunk/src/main/java/org/apache/commons/validator/routines/checkdigit/ModulusCheckDigit.java?rev=1227719&r1=1227718&r2=1227719&view=diff
==============================================================================
--- commons/proper/validator/trunk/src/main/java/org/apache/commons/validator/routines/checkdigit/ModulusCheckDigit.java
(original)
+++ commons/proper/validator/trunk/src/main/java/org/apache/commons/validator/routines/checkdigit/ModulusCheckDigit.java
Thu Jan  5 17:45:51 2012
@@ -35,6 +35,8 @@ import java.io.Serializable;
  */
 public abstract class ModulusCheckDigit implements CheckDigit, Serializable {
 
+    private static final long serialVersionUID = 2948962251251528941L;
+
     private final int modulus;
 
     /**
@@ -66,7 +68,7 @@ public abstract class ModulusCheckDigit 
         if (code == null || code.length() == 0) {
             return false;
         }
-        try {       
+        try {
             int modulusResult = calculateModulus(code, true);
             return (modulusResult == 0);
         } catch (CheckDigitException  ex) {
@@ -126,7 +128,7 @@ public abstract class ModulusCheckDigit 
      * required by overriding this method.
      *
      * @param charValue The numeric value of the character
-     * @param leftPos The position of the character in the code, counting from left to right

+     * @param leftPos The position of the character in the code, counting from left to right
      * @param rightPos The positionof the character in the code, counting from right to left
      * @return The weighted value of the character
      * @throws CheckDigitException if an error occurs calculating
@@ -144,7 +146,7 @@ public abstract class ModulusCheckDigit 
      * character-->integer conversion.
      *
      * @param character The character to convert
-     * @param leftPos The position of the character in the code, counting from left to right

+     * @param leftPos The position of the character in the code, counting from left to right
      * @param rightPos The positionof the character in the code, counting from right to left
      * @return The integer value of the character
      * @throws CheckDigitException if character is non-numeric
@@ -154,7 +156,7 @@ public abstract class ModulusCheckDigit 
         if (Character.isDigit(character)) {
             return Character.getNumericValue(character);
         } else {
-            throw new CheckDigitException("Invalid Character[" + 
+            throw new CheckDigitException("Invalid Character[" +
                     leftPos + "] = '" + character + "'");
         }
     }
@@ -176,7 +178,7 @@ public abstract class ModulusCheckDigit 
         if (charValue >= 0 && charValue <= 9) {
             return Integer.toString(charValue);
         } else {
-            throw new CheckDigitException("Invalid Check Digit Value =" + 
+            throw new CheckDigitException("Invalid Check Digit Value =" +
                     + charValue);
         }
     }

Modified: commons/proper/validator/trunk/src/main/java/org/apache/commons/validator/routines/checkdigit/SedolCheckDigit.java
URL: http://svn.apache.org/viewvc/commons/proper/validator/trunk/src/main/java/org/apache/commons/validator/routines/checkdigit/SedolCheckDigit.java?rev=1227719&r1=1227718&r2=1227719&view=diff
==============================================================================
--- commons/proper/validator/trunk/src/main/java/org/apache/commons/validator/routines/checkdigit/SedolCheckDigit.java
(original)
+++ commons/proper/validator/trunk/src/main/java/org/apache/commons/validator/routines/checkdigit/SedolCheckDigit.java
Thu Jan  5 17:45:51 2012
@@ -38,6 +38,8 @@ package org.apache.commons.validator.rou
  */
 public final class SedolCheckDigit extends ModulusCheckDigit {
 
+    private static final long serialVersionUID = -8976881621148878443L;
+
     /** Singleton SEDOL check digit instance */
     public static final CheckDigit SEDOL_CHECK_DIGIT = new SedolCheckDigit();
 
@@ -72,7 +74,7 @@ public final class SedolCheckDigit exten
      * code at a specified position.
      *
      * @param charValue The numeric value of the character.
-     * @param leftPos The position of the character in the code, counting from left to right

+     * @param leftPos The position of the character in the code, counting from left to right
      * @param rightPos The positionof the character in the code, counting from right to left
      * @return The weighted value of the character.
      */
@@ -84,7 +86,7 @@ public final class SedolCheckDigit exten
      * Convert a character at a specified position to an integer value.
      *
      * @param character The character to convert
-     * @param leftPos The position of the character in the code, counting from left to right

+     * @param leftPos The position of the character in the code, counting from left to right
      * @param rightPos The positionof the character in the code, counting from right to left
      * @return The integer value of the character
      * @throws CheckDigitException if character is not alphanumeric
@@ -93,7 +95,7 @@ public final class SedolCheckDigit exten
             throws CheckDigitException {
         int charValue = Character.getNumericValue(character);
         if (charValue < 0 || charValue > 35) {
-            throw new CheckDigitException("Invalid Character[" + 
+            throw new CheckDigitException("Invalid Character[" +
                     leftPos + "] = '" + charValue + "'");
         }
         return charValue;

Modified: commons/proper/validator/trunk/src/main/java/org/apache/commons/validator/routines/checkdigit/VerhoeffCheckDigit.java
URL: http://svn.apache.org/viewvc/commons/proper/validator/trunk/src/main/java/org/apache/commons/validator/routines/checkdigit/VerhoeffCheckDigit.java?rev=1227719&r1=1227718&r2=1227719&view=diff
==============================================================================
--- commons/proper/validator/trunk/src/main/java/org/apache/commons/validator/routines/checkdigit/VerhoeffCheckDigit.java
(original)
+++ commons/proper/validator/trunk/src/main/java/org/apache/commons/validator/routines/checkdigit/VerhoeffCheckDigit.java
Thu Jan  5 17:45:51 2012
@@ -27,18 +27,20 @@ import java.io.Serializable;
  * <p>
  * See <a href="http://en.wikipedia.org/wiki/Verhoeff_algorithm">Wikipedia
  *  - Verhoeff algorithm</a> for more details.
- *    
+ *
  * @version $Revision$ $Date$
  * @since Validator 1.4
  */
 public final class VerhoeffCheckDigit implements CheckDigit, Serializable {
 
+    private static final long serialVersionUID = 4138993995483695178L;
+
     /** Singleton Verhoeff Check Digit instance */
     public static final CheckDigit VERHOEFF_CHECK_DIGIT = new VerhoeffCheckDigit();
 
     /** D - multiplication table */
     private static final int[][] D_TABLE = new int[][] {
-        {0,  1,  2,  3,  4,  5,  6,  7,  8,  9}, 
+        {0,  1,  2,  3,  4,  5,  6,  7,  8,  9},
         {1,  2,  3,  4,  0,  6,  7,  8,  9,  5},
         {2,  3,  4,  0,  1,  7,  8,  9,  5,  6},
         {3,  4,  0,  1,  2,  8,  9,  5,  6,  7},
@@ -110,10 +112,10 @@ public final class VerhoeffCheckDigit im
     private int calculateChecksum(String code, boolean includesCheckDigit) throws CheckDigitException
{
         int checksum = 0;
         for (int i = 0; i < code.length(); i++) {
-            int idx = code.length() - (i + 1); 
+            int idx = code.length() - (i + 1);
             int num = Character.getNumericValue(code.charAt(idx));
             if (num < 0 || num > 9) {
-                throw new CheckDigitException("Invalid Character[" + 
+                throw new CheckDigitException("Invalid Character[" +
                         i + "] = '" + ((int)code.charAt(idx)) + "'");
             }
             int pos = includesCheckDigit ? i : i + 1;

Modified: commons/proper/validator/trunk/src/main/java/org/apache/commons/validator/util/Flags.java
URL: http://svn.apache.org/viewvc/commons/proper/validator/trunk/src/main/java/org/apache/commons/validator/util/Flags.java?rev=1227719&r1=1227718&r2=1227719&view=diff
==============================================================================
--- commons/proper/validator/trunk/src/main/java/org/apache/commons/validator/util/Flags.java
(original)
+++ commons/proper/validator/trunk/src/main/java/org/apache/commons/validator/util/Flags.java
Thu Jan  5 17:45:51 2012
@@ -19,7 +19,7 @@ package org.apache.commons.validator.uti
 import java.io.Serializable;
 
 /**
- * Represents a collection of 64 boolean (on/off) flags.  Individual flags 
+ * Represents a collection of 64 boolean (on/off) flags.  Individual flags
  * are represented by powers of 2.  For example,<br/>
  * Flag 1 = 1<br/>
  * Flag 2 = 2<br/>
@@ -30,9 +30,9 @@ import java.io.Serializable;
  * Flag 2 = 1 &lt;&lt; 1<br/>
  * Flag 3 = 1 &lt;&lt; 2<br/>
  * Flag 4 = 1 &lt;&lt; 3<br/>
- * 
+ *
  * <p>
- * There cannot be a flag with a value of 3 because that represents Flag 1 
+ * There cannot be a flag with a value of 3 because that represents Flag 1
  * and Flag 2 both being on/true.
  * </p>
  *
@@ -40,6 +40,8 @@ import java.io.Serializable;
  */
 public class Flags implements Serializable, Cloneable {
 
+    private static final long serialVersionUID = 8481587558770237995L;
+
     /**
      * Represents the current flag state.
      */
@@ -72,7 +74,7 @@ public class Flags implements Serializab
     }
 
     /**
-     * Tests whether the given flag is on.  If the flag is not a power of 2 
+     * Tests whether the given flag is on.  If the flag is not a power of 2
      * (ie. 3) this tests whether the combination of flags is on.
      *
      * @param flag Flag value to check.
@@ -84,7 +86,7 @@ public class Flags implements Serializab
     }
 
     /**
-     * Tests whether the given flag is off.  If the flag is not a power of 2 
+     * Tests whether the given flag is off.  If the flag is not a power of 2
      * (ie. 3) this tests whether the combination of flags is off.
      *
      * @param flag Flag value to check.
@@ -121,7 +123,7 @@ public class Flags implements Serializab
     public void turnOffAll() {
         this.flags = 0;
     }
-    
+
     /**
      * Turn off all flags.  This is a synonym for <code>turnOffAll()</code>.
      * @since Validator 1.1.1
@@ -183,8 +185,8 @@ public class Flags implements Serializab
     }
 
     /**
-     * Returns a 64 length String with the first flag on the right and the 
-     * 64th flag on the left.  A 1 indicates the flag is on, a 0 means it's 
+     * Returns a 64 length String with the first flag on the right and the
+     * 64th flag on the left.  A 1 indicates the flag is on, a 0 means it's
      * off.
      *
      * @return string representation of this object.



Mime
View raw message