|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.hadoop.hdfs.util.EnumCounters<E>
E
- the enum typepublic class EnumCounters<E extends Enum<E>>
Counters for an enum type. For example, suppose there is an enum type
enum Fruit { APPLE, ORANGE, GRAPE }An
EnumCounters
object can be created for counting the numbers of
APPLE, ORANGLE and GRAPE.
Nested Class Summary | |
---|---|
static interface |
EnumCounters.Factory<E extends Enum<E>,C extends EnumCounters<E>>
A factory for creating counters. |
static class |
EnumCounters.Map<K,E extends Enum<E>,C extends EnumCounters<E>>
A key-value map which maps the keys to EnumCounters . |
Constructor Summary | |
---|---|
EnumCounters(Class<E> enumClass)
Construct counters for the given enum constants. |
Method Summary | |
---|---|
void |
add(E e,
long value)
Add the given value to counter e. |
void |
add(EnumCounters<E> that)
Add that counters to this counters. |
boolean |
equals(Object obj)
|
long |
get(E e)
|
int |
hashCode()
|
void |
negation()
Negate all counters. |
void |
set(E e,
long value)
Set counter e to the given value. |
void |
set(EnumCounters<E> that)
Set this counters to that counters. |
void |
subtract(E e,
long value)
Subtract the given value from counter e. |
void |
subtract(EnumCounters<E> that)
Subtract this counters from that counters. |
String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public EnumCounters(Class<E> enumClass)
enumClass
- the enum class of the counters.Method Detail |
---|
public final long get(E e)
public final void negation()
public final void set(E e, long value)
public final void set(EnumCounters<E> that)
public final void add(E e, long value)
public final void add(EnumCounters<E> that)
public final void subtract(E e, long value)
public final void subtract(EnumCounters<E> that)
public boolean equals(Object obj)
equals
in class Object
public int hashCode()
hashCode
in class Object
public String toString()
toString
in class Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |