Package jp.gr.java_conf.dangan.util.lha
Class DynamicHuffman
java.lang.Object
jp.gr.java_conf.dangan.util.lha.DynamicHuffman
- All Implemented Interfaces:
Cloneable
???I?n?t?}?????????N???X?B
-- revision history -- $Log: DynamicHuffman.java,v $ Revision 1.0 2002/07/24 00:00:00 dangan add to version control [bug fix] addLeaf() ???t?????? 1 ???? 2?????????????????? ???????????????t???d???? 1 ?????????t????????B [change] ?R???X?g???N?^ DynamicHuffman( int, int ) ?? ?J?n?????n?t?}???????T?C?Y?????? ?J?n?????t???????n???????????X?B [maintenance] ?\?[?X???? ?^?u?p?~ ???C?Z???X??????X
- Version:
- $Revision: 1.0 $
- Author:
- $Author: dangan $
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionDynamicHuffman
(int count) ?R???X?g???N?^DynamicHuffman
(int max, int first) ?R???X?g???N?^ -
Method Summary
Modifier and TypeMethodDescriptionvoid
addLeaf
(int code) ?n?t?}?????? code ???????t???????????Bint
childNode
(int node) ?m?[?h???t??????m?[?h?????q?m?[?h???m?[?h?????A ?m?[?h???t?????m?[?h???????f?[?^???S?r?b?g???]???????????????B ?q?m?[?h???m?[?h???????Z???????????p?????????A
node ?? 0 ???q?m?[?h?????? childNode( node )
node ?? 1 ???q?m?[?h?????? childNode( node ) - 1
???????Bclone()
?}???I?u?W?F?N?g???????????????????R?s?[??????????????Bint
codeToNode
(int code) ?f?[?^?????m?[?h???????????Bint
parentNode
(int node) node ???e?m?[?h???m?[?h???????????Bvoid
update
(int code) code ???d???????????????n?t?}???????X?V?????B
-
Field Details
-
ROOT
public static final int ROOT?n?t?}?????????[?g???????B- See Also:
-
-
Constructor Details
-
DynamicHuffman
public DynamicHuffman(int count) ?R???X?g???N?^- Parameters:
count
- ?t????
-
DynamicHuffman
public DynamicHuffman(int max, int first) ?R???X?g???N?^- Parameters:
max
- ?t????????start
- ?J?n?????t????
-
-
Method Details
-
clone
?}???I?u?W?F?N?g???????????????????R?s?[??????????????B -
codeToNode
public int codeToNode(int code) ?f?[?^?????m?[?h???????????B- Parameters:
code
- ?f?[?^- Returns:
- code???m?[?h????
-
childNode
public int childNode(int node) ?m?[?h???t??????m?[?h?????q?m?[?h???m?[?h?????A ?m?[?h???t?????m?[?h???????f?[?^???S?r?b?g???]???????????????B ?q?m?[?h???m?[?h???????Z???????????p?????????A
node ?? 0 ???q?m?[?h?????? childNode( node )
node ?? 1 ???q?m?[?h?????? childNode( node ) - 1
???????B- Parameters:
node
- ?m?[?h- Returns:
- node ???q?m?[?h???m?[?h????
-
parentNode
public int parentNode(int node) node ???e?m?[?h???m?[?h???????????B- Parameters:
node
- ?m?[?h- Returns:
- node ???e?m?[?h???m?[?h?????B
-
update
public void update(int code) code ???d???????????????n?t?}???????X?V?????B- Parameters:
code
- ?d???????????t
-
addLeaf
public void addLeaf(int code) ?n?t?}?????? code ???????t???????????B- Parameters:
code
- ?t??????????- Throws:
IllegalStateException
- ?n?t?}???????\????????????? ?t?????????????????
-