de.jarnbjo.util.io
Class HuffmanNode

java.lang.Object
  extended by de.jarnbjo.util.io.HuffmanNode

public final class HuffmanNode
extends Object

Representation of a node in a Huffman tree, used to read Huffman compressed codewords from e.g. a Vorbis stream.


Field Summary
protected  HuffmanNode o0
           
protected  HuffmanNode o1
           
protected  Integer value
           
 
Constructor Summary
  HuffmanNode()
          creates a new Huffman tree root node
protected HuffmanNode(HuffmanNode parent)
           
protected HuffmanNode(HuffmanNode parent, int value)
           
 
Method Summary
protected  HuffmanNode get0()
           
protected  HuffmanNode get1()
           
protected  int getDepth()
           
protected  Integer getValue()
           
protected  int read(BitInputStream bis)
           
 boolean setNewValue(int depth, int value)
          creates a new tree node at the first free location at the given depth, and assigns the value to it
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

o0

protected HuffmanNode o0

o1

protected HuffmanNode o1

value

protected Integer value
Constructor Detail

HuffmanNode

public HuffmanNode()
creates a new Huffman tree root node


HuffmanNode

protected HuffmanNode(HuffmanNode parent)

HuffmanNode

protected HuffmanNode(HuffmanNode parent,
                      int value)
Method Detail

read

protected int read(BitInputStream bis)
            throws IOException
Throws:
IOException

get0

protected HuffmanNode get0()

get1

protected HuffmanNode get1()

getValue

protected Integer getValue()

getDepth

protected int getDepth()

setNewValue

public boolean setNewValue(int depth,
                           int value)
creates a new tree node at the first free location at the given depth, and assigns the value to it

Parameters:
depth - the tree depth of the new node (codeword length in bits)
value - the node's new value


Copyright © 2007-2011 shredzone.org. All Rights Reserved.