LHA Library for Java

jp.gr.java_conf.dangan.util.lha
Class PatriciaTrieSearch

java.lang.Object
  extended by jp.gr.java_conf.dangan.util.lha.PatriciaTrieSearch
All Implemented Interfaces:
LzssSearchMethod

public class PatriciaTrieSearch
extends java.lang.Object
implements LzssSearchMethod

PATRICIA Trie を使用した LzssSearchMethod の実装。

 -- revision history --
 $Log: PatriciaTrieSearch.java,v $
 Revision 1.2  2002/12/10 22:28:55  dangan
 [bug fix]
     put( DictionarySize * 2 )
     searchAndPut( DictionarySize * 2 ) に対応していなかったのを修正。

 Revision 1.1  2002/12/04 00:00:00  dangan
 [change]
     LzssSearchMethod のインタフェイス変更に合わせてインタフェイス変更。
 [maintenance]
     ソース整備

 Revision 1.0  2002/08/15 00:00:00  dangan
 add to version control
 [bug fix]
     contractNode で hashtable からの連結リストに繋ぐのを忘れていた修正。
     配列 に PatriciaTrieSearch.ROOT_NODE(-1) でアクセスしていたのを修正。
 [maintenance]
     ソース整備
     タブ廃止
     ライセンス文の修正

 

Version:
$Revision: 1.2 $
Author:
$Author: dangan $

Constructor Summary
PatriciaTrieSearch(int DictionarySize, int MaxMatch, int Threshold, byte[] TextBuffer)
          コンストラクタ。 PATRICIA Trie を使用した検索機構を構築する。
 
Method Summary
 void put(int position)
          position から始まるデータパタンを PATRICIA Trie に登録する。
 int putRequires()
          put() で LzssSearchMethodにデータを 登録するときに使用されるデータ量を得る。 PatriciaTrieSearch では、常に MaxMatch を返す。
 int search(int position, int lastPutPos)
          PATRICIA Trie に登録されたデータパタンを検索し position から始まるデータパタンと 最長の一致を持つものを得る。
 int searchAndPut(int position)
          PATRICIA Trie に登録されたデータパタンから position から始まるデータパタンと 最長の一致を持つものを検索し、 同時に position から始まるデータパタンを PATRICIA Trie に登録する。
 void slide()
          TextBuffer内のpositionまでのデータを 前方へ移動する際、それに応じて LzssSearchMethod 内のデータも TextBuffer内のデータと矛盾しないよ うに前方へ移動する処理を行う。
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PatriciaTrieSearch

public PatriciaTrieSearch(int DictionarySize,
                          int MaxMatch,
                          int Threshold,
                          byte[] TextBuffer)
コンストラクタ。 PATRICIA Trie を使用した検索機構を構築する。

Parameters:
DictionarySize - 辞書サイズ
MaxMatch - 最長一致長
Threshold - 圧縮、非圧縮の閾値
TextBuffer - LZSS圧縮を施すためのバッファ
Method Detail

put

public void put(int position)
position から始まるデータパタンを PATRICIA Trie に登録する。

Specified by:
put in interface LzssSearchMethod
Parameters:
position - TextBuffer内のデータパタンの開始位置

searchAndPut

public int searchAndPut(int position)
PATRICIA Trie に登録されたデータパタンから position から始まるデータパタンと 最長の一致を持つものを検索し、 同時に position から始まるデータパタンを PATRICIA Trie に登録する。

Specified by:
searchAndPut in interface LzssSearchMethod
Parameters:
position - TextBuffer内のデータパタンの開始位置。
Returns:
一致が見つかった場合は LzssOutputStream.createSearchReturn によって生成された一致位置と一致長の情報を持つ値、 一致が見つからなかった場合は LzssOutputStream.NOMATCH。
See Also:
LzssOutputStream.createSearchReturn(int,int), LzssOutputStream.NOMATCH

search

public int search(int position,
                  int lastPutPos)
PATRICIA Trie に登録されたデータパタンを検索し position から始まるデータパタンと 最長の一致を持つものを得る。

Specified by:
search in interface LzssSearchMethod
Parameters:
position - TextBuffer内のデータパタンの開始位置。
lastPutPos - 最後に登録したデータパタンの開始位置。
Returns:
一致が見つかった場合は LzssOutputStream.createSearchReturn によって生成された一致位置と一致長の情報を持つ値、 一致が見つからなかった場合は LzssOutputStream.NOMATCH。
See Also:
LzssOutputStream.createSearchReturn(int,int), LzssOutputStream.NOMATCH

slide

public void slide()
TextBuffer内のpositionまでのデータを 前方へ移動する際、それに応じて LzssSearchMethod 内のデータも TextBuffer内のデータと矛盾しないよ うに前方へ移動する処理を行う。

Specified by:
slide in interface LzssSearchMethod

putRequires

public int putRequires()
put() で LzssSearchMethodにデータを 登録するときに使用されるデータ量を得る。 PatriciaTrieSearch では、常に MaxMatch を返す。

Specified by:
putRequires in interface LzssSearchMethod
Returns:
常に MaxMatch

LHA Library for Java

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.