Package net.sourceforge.jiu.color.data
Interface Histogram1D
- All Known Implementing Classes:
ArrayHistogram1D
public interface Histogram1D
An interface for a one-dimensional histogram.
- Author:
- Marco Schmidt
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionvoidclear()Sets all counters to zero.intgetEntry(int index) Returns the counter value for the given index.intReturns the maximum allowed index.intReturns the number of used entries (those entries with a counter value larger than zero).voidincreaseEntry(int index) Increases the counter value of the given index by one.voidsetEntry(int index, int newValue) Sets one counter to a new value.
-
Method Details
-
clear
void clear()Sets all counters to zero. -
getEntry
int getEntry(int index) Returns the counter value for the given index.- Parameters:
index- the zero-based index of the desired counter value- Returns:
- the counter value
- Throws:
IllegalArgumentException- if the argument is not a valid index
-
getMaxValue
int getMaxValue()Returns the maximum allowed index. The minimum is always 0.- Returns:
- the maximum index value
-
getNumUsedEntries
int getNumUsedEntries()Returns the number of used entries (those entries with a counter value larger than zero).- Returns:
- number of non-zero counter values
-
increaseEntry
void increaseEntry(int index) Increases the counter value of the given index by one. Same semantics assetEntry(index, getEntry(index) + 1);- Parameters:
index- index into the histogram- Throws:
IllegalArgumentException- if the argument index is invalid
-
setEntry
void setEntry(int index, int newValue) Sets one counter to a new value.- Parameters:
index- index of the counter to be changednewValue- new value for that counter- Throws:
IllegalArgumentException- if the index is invalid
-