|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjaitools.media.jai.rangelookup.RangeLookupTable<T,U>
public class RangeLookupTable<T extends Number & Comparable<? super T>,U extends Number & Comparable<? super U>>
Holds a collection of source image value ranges and their corresponding destination image values for the RangeLookup operation.
| Constructor Summary | |
|---|---|
RangeLookupTable()
Creates a new table with no default value. |
|
RangeLookupTable(U defaultValue)
Creates a new table with a default value. |
|
RangeLookupTable(U defaultValue,
boolean overlap)
Creates a new table with specified default value and overlapping range behaviour. |
|
| Method Summary | |
|---|---|
void |
add(Range<T> range,
U destValue)
Add source image value range and the corresponding destination image value |
U |
getDefaultValue()
Gets the default value which is returned when a lookup value is outside all ranges in the table. |
U |
getDestValue(T srcValue)
Lookup a source image value and return the corresponding destination image value |
boolean |
getOverlapAllowed()
Checks whether it is allowable to add a range that overlaps with ranges already in the table. |
void |
setDefaultValue(U value)
Sets the default value to return when a lookup value is outside all ranges in the table. |
void |
setOverlapAllowed(boolean b)
Sets whether the table should allow a range to be added that overlaps with one or more ranges in the table. |
String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public RangeLookupTable()
public RangeLookupTable(U defaultValue)
If defaultValue is not null it will be returned when a
lookup value cannot be matched; otherwise an unmatched value results in
an IllegalArgumentException.
defaultValue - the default destination value or null to
disable the default
public RangeLookupTable(U defaultValue,
boolean overlap)
If defaultValue is not null it will be returned when a
lookup value cannot be matched; otherwise an unmatched value results in
an IllegalArgumentException.
If overlap is true, adding a new lookup range that overlaps
existing ranges will result in the new range being reduced to its
non-overlapping intervals, if any; if false adding an overlapping
range will result in an IllegalArgumentException.
defaultValue - the default destination value or null to
disable the defaultoverlap - whether to allow overlapping ranges to be added to the table| Method Detail |
|---|
public void setOverlapAllowed(boolean b)
[0, 5) => 2
[5, 10] => 1
(10, 20] => 2
Where a new range is completely overlapped by existing ranges it will
be ignored.
If overlapping ranges are not allowed the table will throw an
IllegalArgumentException when one is detected.
Note that it is possible to end up with unintended leaks in the lookup table. If the first range in the above example had been (5, 10] rather than [5, 10] then the table would have been:
[0, 5) => 2
(5, 10] => 1
(10, 20] => 2
In this case the value 5 will not match any range.
overlap - whether to allow overlapping ranges to be added to the tablepublic boolean getOverlapAllowed()
true if adding an overlapping range is allowed;
false otherwisepublic U getDefaultValue()
null if none is setpublic void setDefaultValue(U value)
null disables the default and causes the table to
throw an exception when a lookup value cannot be matched.
value - the default value or null to disable
the default
public void add(Range<T> range,
U destValue)
range - the source image value rangedestValue - the destination image valuepublic U getDestValue(T srcValue)
srcValue - source image value
IllegalStateException - if the source image value is not contained in any
of the ranges held by this table and the table was created without a default
destination image valuepublic String toString()
toString in class Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||