com.crashlytics.tools.android_2.1.0

h, int index)
    throws DecoderException
  {
    int digit = Character.digit(ch, 16);
    if (digit == -1) {
      throw new DecoderException("Illegal hexadecimal character " + ch + " at index " + index);
    }
    return digit;
  }
  
  public Hex()
  {
    charsetName = "UTF-8";
  }
  
  public Hex(String csName)
  {
    charsetName = csName;
  }
  
  public byte[] decode(byte[] array)
    throws DecoderException
  {
    try
    {
      return decodeHex(new String(array, getCharsetName()).toCharArray());
    }
    catch (UnsupportedEncodingException e)
    {
      throw new DecoderException(e.getMessage(), e);
    }
  }
  
  public Object decode(Object object)
    throws DecoderException
  {
    try
    {
      char[] charArray = (object instanceof String) ? ((String)object).toCharArray() : (char[])object;
      return decodeHex(charArray);
    }
    catch (ClassCastException e)
    {
      throw new DecoderException(e.getMessage(), e);
    }
  }
  
  public byte[] encode(byte[] array)
  {
    return StringUtils.getBytesUnchecked(encodeHexString(array), getCharsetName());
  }
  
  public Object encode(Object object)
    throws EncoderException
  {
    try
    {
      byte[] byteArray = (object instanceof String) ? ((String)object).getBytes(getCharsetName()) : (byte[])object;
      return encodeHex(byteArray);
    }
    catch (ClassCastException e)
    {
      throw new EncoderException(e.getMessage(), e);
    }
    catch (UnsupportedEncodingException e)
    {
      throw new EncoderException(e.getMessage(), e);
    }
  }
  
  public String getCharsetName()
  {
    return charsetName;
  }
  
  public String toString()
  {
    return super.toString() + "[charsetName=" + charsetName + "]";
  }
}

