E - the enum typepublic class EnumCounters<E extends Enum<E>> extends Object
 enum Fruit { APPLE, ORANGE, GRAPE }
 
 An EnumCounters object can be created for counting the numbers of
 APPLE, ORANGE and GRAPE.| Constructor and Description | 
|---|
| EnumCounters(Class<E> enumClass)Construct counters for the given enum constants. | 
| EnumCounters(Class<E> enumClass,
            long defaultVal) | 
| Modifier and Type | Method and Description | 
|---|---|
| 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 | allLessOrEqual(long val) | 
| boolean | anyGreaterOrEqual(long val) | 
| long[] | asArray() | 
| EnumCounters<E> | deepCopyEnumCounter()Return a deep copy of EnumCounter. | 
| boolean | equals(Object obj) | 
| long | get(E e) | 
| int | hashCode() | 
| void | negation()Negate all counters. | 
| void | reset()Reset all counters to zero. | 
| void | reset(long val) | 
| 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. | 
| long | sum() | 
| String | toString() | 
public EnumCounters(Class<E> enumClass)
enumClass - the enum class of the counters.public final long get(E e)
public long[] asArray()
public void negation()
public void set(E e, long value)
public void set(EnumCounters<E> that)
public void reset()
public void add(E e, long value)
public void add(EnumCounters<E> that)
public void subtract(E e, long value)
public void subtract(EnumCounters<E> that)
public long sum()
public EnumCounters<E> deepCopyEnumCounter()
public void reset(long val)
public boolean allLessOrEqual(long val)
public boolean anyGreaterOrEqual(long val)
Copyright © 2008–2023 Apache Software Foundation. All rights reserved.