com.mayhoo.kanji
Class JapaneseString

java.lang.Object
  |
  +--com.mayhoo.kanji.JapaneseString

public class JapaneseString
extends Object

JapaneseString contains static functions to do various tests on Strings to determine if it consists one of the various types of characters used in the japanese writing system. There are also a functions to translate between Katakana, Hiragana, and Romaji.

Version:
$Id: JapaneseString.java,v 1.2 2002/04/20 18:10:24 djmay Exp $
Author:
Duane J. May

Field Summary
protected static String[] romaji
          The array used to map hirgana to romaji.
protected static String[] voicedRomaji
          The array used to map hirgana to romaji.
 
Constructor Summary
JapaneseString()
           
 
Method Summary
static boolean isFullwidthKatakana(String str)
          Determines if this character is a Full width Katakana.
static boolean isHalfwidthKatakana(String str)
          Determines if this character is a Half width Katakana.
static boolean isHiragana(String str)
          Determines if this character is one of the Japanese Hiragana.
static boolean isKana(String str)
          Determines if this character is a Japanese Kana.
static boolean isKanji(String str)
          Determines if this character is a Kanji character.
static boolean isKatakana(String str)
          Determines if this character is one of the Japanese Katakana.
static boolean isRomaji(String str)
          Determines if this character could be used as part of a romaji character.
static String toHiragana(String str)
          Translates this character into the equivalent Hiragana character.
static String toKatakana(String str)
          Translates this character into the equivalent Katakana character.
static String toRomaji(String str)
          Translates this character into the equivalent Romaji character.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

romaji

protected static String[] romaji
The array used to map hirgana to romaji. Note the little ya, yu and yo characters need to follow a character in the voicedRomaji array.


voicedRomaji

protected static String[] voicedRomaji
The array used to map hirgana to romaji. This is used when the character is followed by a little ya, yu, or yo.

Constructor Detail

JapaneseString

public JapaneseString()
Method Detail

isKana

public static boolean isKana(String str)
Determines if this character is a Japanese Kana.


isHiragana

public static boolean isHiragana(String str)
Determines if this character is one of the Japanese Hiragana.


isKatakana

public static boolean isKatakana(String str)
Determines if this character is one of the Japanese Katakana.


isHalfwidthKatakana

public static boolean isHalfwidthKatakana(String str)
Determines if this character is a Half width Katakana.


isFullwidthKatakana

public static boolean isFullwidthKatakana(String str)
Determines if this character is a Full width Katakana.


isKanji

public static boolean isKanji(String str)
Determines if this character is a Kanji character.


isRomaji

public static boolean isRomaji(String str)
Determines if this character could be used as part of a romaji character.


toKatakana

public static String toKatakana(String str)
Translates this character into the equivalent Katakana character. The function only operates on Hiragana and always returns the Full width version of the Katakana. If the character is outside the Hiragana then the origianal character is returned.


toHiragana

public static String toHiragana(String str)
Translates this character into the equivalent Hiragana character. The function only operates on Katakana characters If the character is outside the Full width or Half width Katakana then the origianal character is returned.


toRomaji

public static String toRomaji(String str)
Translates this character into the equivalent Romaji character. The function only operates on Hiragana and Katakana characters If the character is outside the given range then the origianal character is returned. The resulting string is lowercase if the input was Hiragana and UPPERCASE if the input was Katakana.