jp.gr.java_conf.dangan.util.lha

Class SimpleSearch

Implemented Interfaces:
LzssSearchMethod

public class SimpleSearch
extends Object
implements LzssSearchMethod

特別な検索機構を用いない LzssSearchMethod の最もシンプルな実装。
検索機構を用いないため、 他の検索機構を用いる実装と比べると遅いが、 メモリ消費量も非常に少ない。
 -- revision history --
 $Log: SimpleSearch.java,v $
 Revision 1.0  2002/08/05 00:00:00  dangan
 add to version control
 [change]
     LzssSearchMethod のインタフェイス変更にあわせてインタフェイス変更。
 [maintenance]
     ソース整備
     タブ廃止
     ライセンス文の修正

 
Version:
$Revision: 1.0 $
Author:
$Author: dangan $

Constructor Summary

SimpleSearch(int DictionarySize, int MaxMatch, int Threshold, byte[] TextBuffer)
特別な検索機構を用いないシンプルな LzssSearchMethod を構築する。

Method Summary

void
put(int position)
SimpleSearch は検索機構を使用しないため このメソッドは何もしない。
int
putRequires()
SimpleSearch は検索機構を使用しないため常に 0 を返す。
int
search(int position, int lastPutPos)
TextBuffer 内の辞書領域にあるデータパタンから position から始まるデータパタンと 最長の一致を持つものを検索する。
int
searchAndPut(int position)
TextBuffer 内の辞書領域にあるデータパタンから position から始まるデータパタンと 最長の一致を持つものを検索する。
void
slide()
LzssOutputStream が slide() でTextBuffer内のデータを DictionarySize だけ移動させる際に検索機構内のデータを それらと矛盾無く移動させる処理を行う。

Constructor Details

SimpleSearch

public SimpleSearch(int DictionarySize,
                    int MaxMatch,
                    int Threshold,
                    byte[] TextBuffer)
特別な検索機構を用いないシンプルな LzssSearchMethod を構築する。
Parameters:
DictionarySize - 辞書サイズ
MaxMatch - 最大一致長
Threshold - 圧縮、非圧縮の閾値
TextBuffer - LZSS圧縮を施すためのバッファ

Method Details

put

public void put(int position)
SimpleSearch は検索機構を使用しないため このメソッドは何もしない。
Specified by:
put in interface LzssSearchMethod
Parameters:
position - TextBuffer内のデータパタンの開始位置

putRequires

public int putRequires()
SimpleSearch は検索機構を使用しないため常に 0 を返す。
Specified by:
putRequires in interface LzssSearchMethod
Returns:
常に 0

search

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

searchAndPut

public int searchAndPut(int position)
TextBuffer 内の辞書領域にあるデータパタンから position から始まるデータパタンと 最長の一致を持つものを検索する。
Specified by:
searchAndPut in interface LzssSearchMethod
Parameters:
position - TextBuffer内のデータパタンの開始位置。
Returns:
一致が見つかった場合は LzssOutputStream.createSearchReturn によって生成された一致位置と一致長の情報を持つ値、 一致が見つからなかった場合は LzssOutputStream.NOMATCH。

slide

public void slide()
LzssOutputStream が slide() でTextBuffer内のデータを DictionarySize だけ移動させる際に検索機構内のデータを それらと矛盾無く移動させる処理を行う。
Specified by:
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.