/*
 * このソースコードは blanco Frameworkによって自動生成されています。
 */

/**
 * デフォルトコンストラクタ
 * @fileoverview このソースコードは blanco Frameworkによって自動生成されています。
 * @class 全角カタカナ→全角ひらがなの文字列変換のサンプル。blancoStringConverterの実装には影響しません。
 * @constructor
 */
function SampleZenKatakana2HiraganaStringConverter() {
    /* パラメータの数、型チェックを行います。 */
    if (arguments.length !== 0) {
        throw new Error("[ArgumentException]: SampleZenKatakana2HiraganaStringConverter.SampleZenKatakana2HiraganaStringConverter のパラメータは[0]個である必要があります。しかし実際には[" + arguments.length +  "]個のパラメータを伴って呼び出されました。");
    }

}

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

/**
 * 文字列変換定義に従い、文字列を変換します。
 * @addon
 * @param {string} argCheck 変換対象の文字列。
 * @return 文字列変換定義にしたがって変換された文字列。変換定義にひとつも合致しない場合には元の文字列が戻ります。
 * @type string
 */
SampleZenKatakana2HiraganaStringConverter.prototype.convert = function(/* string */ argCheck) {
    /* パラメータの数、型チェックを行います。 */
    if (arguments.length !== 1) {
        throw new Error("[ArgumentException]: SampleZenKatakana2HiraganaStringConverter.convert のパラメータは[1]個である必要があります。しかし実際には[" + arguments.length +  "]個のパラメータを伴って呼び出されました。");
    }
    if (typeof(argCheck) != "string") {
        throw new Error("[ArgumentException]: SampleZenKatakana2HiraganaStringConverter.convert の1番目のパラメータは[string]型でなくてはなりません。しかし実際には[" + typeof(argCheck) + "]型が与えられました。");
    }

    var wrkString = "";
    for (var index = 0; index < argCheck.length; ) {
        var look = argCheck.substring(index);
        var isFound = false;
        for (var indexDef = 0; indexDef < SampleZenKatakana2HiraganaStringConverter.STRING_CONVERT_DEF.length; indexDef++) {
            var wrkStrComp = look;
            if (look.length > SampleZenKatakana2HiraganaStringConverter.STRING_CONVERT_DEF[indexDef][0].length) {
                wrkStrComp = wrkStrComp.substring(0, SampleZenKatakana2HiraganaStringConverter.STRING_CONVERT_DEF[indexDef][0].length);
            }
            if (wrkStrComp === SampleZenKatakana2HiraganaStringConverter.STRING_CONVERT_DEF[indexDef][0]) {
                wrkString += SampleZenKatakana2HiraganaStringConverter.STRING_CONVERT_DEF[indexDef][1];
                index += SampleZenKatakana2HiraganaStringConverter.STRING_CONVERT_DEF[indexDef][0].length;
                isFound = true;
                break;
            }
        }
        if (!isFound) {
            wrkString += argCheck.charAt(index);
            index = index + 1;
        }
    }

    return wrkString;
};
/* クラス[SampleZenKatakana2HiraganaStringConverter]宣言の終了。 */
