亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? refinedsoundex.java

?? 一個很實用的東東
?? JAVA
字號:
/*
 * Copyright 2001-2004 The Apache Software Foundation.
 * 
 * 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.apache.commons.codec.language;

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

/**
 * Encodes a string into a Refined Soundex value. A refined soundex code is
 * optimized for spell checking words. Soundex method originally developed by
 * <CITE>Margaret Odell</CITE> and <CITE>Robert Russell</CITE>.
 * 
 * @author Apache Software Foundation
 * @version $Id: RefinedSoundex.java,v 1.21 2004/06/05 18:32:04 ggregory Exp $
 */
public class RefinedSoundex implements StringEncoder {

    /**
	 * This static variable contains an instance of the RefinedSoundex using
	 * the US_ENGLISH mapping.
	 */
    public static final RefinedSoundex US_ENGLISH = new RefinedSoundex();

    /**
	 * RefinedSoundex is *refined* for a number of reasons one being that the
	 * mappings have been altered. This implementation contains default
	 * mappings for US English.
	 */
    public static final char[] US_ENGLISH_MAPPING = "01360240043788015936020505".toCharArray();

    /**
	 * Every letter of the alphabet is "mapped" to a numerical value. This char
	 * array holds the values to which each letter is mapped. This
	 * implementation contains a default map for US_ENGLISH
	 */
    private char[] soundexMapping;

    /**
	 * Creates an instance of the RefinedSoundex object using the default US
	 * English mapping.
	 */
    public RefinedSoundex() {
        this(US_ENGLISH_MAPPING);
    }

    /**
	 * Creates a refined soundex instance using a custom mapping. This
	 * constructor can be used to customize the mapping, and/or possibly
	 * provide an internationalized mapping for a non-Western character set.
	 * 
	 * @param mapping
	 *                  Mapping array to use when finding the corresponding code for
	 *                  a given character
	 */
    public RefinedSoundex(char[] mapping) {
        this.soundexMapping = mapping;
    }

    /**
	 * Returns the number of characters in the two encoded Strings that are the
	 * same. This return value ranges from 0 to the length of the shortest
	 * encoded String: 0 indicates little or no similarity, and 4 out of 4 (for
	 * example) indicates strong similarity or identical values. For refined
	 * Soundex, the return value can be greater than 4.
	 * 
	 * @param s1
	 *                  A String that will be encoded and compared.
	 * @param s2
	 *                  A String that will be encoded and compared.
	 * @return The number of characters in the two encoded Strings that are the
	 *             same from 0 to to the length of the shortest encoded String.
	 * 
	 * @see SoundexUtils#difference(StringEncoder,String,String)
	 * @see <a href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/tsqlref/ts_de-dz_8co5.asp">
	 *          MS T-SQL DIFFERENCE</a>
	 * 
	 * @throws EncoderException
	 *                  if an error occurs encoding one of the strings
     * @since 1.3
	 */
    public int difference(String s1, String s2) throws EncoderException {
        return SoundexUtils.difference(this, s1, s2);
    }

    /**
	 * Encodes an Object using the refined soundex algorithm. This method is
	 * provided in order to satisfy the requirements of the Encoder interface,
	 * and will throw an EncoderException if the supplied object is not of type
	 * java.lang.String.
	 * 
	 * @param pObject
	 *                  Object to encode
	 * @return An object (or type java.lang.String) containing the refined
	 *             soundex code which corresponds to the String supplied.
	 * @throws EncoderException
	 *                  if the parameter supplied is not of type java.lang.String
	 */
    public Object encode(Object pObject) throws EncoderException {
        if (!(pObject instanceof java.lang.String)) {
            throw new EncoderException("Parameter supplied to RefinedSoundex encode is not of type java.lang.String");
        }
        return soundex((String) pObject);
    }

    /**
	 * Encodes a String using the refined soundex algorithm.
	 * 
	 * @param pString
	 *                  A String object to encode
	 * @return A Soundex code corresponding to the String supplied
	 */
    public String encode(String pString) {
        return soundex(pString);
    }

