Package ucar.nc2.util
Class Counters
- java.lang.Object
-
- ucar.nc2.util.Counters
-
public class Counters extends Object
Count number of times a value appears. value may be any Comparable; equals() is used for uniqueness.- Since:
- 11/15/2014
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classCounters.Counter
-
Constructor Summary
Constructors Constructor Description Counters()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Counters.Counteradd(String name)voidaddTo(Counters sub)booleancount(String name, Comparable value)Add value to the named counter.Counters.Counterget(String name)CountersmakeSubCounters()voidreset()voidshow(Formatter f)StringtoString()
-
-
-
Method Detail
-
add
public Counters.Counter add(String name)
-
reset
public void reset()
-
show
public void show(Formatter f)
-
get
public Counters.Counter get(String name)
-
count
public boolean count(String name, Comparable value)
Add value to the named counter. Add counter if it doesnt already exist.- Returns:
- true if its a new value, not seen before.
-
addTo
public void addTo(Counters sub)
-
makeSubCounters
public Counters makeSubCounters()
-
-