/* Location:
 * Qualified Name:     org.apache.commons.codec.binary.Hex
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.apache.commons.codec.binary;

import java.io.UnsupportedEncodingException;

public class StringUtils
{
  public static byte[] getBytesIso8859_1(String string)
  {
    return getBytesUnchecked(string, "ISO-8859-1");
  }
  
  public static byte[] getBytesUsAscii(String string)
  {
    return getBytesUnchecked(string, "US-ASCII");
  }
  
  public static byte[] getBytesUtf16(String string)
  {
    return getBytesUnchecked(string, "UTF-16");
  }
  
  public static byte[] getBytesUtf16Be(String string)
  {
    return getBytesUnchecked(string, "UTF-16BE");
  }
  
  public static byte[] getBytesUtf16Le(String string)
  {
    return getBytesUnchecked(string, "UTF-16LE");
  }
  
  public static byte[] getBytesUtf8(String string)
  {
    return getBytesUnchecked(string, "UTF-8");
  }
  
  public static byte[] getBytesUnchecked(String string, String charsetName)
  {
    if (string == null) {
      return null;
    }
    try
    {
      return string.getBytes(charsetName);
    }
    catch (UnsupportedEncodingException e)
    {
      throw newIllegalStateException(charsetName, e);
    }
  }
  
  private static IllegalStateException newIllegalStateException(String charsetName, UnsupportedEncodingException e)
  {
    return new IllegalStateException(charsetName + ": " + e);
  }
  
  public static String newString(byte[] bytes, String charsetName)
  {
    if (bytes == null) {
      return null;
    }
    try
    {
      return new String(bytes, charsetName);
    }
    catch (UnsupportedEncodingException e)
    {
      throw newIllegalStateException(charsetName, e);
    }
  }
  
  public static String newStringIso8859_1(byte[] bytes)
  {
    return newString(bytes, "ISO-8859-1");
  }
  
  public static String newStringUsAscii(byte[] bytes)
  {
    return newString(bytes, "US-ASCII");
  }
  
  public static String newStringUtf16(byte[] bytes)
  {
    return newString(bytes, "UTF-16");
  }
  
  public static String newStringUtf16Be(byte[] bytes)
  {
    return newString(bytes, "UTF-16BE");
  }
  
  public static String newStringUtf16Le(byte[] bytes)
  {
    return newString(bytes, "UTF-16LE");
  }
  
  public static String newStringUtf8(byte[] bytes)
  {
    return newString(bytes, "UTF-8");
  }
}

/* Location:
 * Qualified Name:     org.apache.commons.codec.binary.StringUtils
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.apache.commons.codec.digest;

import java.io.IOException;
import java.io.InputStream;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import org.apache.commons.codec.binary.Hex;
import org.apache.commons.codec.binary.StringUtils;

public class DigestUtils
{
  private static final int STREAM_BUFFER_LENGTH = 1024;
  
  private static byte[] digest(MessageDigest digest, InputStream data)
    throws IOException
  {
    byte[] buffer = new byte['?'];
    int read = data.read(buffer, 0, 1024);
    while (read > -1)
    {
      digest.update(buffer, 0, read);
      read = data.read(buffer, 0, 1024);
    }
    return digest.digest();
  }
  
  private static byte[] getBytesUtf8(String data)
  {
    return StringUtils.getBytesUtf8(data);
  }
  
  static MessageDigest getDigest(String algorithm)
  {
    try
    {
      return MessageDigest.getInstance(algorithm);
    }
    catch (NoSuchAlgorithmException e)
    {
      throw new RuntimeException(e.getMessage());
    }
  }
  
  private static MessageDigest getMd5Digest()
  {
    return getDigest("MD5");
  }
  
  private static MessageDigest getSha256Digest()
  {
    return getDigest("SHA-256");
  }
  
  private static MessageDigest getSha384Digest()
  {
    return getDigest("SHA-384");
  }
  
  private static MessageDigest getSha512Digest()
  {
    return getDigest("SHA-512");
  }
  
  private static MessageDigest getShaDigest()
  {
    return getDigest("SHA");
  }
  
  public static byte[] md5(byte[] data)
  {
    return getMd5Digest().digest(data);
  }
  
  public static byte[] md5(InputStream data)
    throws IOException
  {
    return digest(getMd5Digest(), data);
  }
  
  public static byte[] md5(String data)
  {
    return md5(getBytesUtf8(data));
  }
  
  public static String md5Hex(byte[] data)
  {
    return Hex.encodeHexString(md5(data));
  }
  
  public static String md5Hex(InputStream data)
    throws IOException
  {
    return Hex.encodeHexString(md5(data));
  }
  
  public static String md5Hex(String data)
  {
    return Hex.encodeHexString(md5(data));
  }
  
  public static byte[] sha(byte[] data)
  {
    return getShaDigest().digest(data);
  }
  
  public static byte[] sha(InputStream data)
    throws IOException
  {
    return digest(getShaDigest(), data);
  }
  
  public static byte[] sha(String data)
  {
    return sha(getBytesUtf8(data));
  }
  
  public static byte[] sha256(byte[] data)
  {
    return getSha256Digest().digest(data);
  }
  
  public static byte[] sha256(InputStream data)
    throws IOException
  {
    return digest(getSha256Digest(), data);
  }
  
  public static byte[] sha256(String data)
  {
    return sha256(getBytesUtf8(data));
  }
  
  public static String sha256Hex(byte[] data)
  {
    return Hex.encodeHexString(sha256(data));
  }
  
  public static String sha256Hex(InputStream data)
    throws IOException
  {
    return Hex.encodeHexString(sha256(data));
  }
  
  public static String sha256Hex(String data)
  {
    return Hex.encodeHexString(sha256(data));
  }
  
  public static byte[] sha384(byte[] data)
  {
    return getSha384Digest().digest(data);
  }
  
  public static byte[] sha384(InputStream data)
    throws IOException
  {
    return digest(getSha384Digest(), data);
  }
  
  public static byte[] sha384(String data)
  {
    return sha384(getBytesUtf8(data));
  }
  
  public static String sha384Hex(byte[] data)
  {
    return Hex.encodeHexString(sha384(data));
  }
  
  public static String sha384Hex(InputStream data)
    throws IOException
  {
    return Hex.encodeHexString(sha384(data));
  }
  
  public static String sha384Hex(String data)
  {
    return Hex.encodeHexString(sha384(data));
  }
  
  public static byte[] sha512(byte[] data)
  {
    return getSha512Digest().digest(data);
  }
  
  public static byte[] sha512(InputStream data)
    throws IOException
  {
    return digest(getSha512Digest(), data);
  }
  
  public static byte[] sha512(String data)
  {
    return sha512(getBytesUtf8(data));
  }
  
  public static String sha512Hex(byte[] data)
  {
    return Hex.encodeHexString(sha512(data));
  }
  
  public static String sha512Hex(InputStream data)
    throws IOException
  {
    return Hex.encodeHexString(sha512(data));
  }
  
  public static String sha512Hex(String data)
  {
    return Hex.encodeHexString(sha512(data));
  }
  
  public static String shaHex(byte[] data)
  {
    return Hex.encodeHexString(sha(data));
  }
  
  public static String shaHex(InputStream data)
    throws IOException
  {
    return Hex.encodeHexString(sha(data));
  }
  
  public static String shaHex(String data)
  {
    return Hex.encodeHexString(sha(data));
  }
}

/* Location:
 * Qualified Name:     org.apache.commons.codec.digest.DigestUtils
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.apache.commons.codec.language;

import org.apache.commons.codec.EncoderException;
import org.apache.commons.codec.StringEncoder;

public abstract class AbstractCaverphone
  implements StringEncoder
{
  public Object encode(Object source)
    throws EncoderException
  {
    if (!(source instanceof String)) {
      throw new EncoderException("Parameter supplied to Caverphone encode is not of type java.lang.String");
    }
    return encode((String)source);
  }
  
  public boolean isEncodeEqual(String str1, String str2)
    throws EncoderException
  {
    return encode(str1).equals(encode(str2));
  }
}

/* Location:
 * Qualified Name:     org.apache.commons.codec.language.AbstractCaverphone
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.apache.commons.codec.language;

import org.apache.commons.codec.EncoderException;
import org.apache.commons.codec.StringEncoder;

/**
 * @deprecated
 */
