|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.mhhe.clrs2e.Huffman.Node
Inner class for a node in a Huffman tree.
Nested Class Summary |
Nested classes inherited from class com.mhhe.clrs2e.DynamicSetElement |
DynamicSetElement.Helper |
Field Summary | |
private double |
frequency
The sum of the frequencies in all leaves of the subtree of which this node is the root. |
Constructor Summary | |
Huffman.Node(double freq)
Sets the frequency, based on the parameter. |
Method Summary | |
int |
compareTo(java.lang.Object o)
Compares this node to another, based on their frequencies. |
java.lang.Comparable |
getKey()
Returns the frequency as the key. |
void |
setKey(java.lang.Comparable key)
Cannot set the key. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private final double frequency
Constructor Detail |
public Huffman.Node(double freq)
Method Detail |
public void setKey(java.lang.Comparable key)
setKey
in interface DynamicSetElement
key
- The key, but it cannot be set.
java.lang.UnsupportedOperationException
- always.public java.lang.Comparable getKey()
getKey
in interface DynamicSetElement
public int compareTo(java.lang.Object o)
compareTo
in interface DynamicSetElement
o
- The other node.
java.lang.ClassCastException
- if o
does not
reference a Node
object.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |