You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by se...@apache.org on 2019/06/17 10:02:31 UTC

[commons-codec] branch master updated: Alphabetize for easier comparison with published algorithm

This is an automated email from the ASF dual-hosted git repository.

sebb pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-codec.git


The following commit(s) were added to refs/heads/master by this push:
     new 16a0eea  Alphabetize for easier comparison with published algorithm
16a0eea is described below

commit 16a0eeac59ab35bf49a7de70eb4dc70b0c61752d
Author: Sebb <se...@apache.org>
AuthorDate: Mon Jun 17 11:02:27 2019 +0100

    Alphabetize for easier comparison with published algorithm
---
 .../apache/commons/codec/language/ColognePhonetic.java   | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/src/main/java/org/apache/commons/codec/language/ColognePhonetic.java b/src/main/java/org/apache/commons/codec/language/ColognePhonetic.java
index 79fe335..2361a4c 100644
--- a/src/main/java/org/apache/commons/codec/language/ColognePhonetic.java
+++ b/src/main/java/org/apache/commons/codec/language/ColognePhonetic.java
@@ -183,14 +183,14 @@ public class ColognePhonetic implements StringEncoder {
 
     // Predefined char arrays for better performance and less GC load
     private static final char[] AEIJOUY = new char[] { 'A', 'E', 'I', 'J', 'O', 'U', 'Y' };
-    private static final char[] SCZ = new char[] { 'S', 'C', 'Z' };
-    private static final char[] WFPV = new char[] { 'W', 'F', 'P', 'V' };
+    private static final char[] CSZ = new char[] { 'C', 'S', 'Z' };
+    private static final char[] FPVW = new char[] { 'F', 'P', 'V', 'W' };
     private static final char[] GKQ = new char[] { 'G', 'K', 'Q' };
     private static final char[] CKQ = new char[] { 'C', 'K', 'Q' };
     private static final char[] AHKLOQRUX = new char[] { 'A', 'H', 'K', 'L', 'O', 'Q', 'R', 'U', 'X' };
     private static final char[] SZ = new char[] { 'S', 'Z' };
-    private static final char[] AHOUKQX = new char[] { 'A', 'H', 'O', 'U', 'K', 'Q', 'X' };
-    private static final char[] TDX = new char[] { 'T', 'D', 'X' };
+    private static final char[] AHKOQUX = new char[] { 'A', 'H', 'K', 'O', 'Q', 'U', 'X' };
+    private static final char[] DTX = new char[] { 'D', 'T', 'X' };
 
     /**
      * This class is not thread-safe; the field {@link #length} is mutable.
@@ -336,9 +336,9 @@ public class ColognePhonetic implements StringEncoder {
                 code = '0';
             } else if (chr == 'B' || (chr == 'P' && nextChar != 'H')) {
                 code = '1';
-            } else if ((chr == 'D' || chr == 'T') && !arrayContains(SCZ, nextChar)) {
+            } else if ((chr == 'D' || chr == 'T') && !arrayContains(CSZ, nextChar)) {
                 code = '2';
-            } else if (arrayContains(WFPV, chr)) {
+            } else if (arrayContains(FPVW, chr)) {
                 code = '3';
             } else if (arrayContains(GKQ, chr)) {
                 code = '4';
@@ -355,13 +355,13 @@ public class ColognePhonetic implements StringEncoder {
                         code = '8';
                     }
                 } else {
-                    if (arrayContains(SZ, lastChar) || !arrayContains(AHOUKQX, nextChar)) {
+                    if (arrayContains(SZ, lastChar) || !arrayContains(AHKOQUX, nextChar)) {
                         code = '8';
                     } else {
                         code = '4';
                     }
                 }
-            } else if (arrayContains(TDX, chr)) {
+            } else if (arrayContains(DTX, chr)) {
                 code = '8';
             } else if (chr == 'R') {
                 code = '7';