public class Caverphone
  implements StringEncoder
{
  private final Caverphone2 encoder = new Caverphone2();
  
  public String caverphone(String source)
  {
    return encoder.encode(source);
  }
  
  public Object encode(Object pObject)
    throws EncoderException
  {
    if (!(pObject instanceof String)) {
      throw new EncoderException("Parameter supplied to Caverphone encode is not of type java.lang.String");
    }
    return caverphone((String)pObject);
  }
  
  public String encode(String pString)
  {
    return caverphone(pString);
  }
  
  public boolean isCaverphoneEqual(String str1, String str2)
  {
    return caverphone(str1).equals(caverphone(str2));
  }
}

/* Location:
 * Qualified Name:     org.apache.commons.codec.language.Caverphone
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.apache.commons.codec.language;

import java.util.Locale;

public class Caverphone1
  extends AbstractCaverphone
{
  private static final String SIX_1 = "111111";
  
  public String encode(String source)
  {
    String txt = source;
    if ((txt == null) || (txt.length() == 0)) {
      return "111111";
    }
    txt = txt.toLowerCase(Locale.ENGLISH);
    
    txt = txt.replaceAll("[^a-z]", "");
    
    txt = txt.replaceAll("^cough", "cou2f");
    txt = txt.replaceAll("^rough", "rou2f");
    txt = txt.replaceAll("^tough", "tou2f");
    txt = txt.replaceAll("^enough", "enou2f");
    txt = txt.replaceAll("^gn", "2n");
    
    txt = txt.replaceAll("mb$", "m2");
    
    txt = txt.replaceAll("cq", "2q");
    txt = txt.replaceAll("ci", "si");
    txt = txt.replaceAll("ce", "se");
    txt = txt.replaceAll("cy", "sy");
    txt = txt.replaceAll("tch", "2ch");
    txt = txt.replaceAll("c", "k");
    txt = txt.replaceAll("q", "k");
    txt = txt.replaceAll("x", "k");
    txt = txt.replaceAll("v", "f");
    txt = txt.replaceAll("dg", "2g");
    txt = txt.replaceAll("tio", "sio");
    txt = txt.replaceAll("tia", "sia");
    txt = txt.replaceAll("d", "t");
    txt = txt.replaceAll("ph", "fh");
    txt = txt.replaceAll("b", "p");
    txt = txt.replaceAll("sh", "s2");
    txt = txt.replaceAll("z", "s");
    txt = txt.replaceAll("^[aeiou]", "A");
    
    txt = txt.replaceAll("[aeiou]", "3");
    txt = txt.replaceAll("3gh3", "3kh3");
    txt = txt.replaceAll("gh", "22");
    txt = txt.replaceAll("g", "k");
    txt = txt.replaceAll("s+", "S");
    txt = txt.replaceAll("t+", "T");
    txt = txt.replaceAll("p+", "P");
    txt = txt.replaceAll("k+", "K");
    txt = txt.replaceAll("f+", "F");
    txt = txt.replaceAll("m+", "M");
    txt = txt.replaceAll("n+", "N");
    txt = txt.replaceAll("w3", "W3");
    txt = txt.replaceAll("wy", "Wy");
    txt = txt.replaceAll("wh3", "Wh3");
    txt = txt.replaceAll("why", "Why");
    txt = txt.replaceAll("w", "2");
    txt = txt.replaceAll("^h", "A");
    txt = txt.replaceAll("h", "2");
    txt = txt.replaceAll("r3", "R3");
    txt = txt.replaceAll("ry", "Ry");
    txt = txt.replaceAll("r", "2");
    txt = txt.replaceAll("l3", "L3");
    txt = txt.replaceAll("ly", "Ly");
    txt = txt.replaceAll("l", "2");
    txt = txt.replaceAll("j", "y");
    txt = txt.replaceAll("y3", "Y3");
    txt = txt.replaceAll("y", "2");
    
    txt = txt.replaceAll("2", "");
    txt = txt.replaceAll("3", "");
    
    txt = txt + "111111";
    
    return txt.substring(0, "111111".length());
  }
}

/* Location:
 * Qualified Name:     org.apache.commons.codec.language.Caverphone1
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.apache.commons.codec.language;

import java.util.Locale;

public class Caverphone2
  extends AbstractCaverphone
{
  private static final String TEN_1 = "1111111111";
  
  public String encode(String source)
  {
    String txt = source;
    if ((txt == null) || (txt.length() == 0)) {
      return "1111111111";
    }
    txt = txt.toLowerCase(Locale.ENGLISH);
    
    txt = txt.replaceAll("[^a-z]", "");
    
    txt = txt.replaceAll("e$", "");
    
    txt = txt.replaceAll("^cough", "cou2f");
    txt = txt.replaceAll("^rough", "rou2f");
    txt = txt.replaceAll("^tough", "tou2f");
    txt = txt.replaceAll("^enough", "enou2f");
    txt = txt.replaceAll("^trough", "trou2f");
    txt = txt.replaceAll("^gn", "2n");
    
    txt = txt.replaceAll("mb$", "m2");
    
    txt = txt.replaceAll("cq", "2q");
    txt = txt.replaceAll("ci", "si");
    txt = txt.replaceAll("ce", "se");
    txt = txt.replaceAll("cy", "sy");
    txt = txt.replaceAll("tch", "2ch");
    txt = txt.replaceAll("c", "k");
    txt = txt.replaceAll("q", "k");
    txt = txt.replaceAll("x", "k");
    txt = txt.replaceAll("v", "f");
    txt = txt.replaceAll("dg", "2g");
    txt = txt.replaceAll("tio", "sio");
    txt = txt.replaceAll("tia", "sia");
    txt = txt.replaceAll("d", "t");
    txt = txt.replaceAll("ph", "fh");
    txt = txt.replaceAll("b", "p");
    txt = txt.replaceAll("sh", "s2");
    txt = txt.replaceAll("z", "s");
    txt = txt.replaceAll("^[aeiou]", "A");
    txt = txt.replaceAll("[aeiou]", "3");
    txt = txt.replaceAll("j", "y");
    txt = txt.replaceAll("^y3", "Y3");
    txt = txt.replaceAll("^y", "A");
    txt = txt.replaceAll("y", "3");
    txt = txt.replaceAll("3gh3", "3kh3");
    txt = txt.replaceAll("gh", "22");
    txt = txt.replaceAll("g", "k");
    txt = txt.replaceAll("s+", "S");
    txt = txt.replaceAll("t+", "T");
    txt = txt.replaceAll("p+", "P");
    txt = txt.replaceAll("k+", "K");
    txt = txt.replaceAll("f+", "F");
    txt = txt.replaceAll("m+", "M");
    txt = txt.replaceAll("n+", "N");
    txt = txt.replaceAll("w3", "W3");
    txt = txt.replaceAll("wh3", "Wh3");
    txt = txt.replaceAll("w$", "3");
    txt = txt.replaceAll("w", "2");
    txt = txt.replaceAll("^h", "A");
    txt = txt.replaceAll("h", "2");
    txt = txt.replaceAll("r3", "R3");
    txt = txt.replaceAll("r$", "3");
    txt = txt.replaceAll("r", "2");
    txt = txt.replaceAll("l3", "L3");
    txt = txt.replaceAll("l$", "3");
    txt = txt.replaceAll("l", "2");
    
    txt = txt.replaceAll("2", "");
    txt = txt.replaceAll("3$", "A");
    txt = txt.replaceAll("3", "");
    
    txt = txt + "1111111111";
    
    return txt.substring(0, "1111111111".length());
  }
}

/* Location:
 * Qualified Name:     org.apache.commons.codec.language.Caverphone2
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.apache.commons.codec.language;

abstract class ColognePhonetic$CologneBuffer
{
  protected final char[] data;
  protected int length = 0;
  
  public ColognePhonetic$CologneBuffer(ColognePhonetic paramColognePhonetic, char[] data)
  {
    this.data = data;
    length = data.length;
  }
  
  public ColognePhonetic$CologneBuffer(ColognePhonetic paramColognePhonetic, int buffSize)
  {
    data = new char[buffSize];
    length = 0;
  }
  
  protected abstract char[] copyData(int paramInt1, int paramInt2);
  
  public int length()
  {
    return length;
  }
  
  public String toString()
  {
    return new String(copyData(0, length));
  }
}

/* Location:
 * Qualified Name:     org.apache.commons.codec.language.ColognePhonetic.CologneBuffer
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.apache.commons.codec.language;

class ColognePhonetic$CologneInputBuffer
  extends ColognePhonetic.CologneBuffer
{
  public ColognePhonetic$CologneInputBuffer(ColognePhonetic paramColognePhonetic, char[] data)
  {
    super(paramColognePhonetic, data);
  }
  
  public void addLeft(char ch)
  {
    length += 1;
    data[getNextPos()] = ch;
  }
  
  protected char[] copyData(int start, int length)
  {
    char[] newData = new char[length];
    System.arraycopy(data, data.length - this.length + start, newData, 0, length);
    return newData;
  }
  
  public char getNextChar()
  {
    return data[getNextPos()];
  }
  
  protected int getNextPos()
  {
    return data.length - length;
  }
  
  public char removeNext()
  {
    char ch = getNextChar();
    length -= 1;
    return ch;
  }
}

/* Location:
 * Qualified Name:     org.apache.commons.codec.language.ColognePhonetic.CologneInputBuffer
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.apache.commons.codec.language;

class ColognePhonetic$CologneOutputBuffer
  extends ColognePhonetic.CologneBuffer
{
  public ColognePhonetic$CologneOutputBuffer(ColognePhonetic paramColognePhonetic, int buffSize)
  {
    super(paramColognePhonetic, buffSize);
  }
  
  public void addRight(char chr)
  {
    data[length] = chr;
    length += 1;
  }
  
  protected char[] copyData(int start, int length)
  {
    char[] newData = new char[length];
    System.arraycopy(data, start, newData, 0, length);
    return newData;
  }
}

/* Location:
 * Qualified Name:     org.apache.commons.codec.language.ColognePhonetic.CologneOutputBuffer
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.apache.commons.codec.language;

import java.util.Locale;
import org.apache.commons.codec.EncoderException;
import org.apache.commons.codec.StringEncoder;

public class ColognePhonetic
  implements StringEncoder
{
  private abstract class CologneBuffer
  {
    protected final char[] data;
    protected int length = 0;
    
    public CologneBuffer(char[] data)
    {
      this.data = data;
      length = data.length;
    }
    
    public CologneBuffer(int buffSize)
    {
      data = new char[buffSize];
      length = 0;
    }
    
    protected abstract char[] copyData(int paramInt1, int paramInt2);
    
    public int length()
    {
      return length;
    }
    
    public String toString()
    {
      return new String(copyData(0, length));
    }
  }
  
  private class CologneOutputBuffer
    extends ColognePhonetic.CologneBuffer
  {
    public CologneOutputBuffer(int buffSize)
    {
      super(buffSize);
    }
    
    public void addRight(char chr)
    {
      data[length] = chr;
      length += 1;
    }
    
    protected char[] copyData(int start, int length)
    {
      char[] newData = new char[length];
      System.arraycopy(data, start, newData, 0, length);
      return newData;
    }
  }
  
  private class CologneInputBuffer
    extends ColognePhonetic.CologneBuffer
  {
    public CologneInputBuffer(char[] data)
    {
      super(data);
    }
    
    public void addLeft(char ch)
    {
      length += 1;
      data[getNextPos()] = ch;
    }
    
    protected char[] copyData(int start, int length)
    {
      char[] newData = new char[length];
      System.arraycopy(data, data.length - this.length + start, newData, 0, length);
      return newData;
    }
    
    public char getNextChar()
    {
      return data[getNextPos()];
    }
    
    protected int getNextPos()
    {
      return data.length - length;
    }
    
    public char removeNext()
    {
      char ch = getNextChar();
      length -= 1;
      return ch;
    }
  }
  
  private static final char[][] PREPROCESS_MAP = { { '�', 'A' }, { '�', 'U' }, { '�', 'O' }, { '�', 'S' } };
  
  private static boolean arrayContains(char[] arr, char key)
  {
    for (char element : arr) {
      if (element == key) {
        return true;
      }
    }
    return false;
  }
  
  public String colognePhonetic(String text)
  {
    if (text == null) {
      return null;
    }
    text = preprocess(text);
    
    CologneOutputBuffer output = new CologneOutputBuffer(text.length() * 2);
    CologneInputBuffer input = new CologneInputBuffer(text.toCharArray());
    
    char lastChar = '-';
    char lastCode = '/';
    
    int rightLength = input.length();
    while (rightLength > 0)
    {
      char chr = input.removeNext();
      char nextChar;
      char nextChar;
      if ((rightLength = input.length()) > 0) {
        nextChar = input.getNextChar();
      } else {
        nextChar = '-';
      }
      char code;
      char code;
      if (arrayContains(new char[] { 'A', 'E', 'I', 'J', 'O', 'U', 'Y' }, chr))
      {
        code = '0';
      }
      else if ((chr == 'H') || (chr < 'A') || (chr > 'Z'))
      {
        if (lastCode == '/') {
          continue;
        }
        char code = '-';
      }
      else
      {
        char code;
        if ((chr == 'B') || ((chr == 'P') && (nextChar != 'H')))
        {
          code = '1';
        }
        else
        {
          if ((chr == 'D') || (chr == 'T')) {
            if (!arrayContains(new char[] { 'S', 'C', 'Z' }, nextChar))
            {
              char code = '2';
              break label654;
            }
          }
          char code;
          if (arrayContains(new char[] { 'W', 'F', 'P', 'V' }, chr))
          {
            code = '3';
          }
          else
          {
            char code;
            if (arrayContains(new char[] { 'G', 'K', 'Q' }, chr))
            {
              code = '4';
            }
            else
            {
              if (chr == 'X') {
                if (!arrayContains(new char[] { 'C', 'K', 'Q' }, lastChar))
                {
                  char code = '4';
                  input.addLeft('S');
                  rightLength++;
                  break label654;
                }
              }
              char code;
              if ((chr == 'S') || (chr == 'Z'))
              {
                code = '8';
              }
              else
              {
                char code;
                if (chr == 'C')
                {
                  char code;
                  if (lastCode == '/')
                  {
                    char code;
                    if (arrayContains(new char[] { 'A', 'H', 'K', 'L', 'O', 'Q', 'R', 'U', 'X' }, nextChar)) {
                      code = '4';
                    } else {
                      code = '8';
                    }
                  }
                  else
                  {
                    if (!arrayContains(new char[] { 'S', 'Z' }, lastChar))
                    {
                      if (arrayContains(new char[] { 'A', 'H', 'O', 'U', 'K', 'Q', 'X' }, nextChar)) {}
                    }
                    else
                    {
                      char code = '8';
                      break label654;
                    }
                    code = '4';
                  }
                }
                else
                {
                  char code;
                  if (arrayContains(new char[] { 'T', 'D', 'X' }, chr))
                  {
                    code = '8';
                  }
                  else
                  {
                    char code;
                    if (chr == 'R')
                    {
                      code = '7';
                    }
                    else
                    {
                      char code;
                      if (chr == 'L')
                      {
                        code = '5';
                      }
                      else
                      {
                        char code;
                        if ((chr == 'M') || (chr == 'N')) {
                          code = '6';
                        } else {
                          code = chr;
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
      label654:
      if ((code != '-') && (((lastCode != code) && ((code != '0') || (lastCode == '/'))) || (code < '0') || (code > '8'))) {
        output.addRight(code);
      }
      lastChar = chr;
      lastCode = code;
    }
    return output.toString();
  }
  
  public Object encode(Object object)
    throws EncoderException
  {
    if (!(object instanceof String)) {
      throw new EncoderException("This method's parameter was expected to be of the type " + String.class.getName() + ". But actually it was of the type " + object.getClass().getName() + ".");
    }
    return encode((String)object);
  }
  
  public String encode(String text)
  {
    return colognePhonetic(text);
  }
  
  public boolean isEncodeEqual(String text1, String text2)
  {
    return colognePhonetic(text1).equals(colognePhonetic(text2));
  }
  
  private String preprocess(String text)
  {
    text = text.toUpperCase(Locale.GERMAN);
    
    char[] chrs = text.toCharArray();
    for (int index = 0; index < chrs.length; index++) {
      if (chrs[index] > 'Z') {
        for (char[] element : PREPROCESS_MAP) {
          if (chrs[index] == element[0])
          {
            chrs[index] = element[1];
            break;
          }
        }
      }
    }
    return new String(chrs);
  }
}

/* Location:
 * Qualified Name:     org.apache.commons.codec.language.ColognePhonetic
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.apache.commons.codec.language;

public class DoubleMetaphone$DoubleMetaphoneResult
{
  private final StringBuffer primary = new StringBuffer(this$0.getMaxCodeLen());
  private final StringBuffer alternate = new StringBuffer(this$0.getMaxCodeLen());
  private final int maxLength;
  
  public DoubleMetaphone$DoubleMetaphoneResult(DoubleMetaphone paramDoubleMetaphone, int maxLength)
  {
    this.maxLength = maxLength;
  }
  
  public void append(char value)
  {
    appendPrimary(value);
    appendAlternate(value);
  }
  
  public void append(char primary, char alternate)
  {
    appendPrimary(primary);
    appendAlternate(alternate);
  }
  
  public void appendPrimary(char value)
  {
    if (primary.length() < maxLength) {
      primary.append(value);
    }
  }
  
  public void appendAlternate(char value)
  {
    if (alternate.length() < maxLength) {
      alternate.append(value);
    }
  }
  
  public void append(String value)
  {
    appendPrimary(value);
    appendAlternate(value);
  }
  
  public void append(String primary, String alternate)
  {
    appendPrimary(primary);
    appendAlternate(alternate);
  }
  
  public void appendPrimary(String value)
  {
    int addChars = maxLength - primary.length();
    if (value.length() <= addChars) {
      primary.append(value);
    } else {
      primary.append(value.substring(0, addChars));
    }
  }
  
  public void appendAlternate(String value)
  {
    int addChars = maxLength - alternate.length();
    if (value.length() <= addChars) {
      alternate.append(value);
    } else {
      alternate.append(value.substring(0, addChars));
    }
  }
  
  public String getPrimary()
  {
    return primary.toString();
  }
  
  public String getAlternate()
  {
    return alternate.toString();
  }
  
  public boolean isComplete()
  {
    return (primary.length() >= maxLength) && (alternate.length() >= maxLength);
  }
}

/* Location:
 * Qualified Name:     org.apache.commons.codec.language.DoubleMetaphone.DoubleMetaphoneResult
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.apache.commons.codec.language;

import java.util.Locale;
import org.apache.commons.codec.EncoderException;
import org.apache.commons.codec.StringEncoder;

public class DoubleMetaphone
  implements StringEncoder
{
  private static final String VOWELS = "AEIOUY";
  private static final String[] SILENT_START = { "GN", "KN", "PN", "WR", "PS" };
  private static final String[] L_R_N_M_B_H_F_V_W_SPACE = { "L", "R", "N", "M", "B", "H", "F", "V", "W", " " };
  private static final String[] ES_EP_EB_EL_EY_IB_IL_IN_IE_EI_ER = { "ES", "EP", "EB", "EL", "EY", "IB", "IL", "IN", "IE", "EI", "ER" };
  private static final String[] L_T_K_S_N_M_B_Z = { "L", "T", "K", "S", "N", "M", "B", "Z" };
  private int maxCodeLen = 4;
  
  public String doubleMetaphone(String value)
  {
    return doubleMetaphone(value, false);
  }
  
  public String doubleMetaphone(String value, boolean alternate)
  {
    value = cleanInput(value);
    if (value == null) {
      return null;
    }
    boolean slavoGermanic = isSlavoGermanic(value);
    int index = isSilentStart(value) ? 1 : 0;
    
    DoubleMetaphoneResult result = new DoubleMetaphoneResult(getMaxCodeLen());
    while ((!result.isComplete()) && (index <= value.length() - 1)) {
      switch (value.charAt(index))
      {
      case 'A': 
      case 'E': 
      case 'I': 
      case 'O': 
      case 'U': 
      case 'Y': 
        index = handleAEIOUY(result, index);
        break;
      case 'B': 
        result.append('P');
        index = charAt(value, index + 1) == 'B' ? index + 2 : index + 1;
        break;
      case '�': 
        result.append('S');
        index++;
        break;
      case 'C': 
        index = handleC(value, result, index);
        break;
      case 'D': 
        index = handleD(value, result, index);
        break;
      case 'F': 
        result.append('F');
        index = charAt(value, index + 1) == 'F' ? index + 2 : index + 1;
        break;
      case 'G': 
        index = handleG(value, result, index, slavoGermanic);
        break;
      case 'H': 
        index = handleH(value, result, index);
        break;
      case 'J': 
        index = handleJ(value, result, index, slavoGermanic);
        break;
      case 'K': 
        result.append('K');
        index = charAt(value, index + 1) == 'K' ? index + 2 : index + 1;
        break;
      case 'L': 
        index = handleL(value, result, index);
        break;
      case 'M': 
        result.append('M');
        index = conditionM0(value, index) ? index + 2 : index + 1;
        break;
      case 'N': 
        result.append('N');
        index = charAt(value, index + 1) == 'N' ? index + 2 : index + 1;
        break;
      case '�': 
        result.append('N');
        index++;
        break;
      case 'P': 
        index = handleP(value, result, index);
        break;
      case 'Q': 
        result.append('K');
        index = charAt(value, index + 1) == 'Q' ? index + 2 : index + 1;
        break;
      case 'R': 
        index = handleR(value, result, index, slavoGermanic);
        break;
      case 'S': 
        index = handleS(value, result, index, slavoGermanic);
        break;
      case 'T': 
        index = handleT(value, result, index);
        break;
      case 'V': 
        result.append('F');
        index = charAt(value, index + 1) == 'V' ? index + 2 : index + 1;
        break;
      case 'W': 
        index = handleW(value, result, index);
        break;
      case 'X': 
        index = handleX(value, result, index);
        break;
      case 'Z': 
        index = handleZ(value, result, index, slavoGermanic);
        break;
      default: 
        index++;
      }
    }
    return alternate ? result.getAlternate() : result.getPrimary();
  }
  
  public Object encode(Object obj)
    throws EncoderException
  {
    if (!(obj instanceof String)) {
      throw new EncoderException("DoubleMetaphone encode parameter is not of type String");
    }
    return doubleMetaphone((String)obj);
  }
  
  public String encode(String value)
  {
    return doubleMetaphone(value);
  }
  
  public boolean isDoubleMetaphoneEqual(String value1, String value2)
  {
    return isDoubleMetaphoneEqual(value1, value2, false);
  }
  
  public boolean isDoubleMetaphoneEqual(String value1, String value2, boolean alternate)
  {
    return doubleMetaphone(value1, alternate).equals(doubleMetaphone(value2, alternate));
  }
  
  public int getMaxCodeLen()
  {
    return maxCodeLen;
  }
  
  public void setMaxCodeLen(int maxCodeLen)
  {
    this.maxCodeLen = maxCodeLen;
  }
  
  private int handleAEIOUY(DoubleMetaphoneResult result, int index)
  {
    if (index == 0) {
      result.append('A');
    }
    return index + 1;
  }
  
  private int handleC(String value, DoubleMetaphoneResult result, int index)
  {
    if (conditionC0(value, index))
    {
      result.append('K');
      index += 2;
    }
    else if ((index == 0) && (contains(value, index, 6, "CAESAR")))
    {
      result.append('S');
      index += 2;
    }
    else if (contains(value, index, 2, "CH"))
    {
      index = handleCH(value, result, index);
    }
    else if ((contains(value, index, 2, "CZ")) && (!contains(value, index - 2, 4, "WICZ")))
    {
      result.append('S', 'X');
      index += 2;
    }
    else if (contains(value, index + 1, 3, "CIA"))
    {
      result.append('X');
      index += 3;
    }
    else
    {
      if ((contains(value, index, 2, "CC")) && ((index != 1) || (charAt(value, 0) != 'M'))) {
        return handleCC(value, result, index);
      }
      if (contains(value, index, 2, "CK", "CG", "CQ"))
      {
        result.append('K');
        index += 2;
      }
      else if (contains(value, index, 2, "CI", "CE", "CY"))
      {
        if (contains(value, index, 3, "CIO", "CIE", "CIA")) {
          result.append('S', 'X');
        } else {
          result.append('S');
        }
        index += 2;
      }
      else
      {
        result.append('K');
        if (contains(value, index + 1, 2, " C", " Q", " G")) {
          index += 3;
        } else if ((contains(value, index + 1, 1, "C", "K", "Q")) && (!contains(value, index + 1, 2, "CE", "CI"))) {
          index += 2;
        } else {
          index++;
        }
      }
    }
    return index;
  }
  
  private int handleCC(String value, DoubleMetaphoneResult result, int index)
  {
    if ((contains(value, index + 2, 1, "I", "E", "H")) && (!contains(value, index + 2, 2, "HU")))
    {
      if (((index == 1) && (charAt(value, index - 1) == 'A')) || (contains(value, index - 1, 5, "UCCEE", "UCCES"))) {
        result.append("KS");
      } else {
        result.append('X');
      }
      index += 3;
    }
    else
    {
      result.append('K');
      index += 2;
    }
    return index;
  }
  
  private int handleCH(String value, DoubleMetaphoneResult result, int index)
  {
    if ((index > 0) && (contains(value, index, 4, "CHAE")))
    {
      result.append('K', 'X');
      return index + 2;
    }
    if (conditionCH0(value, index))
    {
      result.append('K');
      return index + 2;
    }
    if (conditionCH1(value, index))
    {
      result.append('K');
      return index + 2;
    }
    if (index > 0)
    {
      if (contains(value, 0, 2, "MC")) {
        result.append('K');
      } else {
        result.append('X', 'K');
      }
    }
    else {
      result.append('X');
    }
    return index + 2;
  }
  
  private int handleD(String value, DoubleMetaphoneResult result, int index)
  {
    if (contains(value, index, 2, "DG"))
    {
      if (contains(value, index + 2, 1, "I", "E", "Y"))
      {
        result.append('J');
        index += 3;
      }
      else
      {
        result.append("TK");
        index += 2;
      }
    }
    else if (contains(value, index, 2, "DT", "DD"))
    {
      result.append('T');
      index += 2;
    }
    else
    {
      result.append('T');
      index++;
    }
    return index;
  }
  
  private int handleG(String value, DoubleMetaphoneResult result, int index, boolean slavoGermanic)
  {
    if (charAt(value, index + 1) == 'H')
    {
      index = handleGH(value, result, index);
    }
    else if (charAt(value, index + 1) == 'N')
    {
      if ((index == 1) && (isVowel(charAt(value, 0))) && (!slavoGermanic)) {
        result.append("KN", "N");
      } else if ((!contains(value, index + 2, 2, "EY")) && (charAt(value, index + 1) != 'Y') && (!slavoGermanic)) {
        result.append("N", "KN");
      } else {
        result.append("KN");
      }
      index += 2;
    }
    else if ((contains(value, index + 1, 2, "LI")) && (!slavoGermanic))
    {
      result.append("KL", "L");
      index += 2;
    }
    else if ((index == 0) && ((charAt(value, index + 1) == 'Y') || (contains(value, index + 1, 2, ES_EP_EB_EL_EY_IB_IL_IN_IE_EI_ER))))
    {
      result.append('K', 'J');
      index += 2;
    }
    else if (((contains(value, index + 1, 2, "ER")) || (charAt(value, index + 1) == 'Y')) && (!contains(value, 0, 6, "DANGER", "RANGER", "MANGER")) && (!contains(value, index - 1, 1, "E", "I")) && (!contains(value, index - 1, 3, "RGY", "OGY")))
    {
      result.append('K', 'J');
      index += 2;
    }
    else if ((contains(value, index + 1, 1, "E", "I", "Y")) || (contains(value, index - 1, 4, "AGGI", "OGGI")))
    {
      if ((contains(value, 0, 4, "VAN ", "VON ")) || (contains(value, 0, 3, "SCH")) || (contains(value, index + 1, 2, "ET"))) {
        result.append('K');
      } else if (contains(value, index + 1, 3, "IER")) {
        result.append('J');
      } else {
        result.append('J', 'K');
      }
      index += 2;
    }
    else if (charAt(value, index + 1) == 'G')
    {
      index += 2;
      result.append('K');
    }
    else
    {
      index++;
      result.append('K');
    }
    return index;
  }
  
  private int handleGH(String value, DoubleMetaphoneResult result, int index)
  {
    if ((index > 0) && (!isVowel(charAt(value, index - 1))))
    {
      result.append('K');
      index += 2;
    }
    else if (index == 0)
    {
      if (charAt(value, index + 2) == 'I') {
        result.append('J');
      } else {
        result.append('K');
      }
      index += 2;
    }
    else if (((index > 1) && (contains(value, index - 2, 1, "B", "H", "D"))) || ((index > 2) && (contains(value, index - 3, 1, "B", "H", "D"))) || ((index > 3) && (contains(value, index - 4, 1, "B", "H"))))
    {
      index += 2;
    }
    else
    {
      if ((index > 2) && (charAt(value, index - 1) == 'U') && (contains(value, index - 3, 1, "C", "G", "L", "R", "T"))) {
        result.append('F');
      } else if ((index > 0) && (charAt(value, index - 1) != 'I')) {
        result.append('K');
      }
      index += 2;
    }
    return index;
  }
  
  private int handleH(String value, DoubleMetaphoneResult result, int index)
  {
    if (((index == 0) || (isVowel(charAt(value, index - 1)))) && (isVowel(charAt(value, index + 1))))
    {
      result.append('H');
      index += 2;
    }
    else
    {
      index++;
    }
    return index;
  }
  
  private int handleJ(String value, DoubleMetaphoneResult result, int index, boolean slavoGermanic)
  {
    if ((contains(value, index, 4, "JOSE")) || (contains(value, 0, 4, "SAN ")))
    {
      if (((index == 0) && (charAt(value, index + 4) 
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109

Further reading...

For more information on Java 1.5 Tiger, you may find Java 1.5 Tiger, A developer's Notebook by D. Flanagan and B. McLaughlin from O'Reilly of interest.

New!JAR listings


Copyright 2006-2019. Infinite Loop Ltd