    /**
	 * Returns the mapping code for a given character. The mapping codes are
	 * maintained in an internal char array named soundexMapping, and the
	 * default values of these mappings are US English.
	 * 
	 * @param c
	 *                  char to get mapping for
	 * @return A character (really a numeral) to return for the given char
	 */
    char getMappingCode(char c) {
        if (!Character.isLetter(c)) {
            return 0;
        }
        return this.soundexMapping[Character.toUpperCase(c) - 'A'];
    }

    /**
	 * Retreives the Refined Soundex code for a given String object.
	 * 
	 * @param str
	 *                  String to encode using the Refined Soundex algorithm
	 * @return A soundex code for the String supplied
	 */
    public String soundex(String str) {
        if (str == null) {
            return null;
        }
        str = SoundexUtils.clean(str);
        if (str.length() == 0) {
            return str;
        }

        StringBuffer sBuf = new StringBuffer();
        sBuf.append(str.charAt(0));

        char last, current;
        last = '*';

        for (int i = 0; i < str.length(); i++) {

            current = getMappingCode(str.charAt(i));
            if (current == last) {
                continue;
            } else if (current != 0) {
                sBuf.append(current);
            }

            last = current;

        }

        return sBuf.toString();
    }
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
久久久综合九色合综国产精品| 国产精品一区免费在线观看| www.欧美.com| 亚洲女爱视频在线| 色综合久久久久综合99| 亚洲综合偷拍欧美一区色| 91在线云播放| 亚洲已满18点击进入久久| 欧洲一区在线电影| 日韩av电影天堂| 久久久久久久久久久99999| 国产成人综合精品三级| 亚洲人成小说网站色在线| 欧美少妇一区二区| 麻豆国产欧美日韩综合精品二区 | 免费久久精品视频| 欧美国产一区视频在线观看| 成人国产精品免费网站| 亚洲国产精品麻豆| 久久免费午夜影院| 欧美日韩电影在线播放| 国产成人在线视频网址| 亚洲成年人网站在线观看| 国产亚洲欧美日韩俺去了| 在线不卡欧美精品一区二区三区| 国内外成人在线视频| 日韩国产欧美一区二区三区| 六月婷婷色综合| 亚洲曰韩产成在线| 国产精品成人一区二区三区夜夜夜| 欧美日韩国产影片| 色吊一区二区三区| 一本大道综合伊人精品热热| 狠狠色伊人亚洲综合成人| 天天综合天天综合色| 亚洲男人都懂的| 中文字幕一区二区三区不卡| 久久亚洲欧美国产精品乐播| 欧美日韩一区三区| 欧美无砖砖区免费| 91国模大尺度私拍在线视频| 波多野结衣亚洲一区| www.爱久久.com| 99re亚洲国产精品| av福利精品导航| 成人性生交大片免费看在线播放 | 91丝袜高跟美女视频| 成人动漫精品一区二区| 不卡的av电影在线观看| 91女人视频在线观看| 91年精品国产| 5月丁香婷婷综合| 精品国产乱码久久| 欧美激情在线一区二区| 国产精品乱码人人做人人爱| 中文字幕在线观看一区二区| 亚洲欧美区自拍先锋| 亚洲第一福利视频在线| 精品一区二区三区在线播放视频 | 亚洲视频狠狠干| 亚洲午夜精品在线| 麻豆freexxxx性91精品| 成人午夜视频网站| 欧美日韩国产乱码电影| 久久久久久久久一| 国产乱码精品一区二区三| 91麻豆国产精品久久| 正在播放亚洲一区| 国产精品伦理一区二区| 理论电影国产精品| 色婷婷综合五月| 欧美精品一区二区在线观看| 亚洲国产综合色| 国产福利不卡视频| 日韩午夜激情av| 亚洲资源中文字幕| 色综合久久综合| 国产精品午夜春色av| 美女网站一区二区| 欧美日韩一区成人| 亚洲欧美色一区| 久久综合综合久久综合| 欧美日韩久久久一区| 国产精品第13页| 粉嫩av一区二区三区在线播放 | 成人网男人的天堂| 久久综合九色综合欧美98| 亚洲成a人v欧美综合天堂下载 | 免费人成网站在线观看欧美高清| 色天天综合久久久久综合片| 国产人成一区二区三区影院| 裸体健美xxxx欧美裸体表演| 欧美另类一区二区三区| 亚洲成年人影院| 欧美一区国产二区| 日韩精品成人一区二区在线| 欧美日韩一级视频| 日韩黄色免费电影| 欧美zozo另类异族| 国产乱码精品一区二区三区五月婷| 欧美精品一级二级三级| 婷婷久久综合九色综合伊人色| 欧美日韩亚洲国产综合| 日本亚洲一区二区| 久久久精品影视| 一本色道久久综合亚洲精品按摩| 亚洲欧美精品午睡沙发| 欧美日韩在线不卡| 国产一区二区福利| 亚洲精品中文字幕乱码三区| 欧美三级三级三级爽爽爽| 久久不见久久见中文字幕免费| 国产精品全国免费观看高清| 99久久国产综合色|国产精品| 视频在线观看一区二区三区| 久久精品人人做人人爽人人| 91亚洲精华国产精华精华液| 一区二区三区视频在线看| 91精品国产91综合久久蜜臀| 色综合天天性综合| 狠狠色丁香婷婷综合久久片| 17c精品麻豆一区二区免费| 日韩欧美一二三区| 欧美丝袜丝nylons| 91在线国内视频| 国产91丝袜在线播放0| 另类专区欧美蜜桃臀第一页| 亚洲国产三级在线| 中文字幕亚洲在| 国产精品美女久久久久久久久 | 欧美一区二区视频观看视频| 国产在线一区二区| 久久99精品久久久| 三级成人在线视频| 一区二区三区欧美久久| 国产精品短视频| 国产精品网站在线观看| 欧美精品一区二区在线播放| 欧美精品一级二级三级| 欧美日韩成人高清| 欧美岛国在线观看| 久久综合一区二区| 26uuu久久综合| 亚洲国产高清在线观看视频| 国产日韩欧美在线一区| 国产日韩亚洲欧美综合| 中文字幕在线不卡一区二区三区| 久久久久久久久久久电影| 国产精品久久久久久亚洲伦| 国产精品网曝门| 一区二区三区四区激情| 日韩高清在线观看| 狠狠色丁香久久婷婷综合丁香| 国产成人自拍网| 91麻豆国产福利精品| 亚洲美女屁股眼交3| 亚洲资源中文字幕| 黄页网站大全一区二区| 99精品久久久久久| 91麻豆精品国产91久久久| 精品国产区一区| 亚洲女同ⅹxx女同tv| 免费观看一级欧美片| 国产成人午夜视频| 欧美日韩卡一卡二| 午夜欧美大尺度福利影院在线看| 久久99精品久久久久久国产越南| 成年人午夜久久久| 欧美日韩高清一区二区不卡 | 91国在线观看| 国产色产综合产在线视频| 亚洲制服丝袜av| 成人av第一页| 精品国偷自产国产一区| 亚洲大片在线观看| 91福利在线免费观看| 国产精品久久久久久户外露出| 美女爽到高潮91| 欧美老年两性高潮| 丝袜美腿亚洲一区| 91国偷自产一区二区三区观看| 久久久噜噜噜久久中文字幕色伊伊| 五月婷婷久久丁香| 在线一区二区三区四区五区| 国产精品美女一区二区| 国产麻豆欧美日韩一区| www久久久久| 国产美女久久久久| 久久久精品一品道一区| 国产一区二区在线观看免费| 精品免费视频.| 国模一区二区三区白浆| 91精品啪在线观看国产60岁| 亚洲444eee在线观看| 欧美日本一道本| 久久精品噜噜噜成人av农村| 久久久久久久综合色一本| 风间由美一区二区av101| 亚洲色图在线播放| 91麻豆精品国产91久久久久久久久 |