org.erights.e.elib.tables
Class IndirectCompFunc
java.lang.Object
|
+--org.erights.e.elib.tables.IndirectCompFunc
- All Implemented Interfaces:
- CompFunc
- class IndirectCompFunc
- extends Object
- implements CompFunc
Created with knowledge of an underlying array that must remain
stable during the sort (or whatever), and of a comparison function
to be applied to elements of that array. Compares two ints
according the the comparison of the array elements at those
indices.
Method Summary |
static Number[] |
indirectSort(Object array)
Returns an array of indices sorted according to the elements of array
they index into. |
static Number[] |
indirectSort(Object array,
CompFunc func)
Returns an array of indices sorted according to the elements of array
they index into. |
double |
run(Object a,
Object b)
Returns subFunc(array[a], array[b]) |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
mySubFunc
private final CompFunc mySubFunc
myArray
private final Object myArray
IndirectCompFunc
private IndirectCompFunc(CompFunc subFunc,
Object array)
run
public double run(Object a,
Object b)
- Returns subFunc(array[a], array[b])
- Specified by:
run
in interface CompFunc
indirectSort
public static Number[] indirectSort(Object array)
- Returns an array of indices sorted according to the elements of array
they index into. This is a permutation. The original array is
unchanged.
indirectSort
public static Number[] indirectSort(Object array,
CompFunc func)
- Returns an array of indices sorted according to the elements of array
they index into. This is a permutation. The original array is
unchanged.
comments?