sam.io
Class Huffman.Leaf

java.lang.Object
  |
  +--sam.io.Node
        |
        +--sam.io.Huffman.Leaf
Enclosing class:
Huffman

protected class Huffman.Leaf
extends sam.io.Node

Special Node representing a leaf.


Field Summary
 int value
          The pattern encoded by this leaf.
 
Method Summary
 boolean isLeaf()
          Wether this node is a pure leaf, i.e.
 void oneMore()
          Increments the weight of this leaf by one.
 java.util.Enumeration ordered()
          Gets the enumeration of all nodes that are lighter than this node in decreasing order.
 java.lang.String toString()
          Gets a formatted representation of this huffman tree.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

value

public final int value
The pattern encoded by this leaf. Note that the bits present in Huffman#mask might be non-null.

Method Detail

toString

public java.lang.String toString()
Gets a formatted representation of this huffman tree. This is well-suited for debugging but is rather unreadable.

Overrides:
toString in class sam.io.Node

oneMore

public void oneMore()
Increments the weight of this leaf by one. Note that this also updates the whole huffman tree.


ordered

public java.util.Enumeration ordered()
Gets the enumeration of all nodes that are lighter than this node in decreasing order. This is mostly usefull when called from the root node which is the heaviest, i.e. from an Huffman instance.


isLeaf

public boolean isLeaf()
Wether this node is a pure leaf, i.e. if it has no son.