jp.gr.java_conf.dangan.util.lha
Class TwoLevelHashSearch
- LzssSearchMethod
public class TwoLevelHashSearch
二段階ハッシュと単方向連結リストを使って高速化された LzssSearchMethod。
定兼氏の論文
を参考にした。
-- revision history --
$Log: TwoLevelHashSearch.java,v $
Revision 1.1 2002/12/10 22:06:40 dangan
[bug fix]
searchAndPut() で最近の最長一致を取れなかったバグを修正。
Revision 1.0 2002/12/03 00:00:00 dangan
first edition
add to version control
TwoLevelHashSearch(int DictionarySize, int MaxMatch, int Threshold, byte[] TextBuffer) - 二段階ハッシュを使用した LzssSearchMethod を構築する。
一段目のハッシュ関数には デフォルトのものが使用される。
|
TwoLevelHashSearch(int DictionarySize, int MaxMatch, int Threshold, byte[] TextBuffer, String HashMethodClassName) - 二段階ハッシュを使用した LzssSearchMethod を構築する。
|
void | put(int position) - position から始まるデータパタンを
二段階ハッシュと連結リストから成る検索機構に登録する。
|
int | putRequires() - put() で LzssSearchMethodにデータを
登録するときに使用されるデータ量を得る。
TwoLevelHashSearch では、内部で使用している HashMethod の実装が
hash() のために必要とするデータ量( HashMethod.hashRequires() の戻り値 )
と 二段目のハッシュに必要な最大のバイト数を足したものを返す。
|
int | search(int position, int lastPutPos) - ハッシュと連結リストを使用した検索機構に登録された
データパタンを検索し position から始まるデータパタンと
最長の一致を持つものを得る。
|
int | searchAndPut(int position) - 二段階ハッシュと連結リストから成る検索機構に登録された
データパタンから position から始まるデータパタンと
最長の一致を持つものを検索し、
同時に position から始まるデータパタンを
二段階ハッシュと連結リストから成る検索機構に登録する。
|
void | slide() - TextBuffer内のpositionまでのデータを
前方へ移動する際、それに応じて SearchMethod内の
データも TextBuffer内のデータと矛盾しないように
前方へ移動する処理を行う。
|
TwoLevelHashSearch
public TwoLevelHashSearch(int DictionarySize,
int MaxMatch,
int Threshold,
byte[] TextBuffer)
二段階ハッシュを使用した LzssSearchMethod を構築する。
一段目のハッシュ関数には デフォルトのものが使用される。
DictionarySize
- 辞書サイズMaxMatch
- 最大一致長Threshold
- 圧縮、非圧縮の閾値TextBuffer
- LZSS圧縮を施すためのバッファ
TwoLevelHashSearch
public TwoLevelHashSearch(int DictionarySize,
int MaxMatch,
int Threshold,
byte[] TextBuffer,
String HashMethodClassName)
二段階ハッシュを使用した LzssSearchMethod を構築する。
DictionarySize
- 辞書サイズMaxMatch
- 最大一致長Threshold
- 圧縮、非圧縮の閾値TextBuffer
- LZSS圧縮を施すためのバッファHashMethodClassName
- Hash関数を提供するクラス名
put
public void put(int position)
position から始まるデータパタンを
二段階ハッシュと連結リストから成る検索機構に登録する。
- put in interface LzssSearchMethod
position
- TextBuffer内のデータパタンの開始位置
putRequires
public int putRequires()
put() で LzssSearchMethodにデータを
登録するときに使用されるデータ量を得る。
TwoLevelHashSearch では、内部で使用している HashMethod の実装が
hash() のために必要とするデータ量( HashMethod.hashRequires() の戻り値 )
と 二段目のハッシュに必要な最大のバイト数を足したものを返す。
- putRequires in interface LzssSearchMethod
- 一段目と二段目のハッシュに必要なバイト数を足したもの。
search
public int search(int position,
int lastPutPos)
ハッシュと連結リストを使用した検索機構に登録された
データパタンを検索し position から始まるデータパタンと
最長の一致を持つものを得る。
- search in interface LzssSearchMethod
position
- TextBuffer内のデータパタンの開始位置。lastPutPos
- 最後に登録したデータパタンの開始位置。
- 一致が見つかった場合は
LzssOutputStream.createSearchReturn
によって生成された一致位置と一致長の情報を持つ値、
一致が見つからなかった場合は
LzssOutputStream.NOMATCH。
searchAndPut
public int searchAndPut(int position)
二段階ハッシュと連結リストから成る検索機構に登録された
データパタンから position から始まるデータパタンと
最長の一致を持つものを検索し、
同時に position から始まるデータパタンを
二段階ハッシュと連結リストから成る検索機構に登録する。
- searchAndPut in interface LzssSearchMethod
position
- TextBuffer内のデータパタンの開始位置。
- 一致が見つかった場合は
LzssOutputStream.createSearchReturn
によって生成された一致位置と一致長の情報を持つ値、
一致が見つからなかった場合は
LzssOutputStream.NOMATCH。
slide
public void slide()
TextBuffer内のpositionまでのデータを
前方へ移動する際、それに応じて SearchMethod内の
データも TextBuffer内のデータと矛盾しないように
前方へ移動する処理を行う。
- slide in interface LzssSearchMethod
When you found typographical errors or omissions, Please mail to cqw10305@nifty.com
The company name and product name which are used in this document, it is the trademark or registered trademark of each company generally.
Copyright © 2001-2002 Michel Ishizuka. All Rights Reserved.