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 class
Counters.Counter
-
Constructor Summary
Constructors Constructor Description Counters()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Counters.Counter
add(String name)
void
addTo(Counters sub)
boolean
count(String name, Comparable value)
Add value to the named counter.Counters.Counter
get(String name)
Counters
makeSubCounters()
void
reset()
void
show(Formatter f)
String
toString()
-
-
-
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()
-
-