Class Binner
- java.lang.Object
-
- uk.ac.starlink.ttools.plot2.layer.Binner
-
public class Binner extends java.lang.Object
Accumulates counts in an array of bins.The array type starts at bytes and is dynamically adjusted to contain counts up to int size to save on memory. Is this overengineered?
- Since:
- 15 Feb 2013
- Author:
- Mark Taylor
-
-
Constructor Summary
Constructors Constructor Description Binner(int n)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
getCount(int index)
Returns the count in a given bin.int
getLength()
Returns the number of bins.long
getTotal()
Returns the total number of increments made to this binner.void
increment(int index)
Increments the count in a given bin by 1.
-
-
-
Method Detail
-
getLength
public int getLength()
Returns the number of bins.- Returns:
- bin count
-
increment
public void increment(int index)
Increments the count in a given bin by 1.- Parameters:
index
- bin index
-
getCount
public int getCount(int index)
Returns the count in a given bin.- Parameters:
index
- bin index
-
getTotal
public long getTotal()
Returns the total number of increments made to this binner.- Returns:
- sum of all bins
-
-