/* * Copyright (C) 2013-2017 NTT DATA Corporation * * Licensed 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. See the License for the specific language * governing permissions and limitations under the License. */ package org.terasoluna.gfw.functionaltest.app.string; import org.terasoluna.gfw.common.fullhalf.FullHalfConverter; import org.terasoluna.gfw.common.fullhalf.FullHalfPairsBuilder; public class CustomFullHalf { private static final int FULL_HALF_CODE_DIFF = 0xFEE0; public static final FullHalfConverter INSTANCE; static { FullHalfPairsBuilder builder = new FullHalfPairsBuilder(); builder.pair("ー", "-"); for (char c = '!'; c <= '~'; c++) { String fullwidth = String.valueOf((char) (c + FULL_HALF_CODE_DIFF)); builder.pair(fullwidth, String.valueOf(c)); } builder.pair("。", "。").pair("「", "「").pair("」", "」").pair("、", "、") .pair("・", "・").pair("ァ", "ァ").pair("ィ", "ィ").pair("ゥ", "ゥ") .pair("ェ", "ェ").pair("ォ", "ォ").pair("ャ", "ャ").pair("ュ", "ュ") .pair("ョ", "ョ").pair("ッ", "ッ").pair("ア", "ア").pair("イ", "イ") .pair("ウ", "ウ").pair("エ", "エ").pair("オ", "オ").pair("カ", "カ") .pair("キ", "キ").pair("ク", "ク").pair("ケ", "ケ").pair("コ", "コ") .pair("サ", "サ").pair("シ", "シ").pair("ス", "ス").pair("セ", "セ") .pair("ソ", "ソ").pair("タ", "タ").pair("チ", "チ").pair("ツ", "ツ") .pair("テ", "テ").pair("ト", "ト").pair("ナ", "ナ").pair("ニ", "ニ") .pair("ヌ", "ヌ").pair("ネ", "ネ").pair("ノ", "ノ").pair("ハ", "ハ") .pair("ヒ", "ヒ").pair("フ", "フ").pair("ヘ", "ヘ").pair("ホ", "ホ") .pair("マ", "マ").pair("ミ", "ミ").pair("ム", "ム").pair("メ", "メ") .pair("モ", "モ").pair("ヤ", "ヤ").pair("ユ", "ユ").pair("ヨ", "ヨ") .pair("ラ", "ラ").pair("リ", "リ").pair("ル", "ル").pair("レ", "レ") .pair("ロ", "ロ").pair("ワ", "ワ").pair("ヲ", "ヲ").pair("ン", "ン") .pair("ガ", "ガ").pair("ギ", "ギ").pair("グ", "グ") .pair("ゲ", "ゲ").pair("ゴ", "ゴ").pair("ザ", "ザ") .pair("ジ", "ジ").pair("ズ", "ズ").pair("ゼ", "ゼ") .pair("ゾ", "ゾ").pair("ダ", "ダ").pair("ヂ", "ヂ") .pair("ヅ", "ヅ").pair("デ", "デ").pair("ド", "ド") .pair("バ", "バ").pair("ビ", "ビ").pair("ブ", "ブ") .pair("べ", "ベ").pair("ボ", "ボ").pair("パ", "パ") .pair("ピ", "ピ").pair("プ", "プ").pair("ペ", "ペ") .pair("ポ", "ポ").pair("ヴ", "ヴ").pair("\u30f7", "ヷ").pair( "\u30fa", "ヺ").pair("゛", "゙").pair("゜", "゚").pair(" ", " "); INSTANCE = new FullHalfConverter(builder.build()); } }