|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectproper.util.Counter
public class Counter
A little helper class that can do counting based on Objects , i.e. we have Object identifiers we want to count.
Constructor Summary | |
---|---|
Counter()
initializes the object |
Method Summary | |
---|---|
void |
dec(java.lang.Object id)
decreases the count for the given id by 1 |
void |
dec(java.lang.Object id,
int count)
decreases the count for the given id by the given amount |
int |
get(java.lang.Object id)
returns the count for the given id |
java.util.Enumeration |
ids()
returns a sorted enumeration of the stored IDs |
void |
inc(java.lang.Object id)
increases the count for the given id by 1 |
void |
inc(java.lang.Object id,
int count)
increases the count for the given id by the given amount |
static void |
main(java.lang.String[] args)
for testing only |
java.lang.String |
toString()
returns the counter in a string representation |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public Counter()
Method Detail |
---|
public void inc(java.lang.Object id)
public void inc(java.lang.Object id, int count)
public void dec(java.lang.Object id)
public void dec(java.lang.Object id, int count)
public int get(java.lang.Object id)
public java.util.Enumeration ids()
public java.lang.String toString()
toString
in class java.lang.Object
public static void main(java.lang.String[] args)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |