net.moraleboost.junsai.dictionary
クラス CharProperty

java.lang.Object
  上位を拡張 net.moraleboost.junsai.dictionary.CharProperty

public class CharProperty
extends java.lang.Object

文字カテゴリ定義を表す。

作成者:
taketa

入れ子のクラスの概要
static class CharProperty.CharInfo
          文字情報を表す。
 
コンストラクタの概要
CharProperty(java.lang.String filename)
          CharProperty(String, boolean)を、map==trueで呼び出すのと同じ。
CharProperty(java.lang.String filename, boolean map)
          CharPropertyを構築する。
 
メソッドの概要
 void dump(java.lang.Appendable w)
          CharPropertyをダンプする。
 void getCharInfo(char c, CharProperty.CharInfo info)
          指定した文字の情報を読み込む
 int getSize()
          カテゴリ総数を取得する。
 int id(java.lang.String key)
          指定した名前のカテゴリのIDを取得する。
 java.lang.String name(int i)
          指定したIDのカテゴリの名前を返す。
 int seekToOtherType(java.lang.CharSequence str, int begin, int end, CharProperty.CharInfo c, CharProperty.CharInfo fail)
          cと異なるカテゴリの文字を探し、そのインデックスを返す。
 
クラス java.lang.Object から継承されたメソッド
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

コンストラクタの詳細

CharProperty

public CharProperty(java.lang.String filename)
             throws DictionaryException,
                    java.io.IOException
CharProperty(String, boolean)を、map==trueで呼び出すのと同じ。

パラメータ:
filename -
例外:
DictionaryException
java.io.IOException

CharProperty

public CharProperty(java.lang.String filename,
                    boolean map)
             throws DictionaryException,
                    java.io.IOException
CharPropertyを構築する。

パラメータ:
filename - char.binのパス
map - trueだと、メモリマップトファイルを用いて辞書を読み込む。 falseだと、最初にすべてのデータをメモリ上にロードする。
例外:
DictionaryException
java.io.IOException
メソッドの詳細

getSize

public int getSize()
カテゴリ総数を取得する。

戻り値:

id

public int id(java.lang.String key)
指定した名前のカテゴリのIDを取得する。

パラメータ:
key - カテゴリ名
戻り値:
カテゴリID。存在しないカテゴリであれば-1を返す。

name

public java.lang.String name(int i)
指定したIDのカテゴリの名前を返す。

パラメータ:
i - カテゴリID
戻り値:
カテゴリ名

getCharInfo

public void getCharInfo(char c,
                        CharProperty.CharInfo info)
指定した文字の情報を読み込む

パラメータ:
c - [in] 文字
info - [out] 文字情報を格納するオブジェクト

seekToOtherType

public int seekToOtherType(java.lang.CharSequence str,
                           int begin,
                           int end,
                           CharProperty.CharInfo c,
                           CharProperty.CharInfo fail)
cと異なるカテゴリの文字を探し、そのインデックスを返す。 見つからなければ、endを返す。

パラメータ:
str - [in] 文字を探す対象となるシーケンス
begin - [in] str内の探索開始位置(0ベース)
end - [in] str内の探索終了位置(0ベース)
c - [in] 文字
fail - [out] cと異なるカテゴリの文字の情報を格納するオブジェクト
戻り値:
最初に見つけたcと異なるカテゴリの文字の位置

dump

public void dump(java.lang.Appendable w)
          throws java.io.IOException
CharPropertyをダンプする。

パラメータ:
w -
例外:
java.io.IOException