|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--biTree.Symbol
The leaf node class for our binary tree
Field Summary | |
(package private) int |
_value
|
(package private) java.lang.Integer |
_weight
|
Constructor Summary | |
Symbol(int value)
Constructor. |
|
Symbol(int value,
int weight)
Constructor. |
Method Summary | |
int |
compareTo(java.lang.Object wc)
The required compareTo method from Comparable. |
void |
execute(Visitor v)
The hook for my visitors |
int |
getValue()
Getter for the value |
java.lang.Integer |
getWeight()
Getter for the weight |
void |
incWeight()
Increments the weight by one |
void |
setWeight(int newWeight)
Sets the weight |
java.lang.String |
toString()
A toString method for testing purposes |
Methods inherited from class java.lang.Object |
|
Field Detail |
int _value
java.lang.Integer _weight
Constructor Detail |
public Symbol(int value)
int
- The value for the new symbol.public Symbol(int value, int weight)
int
- The value for the new symbol.int
- The weight for the new symbol.Method Detail |
public int getValue()
public java.lang.Integer getWeight()
getWeight
in interface WeightCompare
public void incWeight()
public void setWeight(int newWeight)
int
- The new weightpublic int compareTo(java.lang.Object wc)
compareTo
in interface java.lang.Comparable
Object
- What to compare this BiTree to. Must be
of type WeightCompare.public java.lang.String toString()
toString
in class java.lang.Object
public void execute(Visitor v)
execute
in interface WeightCompare
Visitor
- The visitor
|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |