|
||||||||||
| 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(E[] enumConstants)
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. |
long |
get(E e)
|
void |
negation()
Negate all counters. |
void |
set(E e,
long value)
Set counter e to the given value. |
void |
subtract(E e,
long value)
Subtract the given value from counter e. |
void |
subtract(EnumCounters<E> that)
Subtract that counters from this counters. |
String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public EnumCounters(E[] enumConstants)
enumConstants - an array of enum constants such that,
for all i, enumConstants[i].ordinal() == i.| Method Detail |
|---|
public final long get(E e)
public final void negation()
public final void set(E e,
long value)
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 String toString()
toString in class Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||