|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectsuramadu.util.stats.Counter
A counter object suitable for storing in a Map
Constructor Summary | |
Counter(java.lang.Object key)
Creates a new instance of Counter with the specified key |
|
Counter(java.lang.Object key,
int initialValue)
Creates a new instance of Counter with the specified key, and with the initial value of the counter specified. |
Method Summary | |
void |
clear()
Clear the counter to zero. |
int |
compareTo(java.lang.Object o)
Comparaable Interface Implementation |
boolean |
equals(java.lang.Object o)
Compares the specified object with this entry for equality. |
java.lang.Object |
getKey()
Gets the key that is used to put this Object in a Map. |
java.lang.Object |
getValue()
Gets the current value of the counter as an Integer. |
int |
getValueAsInt()
Returns the current value of the counter as an int. |
int |
hashCode()
Returns the hash code value for this map entry. |
int |
postDec()
Return the current value of the counter, and then decrement it. |
int |
postInc()
Return the current value of the counter, and then increment it. |
int |
preDec()
Return the value of the counter after incrementing it. |
int |
preInc()
Return the value of the counter after incrementing it. |
java.lang.Object |
setValue(java.lang.Object value)
Sets the current value of the counter as Number. |
Methods inherited from class java.lang.Object |
getClass, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public Counter(java.lang.Object key)
key
- the key to use to put in a Map.public Counter(java.lang.Object key, int initialValue)
key
- the key to use to put in a Map.initialValue
- the initial value of the counter.Method Detail |
public int postInc()
public int postDec()
public int preInc()
public int preDec()
public void clear()
public final java.lang.Object getKey()
getKey
in interface java.util.Map.Entry
public java.lang.Object getValue()
getValue
in interface java.util.Map.Entry
public java.lang.Object setValue(java.lang.Object value)
setValue
in interface java.util.Map.Entry
value
- the Number Object to use to set the value of the counter.
public int getValueAsInt()
public int hashCode()
(e.getKey()==null ? 0 : e.getKey().hashCode()) ^ (e.getValue()==null ? 0 :
e.getValue().hashCode())
hashCode
in interface java.util.Map.Entry
(e.getKey()==null ? 0 : e.getKey().hashCode()) ^ (e.getValue()==null ? 0 :
e.getValue().hashCode())
Object.hashCode()
public boolean equals(java.lang.Object o)
(e1.getKey()==null ? e2.getKey()==null : e1.getKey().equals(e2.getKey())) &&
(e1.getValue()==null ? e2.getValue()==null : e1.getValue().equals(e2.getValue()))
equals
in interface java.util.Map.Entry
o
- object to be compared for equality with this map entry.
public int compareTo(java.lang.Object o)
compareTo
in interface java.lang.Comparable
o
- The Object that we will be comparing.
java.lang.ClassCastException
- if the Object being compared is not of the same type.Comparable
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |