|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.rubecula.darwin.domain.world.Frequency
public class Frequency
Well, sometimes Java is simply bizarre. The Integer class is
immutable, and cannot be extended to allow mutability. Hence this class
Frequency which isn't immutable, but can only be updated by incrementing or
decrementing (no multiplication, division, etc.).
Note that this type is not of the usual type family: there is no interface or
abstract type to support this, hence we have public non-bean methods that are
not defined in an external interface.
| Constructor Summary | |
|---|---|
Frequency()
construct a new Frequency with value 0. |
|
Frequency(int i)
construct a new Frequency with value i. |
|
| Method Summary | |
|---|---|
void |
add(int inc)
|
int |
compareTo(Frequency o)
|
void |
decrement()
decrement this Frequency by one |
boolean |
equals(java.lang.Object obj)
|
int |
hashCode()
|
void |
increment()
increment this Frequency by one |
int |
intValue()
|
java.lang.String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public Frequency()
public Frequency(int i)
i - | Method Detail |
|---|
public void add(int inc)
inc - the amount to increment frequency bypublic int compareTo(Frequency o)
compareTo in interface java.lang.Comparable<Frequency>Comparable.compareTo(java.lang.Object)public void decrement()
public boolean equals(java.lang.Object obj)
equals in class java.lang.ObjectObject.equals(java.lang.Object)public int hashCode()
hashCode in class java.lang.ObjectObject.hashCode()public void increment()
public int intValue()
ipublic java.lang.String toString()
toString in class java.lang.ObjectObject.toString()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||