commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chtom...@apache.org
Subject [2/9] [text] TEXT-65: 120 checkstyle errors now
Date Fri, 17 Feb 2017 13:46:33 GMT
TEXT-65: 120 checkstyle errors now


Project: http://git-wip-us.apache.org/repos/asf/commons-text/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-text/commit/df0658f0
Tree: http://git-wip-us.apache.org/repos/asf/commons-text/tree/df0658f0
Diff: http://git-wip-us.apache.org/repos/asf/commons-text/diff/df0658f0

Branch: refs/heads/master
Commit: df0658f05b3113675d28dbe967d3326682f95dfe
Parents: 1035cd6
Author: Rob Tompkins <chtompki@apache.org>
Authored: Mon Feb 13 07:53:54 2017 -0500
Committer: Rob Tompkins <chtompki@apache.org>
Committed: Mon Feb 13 07:53:54 2017 -0500

----------------------------------------------------------------------
 .../org/apache/commons/text/StrTokenizer.java   | 44 ++++++++++++--------
 .../text/translate/AggregateTranslator.java     | 17 ++++----
 .../text/translate/CharSequenceTranslator.java  | 32 ++++++++------
 3 files changed, 56 insertions(+), 37 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-text/blob/df0658f0/src/main/java/org/apache/commons/text/StrTokenizer.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/text/StrTokenizer.java b/src/main/java/org/apache/commons/text/StrTokenizer.java
