/*
 * このソースコードは blanco Frameworkにより自動生成されました。
 */
package blanco.sample.stringconverter;

/**
 * 全角ひらがな→全角カタカナの文字列変換のサンプル。blancoStringConverterの実装には影響しません。
 */
public class SampleZenHiragana2KatakanaStringConverter {
    /**
     * 文字列置換定義。
     */
    public static final String[][] STRING_CONVERT_DEF = new String[][] {new String[] { "う゛", "ヴ" }/* No.1 説明:濁音を先に定義します。 */, new String[] { "ぁ", "ァ" }/* No.2 */, new String[] { "あ", "ア" }/* No.3 */, new String[] { "ぃ", "ィ" }/* No.4 */, new String[] { "い", "イ" }/* No.5 */, new String[] { "ぅ", "ゥ" }/* No.6 */, new String[] { "う", "ウ" }/* No.7 */, new String[] { "ぇ", "ェ" }/* No.8 */, new String[] { "え", "エ" }/* No.9 */, new String[] { "ぉ", "ォ" }/* No.10 */, new String[] { "お", "オ" }/* No.11 */, new String[] { "か", "カ" }/* No.12 */, new String[] { "が", "ガ" }/* No.13 */, new String[] { "き", "キ" }/* No.14 */, new String[] { "ぎ", "ギ" }/* No.15 */, new String[] { "く", "ク" }/* No.16 */, new String[] { "ぐ", "グ" }/* No.17 */, new String[] { "け", "ケ" }/* No.18 */, new String[] { "げ", "ゲ" }/* No.19 */, new String[] { "こ", "コ" }/* No.20 */, new String[] { "ご", "ゴ" }/* No.21 */, new String[] { "さ", "サ" }/* No.22 */, new String[] { "ざ", "ザ" }/* No.23 */, new String[] { "し", "シ" }/* No.24 */, new String[] { "じ", "ジ" }/* No.25 */, new String[] { "す", "ス" }/* No.26 */, new String[] { "ず", "ズ" }/* No.27 */, new String[] { "せ", "セ" }/* No.28 */, new String[] { "ぜ", "ゼ" }/* No.29 */, new String[] { "そ", "ソ" }/* No.30 */, new String[] { "ぞ", "ゾ" }/* No.31 */, new String[] { "た", "タ" }/* No.32 */, new String[] { "だ", "ダ" }/* No.33 */, new String[] { "ち", "チ" }/* No.34 */, new String[] { "ぢ", "ヂ" }/* No.35 */, new String[] { "っ", "ッ" }/* No.36 */, new String[] { "つ", "ツ" }/* No.37 */, new String[] { "づ", "ヅ" }/* No.38 */, new String[] { "て", "テ" }/* No.39 */, new String[] { "で", "デ" }/* No.40 */, new String[] { "と", "ト" }/* No.41 */, new String[] { "ど", "ド" }/* No.42 */, new String[] { "な", "ナ" }/* No.43 */, new String[] { "に", "ニ" }/* No.44 */, new String[] { "ぬ", "ヌ" }/* No.45 */, new String[] { "ね", "ネ" }/* No.46 */, new String[] { "の", "ノ" }/* No.47 */, new String[] { "は", "ハ" }/* No.48 */, new String[] { "ば", "バ" }/* No.49 */, new String[] { "ぱ", "パ" }/* No.50 */, new String[] { "ひ", "ヒ" }/* No.51 */, new String[] { "び", "ビ" }/* No.52 */, new String[] { "ぴ", "ピ" }/* No.53 */, new String[] { "ふ", "フ" }/* No.54 */, new String[] { "ぶ", "ブ" }/* No.55 */, new String[] { "ぷ", "プ" }/* No.56 */, new String[] { "へ", "ヘ" }/* No.57 */, new String[] { "べ", "ベ" }/* No.58 */, new String[] { "ぺ", "ペ" }/* No.59 */, new String[] { "ほ", "ホ" }/* No.60 */, new String[] { "ぼ", "ボ" }/* No.61 */, new String[] { "ぽ", "ポ" }/* No.62 */, new String[] { "ま", "マ" }/* No.63 */, new String[] { "み", "ミ" }/* No.64 */, new String[] { "む", "ム" }/* No.65 */, new String[] { "め", "メ" }/* No.66 */, new String[] { "も", "モ" }/* No.67 */, new String[] { "ゃ", "ャ" }/* No.68 */, new String[] { "や", "ヤ" }/* No.69 */, new String[] { "ゅ", "ュ" }/* No.70 */, new String[] { "ゆ", "ユ" }/* No.71 */, new String[] { "ょ", "ョ" }/* No.72 */, new String[] { "よ", "ヨ" }/* No.73 */, new String[] { "ら", "ラ" }/* No.74 */, new String[] { "り", "リ" }/* No.75 */, new String[] { "る", "ル" }/* No.76 */, new String[] { "れ", "レ" }/* No.77 */, new String[] { "ろ", "ロ" }/* No.78 */, new String[] { "ゎ", "ヮ" }/* No.79 */, new String[] { "わ", "ワ" }/* No.80 */, new String[] { "ゐ", "ヰ" }/* No.81 */, new String[] { "ゑ", "ヱ" }/* No.82 */, new String[] { "を", "ヲ" }/* No.83 */, new String[] { "ん", "ン" }/* No.84 */ };

    /**
     * 文字列変換定義に従い、文字列を変換します。
     *
     * @param argCheck 変換対象の文字列。
     * @return 文字列変換定義にしたがって変換された文字列。変換定義にひとつも合致しない場合には元の文字列が戻ります。
     */
    public String convert(final String argCheck) {
        if (argCheck == null) {
            throw new IllegalArgumentException("メソッド[convert]のパラメータ[argCheck]にnullが与えられました。しかし、このパラメータにnullを与えることはできません。");
        }

        String wrkString = "";
        for (int index = 0; index < argCheck.length(); ) {
            final String look = argCheck.substring(index);
            boolean isFound = false;
            for (int indexDef = 0; indexDef < STRING_CONVERT_DEF.length; indexDef++) {
                if (look.startsWith(STRING_CONVERT_DEF[indexDef][0])) {
                    wrkString += STRING_CONVERT_DEF[indexDef][1];
                    index += STRING_CONVERT_DEF[indexDef][0].length();
                    isFound = true;
                    break;
                }
            }
            if (!isFound) {
                wrkString += argCheck.charAt(index);
                index = index + 1;
            }
        }

        return wrkString;
    }
}
