FileDocCategorySizeDatePackage
RussianCharsets.javaAPI DocApache Lucene 2.1.05677Wed Feb 14 10:46:28 GMT 2007org.apache.lucene.analysis.ru

RussianCharsets

public class RussianCharsets extends Object
RussianCharsets class contains encodings schemes (charsets) and toLowerCase() method implementation for russian characters in Unicode, KOI8 and CP1252. Each encoding scheme contains lowercase (positions 0-31) and uppercase (position 32-63) characters. One should be able to add other encoding schemes (like ISO-8859-5 or customized) by adding a new charset and adding logic to toLowerCase() method for that charset.
author
Boris Okner, b.okner@rogers.com
version
$Id: RussianCharsets.java 472959 2006-11-09 16:21:50Z yonik $

Fields Summary
public static char[]
UnicodeRussian
public static char[]
KOI8
public static char[]
CP1251
Constructors Summary
Methods Summary
public static chartoLowerCase(char letter, char[] charset)


          
    
        if (charset == UnicodeRussian)
        {
            if (letter >= '\u0430" && letter <= '\u044F")
            {
                return letter;
            }
            if (letter >= '\u0410" && letter <= '\u042F")
            {
                return (char) (letter + 32);
            }
        }

        if (charset == KOI8)
        {
            if (letter >= 0xe0 && letter <= 0xff)
            {
                return (char) (letter - 32);
            }
            if (letter >= 0xc0 && letter <= 0xdf)
            {
                return letter;
            }

        }

        if (charset == CP1251)
        {
            if (letter >= 0xC0 && letter <= 0xDF)
            {
                return (char) (letter + 32);
            }
            if (letter >= 0xE0 && letter <= 0xFF)
            {
                return letter;
            }

        }

        return Character.toLowerCase(letter);