|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object
|
+--com.mhhe.clrs2e.Huffman.Node
|
+--com.mhhe.clrs2e.Huffman.PrefixCodeItem
Inner class for an item in a prefix code. Objects of this class serve as leaves in a Huffman tree, once it has been constructed.
| Nested Class Summary |
| Nested classes inherited from class com.mhhe.clrs2e.DynamicSetElement |
DynamicSetElement.Helper |
| Field Summary | |
private char |
character
The character that this entry represents. |
private java.lang.String |
codeWord
This character's codeword, once the Huffman tree has been constructed. |
| Constructor Summary | |
Huffman.PrefixCodeItem(char c,
double freq)
Creates a new item in a prefix code. |
|
| Method Summary | |
int |
compareTo(java.lang.Object o)
Compares this node to another, based on their frequencies. |
char |
getChar()
Returns the character. |
java.lang.String |
getCodeWord()
Returns the codeword. |
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 |
| Methods inherited from interface com.mhhe.clrs2e.DynamicSetElement |
compareTo, getKey, setKey |
| Field Detail |
private final char character
private java.lang.String codeWord
| Constructor Detail |
public Huffman.PrefixCodeItem(char c,
double freq)
c - This entry's character.freq - This entry's frequency.| Method Detail |
public char getChar()
public java.lang.String getCodeWord()
public void setKey(java.lang.Comparable key)
setKey in interface DynamicSetElementkey - The key, but it cannot be set.
java.lang.UnsupportedOperationException - always.public java.lang.Comparable getKey()
getKey in interface DynamicSetElementpublic int compareTo(java.lang.Object o)
compareTo in interface DynamicSetElemento - 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 | ||||||||