|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.ObjectHNode
public class HNode
A binary tree node used for Huffman code trees.
| Constructor Summary | |
|---|---|
HNode()
Simple constructor - sets all fields to null or 0. |
|
HNode(java.lang.Character c)
Constructor that sets the character only. |
|
HNode(java.lang.Character c,
int freq)
Constructor that sets the character and frequency. |
|
HNode(java.lang.Character c,
int freq,
HNode left,
HNode right)
Fully parameterized constructor. |
|
| Method Summary | |
|---|---|
boolean |
equals(java.lang.Object o)
Equals predicate considers the Character and frequency only. |
java.lang.Character |
getChar()
|
java.lang.String |
getCode()
|
int |
getFrequency()
|
HNode |
getLeft()
|
HNode |
getRight()
|
void |
setChar(java.lang.Character c)
|
void |
setCode(java.lang.String code)
|
void |
setFrequency(int f)
|
void |
setLeft(HNode n)
|
void |
setRight(HNode n)
|
java.lang.String |
toString()
String representation of this node. Format: <HNode: char, frequency, code> |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public HNode()
public HNode(java.lang.Character c)
c - the Character data itempublic HNode(java.lang.Character c, int freq)
c - the Character data itemfreq - the frequency of occurrence for the characterpublic HNode(java.lang.Character c, int freq, HNode left, HNode right)
c - the Character data itemfreq - the frequency of occurrence for the characterleft - the left childright - the right child| Method Detail |
|---|
public boolean equals(java.lang.Object o)
equals in class java.lang.Objecto - the object to check for equality
true if both the Character and the frequency agree;
false otherwisepublic java.lang.Character getChar()
public int getFrequency()
public HNode getLeft()
public HNode getRight()
public java.lang.String getCode()
public void setChar(java.lang.Character c)
public void setFrequency(int f)
public void setLeft(HNode n)
public void setRight(HNode n)
public void setCode(java.lang.String code)
public java.lang.String toString()
<HNode: char, frequency, code>
toString in class java.lang.Object
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||