|
JIU 0.14.3 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.sourceforge.jiu.color.data.OnDemandHistogram3D
public class OnDemandHistogram3D
A data class for a three-dimensional histogram, creating counters on demand only, not allocating counters for all possible entries at the beginning. The creation on demand happens to save space.
Note: Rewrote from scratch for version 0.15.0 to use hash tables instead of int arrays. New version creates and throws away a lot of objects, which had been a problem with early JVMs but should be OK these days.
Constructor Summary | |
---|---|
OnDemandHistogram3D(int max1,
int max2,
int max3)
Creates a new histogram, internally creates the hash table for triplet values. |
Method Summary | |
---|---|
void |
clear()
Sets all counters to zero. |
int |
getEntry(int index1,
int index2,
int index3)
Returns the counter value of (index1, index2, index3). |
int |
getMaxValue(int index)
Returns the maximum index value for one of the three indexes. |
int |
getNumUsedEntries()
Returns the number of used entries (those entries with a counter value larger than zero). |
void |
increaseEntry(int index1,
int index2,
int index3)
Increases the counter value of (index1, index2, index3) by one. |
void |
setEntry(int index1,
int index2,
int index3,
int newValue)
Sets the counter value of (index1, index2, index3) to newValue. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public OnDemandHistogram3D(int max1, int max2, int max3)
Method Detail |
---|
public void clear()
Histogram3D
clear
in interface Histogram3D
public int getEntry(int index1, int index2, int index3)
Histogram3D
getEntry
in interface Histogram3D
index1
- first of the three values forming the threedimensional indexindex2
- second of the three values forming the threedimensional indexindex3
- three of the three values forming the threedimensional index
public int getMaxValue(int index) throws IllegalArgumentException
Histogram3D
getMaxValue
in interface Histogram3D
IllegalArgumentException
- if the index formed by the arguments is invalidpublic int getNumUsedEntries()
Histogram3D
getNumUsedEntries
in interface Histogram3D
public void increaseEntry(int index1, int index2, int index3)
Histogram3D
setEntry(index1, index2, index3, getEntry(index1, index2, index3) + 1);
However, implementations of this method may take advantage of
implementation details to provide a more efficient approach.
increaseEntry
in interface Histogram3D
index1
- first of the three values forming the threedimensional indexindex2
- second of the three values forming the threedimensional indexindex3
- three of the three values forming the threedimensional indexpublic void setEntry(int index1, int index2, int index3, int newValue)
Histogram3D
setEntry
in interface Histogram3D
index1
- first of the three values forming the threedimensional indexindex2
- second of the three values forming the threedimensional indexindex3
- three of the three values forming the threedimensional indexnewValue
- the counter value that is assigned to the argument index
|
JIU 0.14.3 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |