You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2012/08/28 18:13:13 UTC
svn commit: r1378201 - in
/commons/proper/codec/trunk/src/main/java/org/apache/commons/codec:
binary/Base32.java language/DoubleMetaphone.java
Author: ggregory
Date: Tue Aug 28 16:13:12 2012
New Revision: 1378201
URL: http://svn.apache.org/viewvc?rev=1378201&view=rev
Log:
Fix some Checkstyle issues.
Modified:
commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/binary/Base32.java
commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/language/DoubleMetaphone.java
Modified: commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/binary/Base32.java
URL: http://svn.apache.org/viewvc/commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/binary/Base32.java?rev=1378201&r1=1378200&r2=1378201&view=diff
==============================================================================
--- commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/binary/Base32.java (original)
+++ commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/binary/Base32.java Tue Aug 28 16:13:12 2012
@@ -60,10 +60,9 @@ public class Base32 extends BaseNCodec {
private static final byte[] CHUNK_SEPARATOR = {'\r', '\n'};
/**
- * This array is a lookup table that translates Unicode characters drawn from the "Base32 Alphabet" (as specified in
- * Table 3 of RFC 2045) into their 5-bit positive integer equivalents. Characters that are not in the Base32
+ * This array is a lookup table that translates Unicode characters drawn from the "Base32 Alphabet" (as specified
+ * in Table 3 of RFC 2045) into their 5-bit positive integer equivalents. Characters that are not in the Base32
* alphabet but fall within the bounds of the array are translated to -1.
- *
*/
private static final byte[] DECODE_TABLE = {
// 0 1 2 3 4 5 6 7 8 9 A B C D E F
@@ -86,10 +85,9 @@ public class Base32 extends BaseNCodec {
};
/**
- * This array is a lookup table that translates Unicode characters drawn from the "Base32 |Hex Alphabet" (as specified in
- * Table 3 of RFC 2045) into their 5-bit positive integer equivalents. Characters that are not in the Base32 Hex
- * alphabet but fall within the bounds of the array are translated to -1.
- *
+ * This array is a lookup table that translates Unicode characters drawn from the "Base32 |Hex Alphabet" (as
+ * specified in Table 3 of RFC 2045) into their 5-bit positive integer equivalents. Characters that are not in the
+ * Base32 Hex alphabet but fall within the bounds of the array are translated to -1.
*/
private static final byte[] HEX_DECODE_TABLE = {
// 0 1 2 3 4 5 6 7 8 9 A B C D E F
@@ -102,8 +100,8 @@ public class Base32 extends BaseNCodec {
};
/**
- * This array is a lookup table that translates 5-bit positive integer index values into their "Base32 Hex Alphabet"
- * equivalents as specified in Table 3 of RFC 2045.
+ * This array is a lookup table that translates 5-bit positive integer index values into their
+ * "Base32 Hex Alphabet" equivalents as specified in Table 3 of RFC 2045.
*/
private static final byte[] HEX_ENCODE_TABLE = {
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
@@ -122,6 +120,7 @@ public class Base32 extends BaseNCodec {
* Place holder for the bytes we're dealing with for our based logic.
* Bitwise operations store and extract the encoding or decoding from this variable.
*/
+
/**
* Convenience variable to help us determine when our buffer is going to run out of room and needs resizing.
* <code>decodeSize = {@link #BYTES_PER_ENCODED_BLOCK} - 1 + lineSeparator.length;</code>
@@ -178,8 +177,9 @@ public class Base32 extends BaseNCodec {
* </p>
*
* @param lineLength
- * Each line of encoded data will be at most of the given length (rounded down to nearest multiple of 8).
- * If lineLength <= 0, then the output will not be divided into lines (chunks). Ignored when decoding.
+ * Each line of encoded data will be at most of the given length (rounded down to nearest multiple of
+ * 8). If lineLength <= 0, then the output will not be divided into lines (chunks). Ignored when
+ * decoding.
*/
public Base32(int lineLength) {
this(lineLength, CHUNK_SEPARATOR);
@@ -195,8 +195,9 @@ public class Base32 extends BaseNCodec {
* </p>
*
* @param lineLength
- * Each line of encoded data will be at most of the given length (rounded down to nearest multiple of 8).
- * If lineLength <= 0, then the output will not be divided into lines (chunks). Ignored when decoding.
+ * Each line of encoded data will be at most of the given length (rounded down to nearest multiple of
+ * 8). If lineLength <= 0, then the output will not be divided into lines (chunks). Ignored when
+ * decoding.
* @param lineSeparator
* Each line of encoded data will end with this sequence of bytes.
* @throws IllegalArgumentException
@@ -216,14 +217,16 @@ public class Base32 extends BaseNCodec {
* </p>
*
* @param lineLength
- * Each line of encoded data will be at most of the given length (rounded down to nearest multiple of 8).
- * If lineLength <= 0, then the output will not be divided into lines (chunks). Ignored when decoding.
+ * Each line of encoded data will be at most of the given length (rounded down to nearest multiple of
+ * 8). If lineLength <= 0, then the output will not be divided into lines (chunks). Ignored when
+ * decoding.
* @param lineSeparator
* Each line of encoded data will end with this sequence of bytes.
- * @param useHex if {@code true}, then use Base32 Hex alphabet, otherwise use Base32 alphabet
+ * @param useHex
+ * if {@code true}, then use Base32 Hex alphabet, otherwise use Base32 alphabet
* @throws IllegalArgumentException
- * The provided lineSeparator included some Base32 characters. That's not going to work!
- * Or the lineLength > 0 and lineSeparator is null.
+ * The provided lineSeparator included some Base32 characters. That's not going to work! Or the
+ * lineLength > 0 and lineSeparator is null.
*/
public Base32(int lineLength, byte[] lineSeparator, boolean useHex) {
super(BYTES_PER_UNENCODED_BLOCK, BYTES_PER_ENCODED_BLOCK,
@@ -297,7 +300,8 @@ public class Base32 extends BaseNCodec {
int result = this.decodeTable[b];
if (result >= 0) {
context.modulus = (context.modulus+1) % BYTES_PER_ENCODED_BLOCK;
- context.lbitWorkArea = (context.lbitWorkArea << BITS_PER_ENCODED_BYTE) + result; // collect decoded bytes
+ // collect decoded bytes
+ context.lbitWorkArea = (context.lbitWorkArea << BITS_PER_ENCODED_BYTE) + result;
if (context.modulus == 0) { // we can output the 5 bytes
context.buffer[context.pos++] = (byte) ((context.lbitWorkArea >> 32) & MASK_8BITS);
context.buffer[context.pos++] = (byte) ((context.lbitWorkArea >> 24) & MASK_8BITS);
Modified: commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/language/DoubleMetaphone.java
URL: http://svn.apache.org/viewvc/commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/language/DoubleMetaphone.java?rev=1378201&r1=1378200&r2=1378201&view=diff
==============================================================================
--- commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/language/DoubleMetaphone.java (original)
+++ commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/language/DoubleMetaphone.java Tue Aug 28 16:13:12 2012
@@ -21,19 +21,17 @@ import org.apache.commons.codec.EncoderE
import org.apache.commons.codec.StringEncoder;
/**
- * Encodes a string into a double metaphone value.
- * This Implementation is based on the algorithm by <CITE>Lawrence Philips</CITE>.
+ * Encodes a string into a double metaphone value. This Implementation is based on the algorithm by <CITE>Lawrence
+ * Philips</CITE>.
+ * <p>
+ * This class is conditionally thread-safe. The instance field {@link #maxCodeLen} is mutable
+ * {@link #setMaxCodeLen(int)} but is not volatile, and accesses are not synchronized. If an instance of the class is
+ * shared between threads, the caller needs to ensure that suitable synchronization is used to ensure safe publication
+ * of the value between threads, and must not invoke {@link #setMaxCodeLen(int)} after initial setup.
*
* @see <a href="http://drdobbs.com/184401251?pgno=2">Original Article</a>
* @see <a href="http://en.wikipedia.org/wiki/Metaphone">http://en.wikipedia.org/wiki/Metaphone</a>
*
- * This class is conditionally thread-safe.
- * The instance field {@link #maxCodeLen} is mutable {@link #setMaxCodeLen(int)}
- * but is not volatile, and accesses are not synchronized.
- * If an instance of the class is shared between threads, the caller needs to ensure that suitable synchronization
- * is used to ensure safe publication of the value between threads, and must not invoke {@link #setMaxCodeLen(int)}
- * after initial setup.
- *
* @version $Id$
*/
public class DoubleMetaphone implements StringEncoder {