Class DynamicHuffman

java.lang.Object
jp.gr.java_conf.dangan.util.lha.DynamicHuffman
All Implemented Interfaces:
Cloneable

public class DynamicHuffman extends Object implements 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
    Modifier and Type
    Field
    Description
    static final int
    ?n?t?}?????????[?g???????B
  • Constructor Summary

    Constructors
    Constructor
    Description
    DynamicHuffman(int count)
    ?R???X?g???N?^
    DynamicHuffman(int max, int first)
    ?R???X?g???N?^
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    addLeaf(int code)
    ?n?t?}?????? code ???????t???????????B
    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
    ?}???I?u?W?F?N?g???????????????????R?s?[??????????????B
    int
    codeToNode(int code)
    ?f?[?^?????m?[?h???????????B
    int
    parentNode(int node)
    node ???e?m?[?h???m?[?h???????????B
    void
    update(int code)
    code ???d???????????????n?t?}???????X?V?????B

    Methods inherited from class java.lang.Object

    equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • 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

      public Object clone()
      ?}???I?u?W?F?N?g???????????????????R?s?[??????????????B
      Overrides:
      clone in class Object
      Returns:
      ?}???I?u?W?F?N?g???????????????????R?s?[
    • 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?????????????????