index 8186f37..66126ec 100644
--- a/src/main/java/org/apache/commons/text/StrTokenizer.java
+++ b/src/main/java/org/apache/commons/text/StrTokenizer.java
@@ -83,7 +83,9 @@ import java.util.NoSuchElementException;
  */
 public class StrTokenizer implements ListIterator<String>, Cloneable {
 
+    /** Comma separated values tokenizer internal variable. */
     private static final StrTokenizer CSV_TOKENIZER_PROTOTYPE;
+    /** Tab separated values tokenizer internal variable. */
     private static final StrTokenizer TSV_TOKENIZER_PROTOTYPE;
     static {
         CSV_TOKENIZER_PROTOTYPE = new StrTokenizer();
@@ -104,24 +106,24 @@ public class StrTokenizer implements ListIterator<String>, Cloneable
{
     }
 
     /** The text to work on. */
-    private char chars[];
-    /** The parsed tokens */
-    private String tokens[];
-    /** The current iteration position */
+    private char[] chars;
+    /** The parsed tokens. */
+    private String[] tokens;
+    /** The current iteration position. */
     private int tokenPos;
 
-    /** The delimiter matcher */
+    /** The delimiter matcher. */
     private StrMatcher delimMatcher = StrMatcher.splitMatcher();
-    /** The quote matcher */
+    /** The quote matcher. */
     private StrMatcher quoteMatcher = StrMatcher.noneMatcher();
-    /** The ignored matcher */
+    /** The ignored matcher. */
     private StrMatcher ignoredMatcher = StrMatcher.noneMatcher();
-    /** The trimmer matcher */
+    /** The trimmer matcher. */
     private StrMatcher trimmerMatcher = StrMatcher.noneMatcher();
 
-    /** Whether to return empty tokens as null */
+    /** Whether to return empty tokens as null. */
     private boolean emptyAsNull = false;
-    /** Whether to ignore empty tokens */
+    /** Whether to ignore empty tokens. */
     private boolean ignoreEmptyTokens = true;
 
     //-----------------------------------------------------------------------
@@ -686,16 +688,20 @@ public class StrTokenizer implements ListIterator<String>, Cloneable
{
      * @return the starting position of the next field (the character
      *  immediately after the delimiter), or -1 if end of string found
      */
-    private int readNextToken(final char[] srcChars, int start, final int len, final StrBuilder
workArea, final List<String> tokenList) {
+    private int readNextToken(final char[] srcChars,
+                              int start,
+                              final int len,
+                              final StrBuilder workArea,
+                              final List<String> tokenList) {
         // skip all leading whitespace, unless it is the
         // field delimiter or the quote character
         while (start < len) {
             final int removeLen = Math.max(
                     getIgnoredMatcher().isMatch(srcChars, start, start, len),
                     getTrimmerMatcher().isMatch(srcChars, start, start, len));
-            if (removeLen == 0 ||
-                getDelimiterMatcher().isMatch(srcChars, start, start, len) > 0 ||
-                getQuoteMatcher().isMatch(srcChars, start, start, len) > 0) {
+            if (removeLen == 0
+                    || getDelimiterMatcher().isMatch(srcChars, start, start, len) > 0
+                    || getQuoteMatcher().isMatch(srcChars, start, start, len) > 0) {
                 break;
             }
             start += removeLen;
@@ -832,7 +838,11 @@ public class StrTokenizer implements ListIterator<String>, Cloneable
{
      * @param quoteLen  the length of the matched quote, 0 if no quoting
      * @return true if a quote is matched
      */
-    private boolean isQuote(final char[] srcChars, final int pos, final int len, final int
quoteStart, final int quoteLen) {
+    private boolean isQuote(final char[] srcChars,
+                            final int pos,
+                            final int len,
+                            final int quoteStart,
+                            final int quoteLen) {
         for (int i = 0; i < quoteLen; i++) {
             if (pos + i >= len || srcChars[pos + i] != srcChars[quoteStart + i]) {
                 return false;
@@ -1072,7 +1082,7 @@ public class StrTokenizer implements ListIterator<String>, Cloneable
{
      * Creates a new instance of this Tokenizer. The new instance is reset so
      * that it will be at the start of the token list.
      * If a {@link CloneNotSupportedException} is caught, return <code>null</code>.
-     * 
+     *
      * @return a new instance of this Tokenizer which has been reset.
      */
     @Override
@@ -1087,7 +1097,7 @@ public class StrTokenizer implements ListIterator<String>, Cloneable
{
     /**
      * Creates a new instance of this Tokenizer. The new instance is reset so that
      * it will be at the start of the token list.
-     * 
+     *
      * @return a new instance of this Tokenizer which has been reset.
      * @throws CloneNotSupportedException if there is a problem cloning
      */

http://git-wip-us.apache.org/repos/asf/commons-text/blob/df0658f0/src/main/java/org/apache/commons/text/translate/AggregateTranslator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/text/translate/AggregateTranslator.java b/src/main/java/org/apache/commons/text/translate/AggregateTranslator.java
index 010ab2a..788f8c5 100644
--- a/src/main/java/org/apache/commons/text/translate/AggregateTranslator.java
+++ b/src/main/java/org/apache/commons/text/translate/AggregateTranslator.java
@@ -5,9 +5,9 @@
  * The ASF licenses this file to You under the Apache License, Version 2.0
  * (the "License"); you may not use this file except in compliance with
  * the License.  You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -22,17 +22,20 @@ import java.util.ArrayList;
 import java.util.List;
 
 /**
- * Executes a sequence of translators one after the other. Execution ends whenever 
+ * Executes a sequence of translators one after the other. Execution ends whenever
  * the first translator consumes codepoints from the input.
  *
  * @since 1.0
  */
 public class AggregateTranslator extends CharSequenceTranslator {
 
+    /**
+     * Translator list.
+     */
     private final List<CharSequenceTranslator> translators = new ArrayList<>();
 
     /**
-     * Specify the translators to be used at creation time. 
+     * Specify the translators to be used at creation time.
      *
      * @param translators CharSequenceTranslator array to aggregate
      */
@@ -47,15 +50,15 @@ public class AggregateTranslator extends CharSequenceTranslator {
     }
 
     /**
-     * The first translator to consume codepoints from the input is the 'winner'. 
-     * Execution stops with the number of consumed codepoints being returned. 
+     * The first translator to consume codepoints from the input is the 'winner'.
+     * Execution stops with the number of consumed codepoints being returned.
      * {@inheritDoc}
      */
     @Override
     public int translate(final CharSequence input, final int index, final Writer out) throws
IOException {
         for (final CharSequenceTranslator translator : translators) {
             final int consumed = translator.translate(input, index, out);
-            if(consumed != 0) {
+            if (consumed != 0) {
                 return consumed;
             }
         }

http://git-wip-us.apache.org/repos/asf/commons-text/blob/df0658f0/src/main/java/org/apache/commons/text/translate/CharSequenceTranslator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/text/translate/CharSequenceTranslator.java b/src/main/java/org/apache/commons/text/translate/CharSequenceTranslator.java
index baec844..4a27472 100644
--- a/src/main/java/org/apache/commons/text/translate/CharSequenceTranslator.java
+++ b/src/main/java/org/apache/commons/text/translate/CharSequenceTranslator.java
@@ -5,9 +5,9 @@
  * The ASF licenses this file to You under the Apache License, Version 2.0
  * (the "License"); you may not use this file except in compliance with
  * the License.  You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -22,21 +22,27 @@ import java.io.Writer;
 import java.util.Locale;
 
 /**
- * An API for translating text. 
- * Its core use is to escape and unescape text. Because escaping and unescaping 
+ * An API for translating text.
+ * Its core use is to escape and unescape text. Because escaping and unescaping
  * is completely contextual, the API does not present two separate signatures.
  *
  * @since 1.0
  */
 public abstract class CharSequenceTranslator {
 
-    static final char[] HEX_DIGITS = new char[] {'0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'};
+    /**
+     * Array containing the hexadecimal alphabet.
+     */
+    static final char[] HEX_DIGITS = new char[] {'0', '1', '2', '3',
+                                                 '4', '5', '6', '7',
+                                                 '8', '9', 'A', 'B',
+                                                 'C', 'D', 'E', 'F'};
 
     /**
-     * Translate a set of codepoints, represented by an int index into a CharSequence, 
-     * into another set of codepoints. The number of codepoints consumed must be returned,

-     * and the only IOExceptions thrown must be from interacting with the Writer so that

-     * the top level API may reliably ignore StringWriter IOExceptions. 
+     * Translate a set of codepoints, represented by an int index into a CharSequence,
+     * into another set of codepoints. The number of codepoints consumed must be returned,
+     * and the only IOExceptions thrown must be from interacting with the Writer so that
+     * the top level API may reliably ignore StringWriter IOExceptions.
      *
      * @param input CharSequence that is being translated
      * @param index int representing the current point of translation
@@ -47,7 +53,7 @@ public abstract class CharSequenceTranslator {
     public abstract int translate(CharSequence input, int index, Writer out) throws IOException;
 
     /**
-     * Helper for non-Writer usage. 
+     * Helper for non-Writer usage.
      * @param input CharSequence to be translated
      * @return String output of translation
      */
@@ -66,8 +72,8 @@ public abstract class CharSequenceTranslator {
     }
 
     /**
-     * Translate an input onto a Writer. This is intentionally final as its algorithm is

-     * tightly coupled with the abstract method of this class. 
+     * Translate an input onto a Writer. This is intentionally final as its algorithm is
+     * tightly coupled with the abstract method of this class.
      *
      * @param input CharSequence that is being translated
      * @param out Writer to translate the text to
@@ -108,7 +114,7 @@ public abstract class CharSequenceTranslator {
     }
 
     /**
-     * Helper method to create a merger of this translator with another set of 
+     * Helper method to create a merger of this translator with another set of
      * translators. Useful in customizing the standard functionality.
      *
      * @param translators CharSequenceTranslator array of translators to merge with this
one


Mime
View raw message