|
LHA Library for Java | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjp.gr.java_conf.dangan.util.lha.BinaryTreeSearch
public class BinaryTreeSearch
二分木を使用した LzssSearchMethod の実装。
データ圧縮ハンドブック[改定第二版] M.ネルソン/J.-L.ゲィリー 著 萩原剛志・山口英 訳 ISBN4-8101-8605-9 5728円(税抜き,当方の購入当時の価格)を参考にした。
-- revision history -- $Log: BinaryTreeSearch.java,v $ Revision 1.0 2002/08/06 00:00:00 dangan add to version control [change] LzssSearchMethod のインタフェイス変更にあわせてインタフェイス変更 [maintenance] ソース整備 タブ廃止 ライセンス文の修正
Constructor Summary | |
---|---|
BinaryTreeSearch(int DictionarySize,
int MaxMatch,
int Threshold,
byte[] TextBuffer)
二分木を使用した LzssSearchMethod を構築する。 |
Method Summary | |
---|---|
void |
put(int position)
position から始まるデータパタンを二分木に登録する。 |
int |
putRequires()
put() または searchAndPut() を使用して データパタンを二分木に登録する際に 必要とするデータ量を得る。 二分木は登録の際にデータパタンを構成する 全て(MaxMatchバイト)のデータを必要とする。 |
int |
search(int position,
int lastPutPos)
二分木に登録されたデータパタンを検索し position から始まるデータパタンと 最長の一致を持つものを得る。 TextBuffer.length < position + MaxMatch となるような position では、 二分木を完全に走査できないため 最長一致を得られるとは限らない。 |
int |
searchAndPut(int position)
二分木に登録されたデータパタンから position から始まるデータパタンと 最長の一致を持つものを検索し、 同時に position から始まるデータパタンを 二分木に登録する。 |
void |
slide()
TextBuffer内のpositionまでのデータを前方へ移動する際、 それに応じて 二分木を構成するデータも TextBuffer内のデータと矛盾しないように前方へ移動する処理を行う。 |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public BinaryTreeSearch(int DictionarySize, int MaxMatch, int Threshold, byte[] TextBuffer)
DictionarySize
- 辞書サイズMaxMatch
- 最長一致長Threshold
- 圧縮、非圧縮の閾値TextBuffer
- LZSS圧縮を施すためのバッファMethod Detail |
---|
public void put(int position)
put
in interface LzssSearchMethod
position
- TextBuffer内のデータパタンの開始位置public int searchAndPut(int position)
searchAndPut
in interface LzssSearchMethod
position
- TextBuffer内のデータパタンの開始位置。
LzssOutputStream.createSearchReturn(int,int)
,
LzssOutputStream.NOMATCH
public int search(int position, int lastPutPos)
search
in interface LzssSearchMethod
position
- TextBuffer内のデータパタンの開始位置。lastPutPos
- 最後に登録したデータパタンの開始位置。
LzssOutputStream.createSearchReturn(int,int)
,
LzssOutputStream.NOMATCH
public void slide()
slide
in interface LzssSearchMethod
slideWidth
- ずらす幅slideEnd
- ずらすデータの終端 + 1(データ転送先)public int putRequires()
putRequires
in interface LzssSearchMethod
|
LHA Library for Java | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |