|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.expasy.jpl.commons.collection.PrimitiveArrayUtils
public final class PrimitiveArrayUtils
Provides static generic methods on primitive arrays.
| Constructor Summary | |
|---|---|
PrimitiveArrayUtils()
|
|
| Method Summary | ||
|---|---|---|
static List<Integer> |
asIntList(int[] ints)
Convert ints to List of Integers. |
|
static
|
asList(T[] os)
Convert arrays of Ts to List of Ts. |
|
static int |
byteArrayToInt(byte[] bytes)
Convert an array of bytes into integer value. |
|
static int[] |
convert2ints(Object[] objects)
Convert objects to ints. |
|
static Double[] |
doubles2Doubles(double[] dbls)
Convert array of doubles to array of Doubles. |
|
static double[] |
floats2doubles(float[] fArray)
|
|
static int[] |
getIndexRange(double[] values,
double start,
double end)
Get the index range of values where each is contained in the
given interval. |
|
static IntegerSequence |
getIndexRange(double[] values,
Interval interval)
Get an interval of index in sorted values. |
|
static void |
getNthHighestElement(double[] array,
int rank)
|
|
static double[] |
getSubArray(double[] values,
int from,
int to)
|
|
static Integer[] |
ints2Integers(int[] ints)
Convert ints to array of Integers. |
|
static byte[] |
intToByteArray(int value)
Convert an integer to an array of bytes. |
|
static
|
loadArray(T object,
org.apache.commons.collections15.Transformer<T,double[]> o2a,
double[] copy)
Copy array of doubles accessible from T-object in a given copy array. |
|
static double[] |
mapping(double[] vals,
int[] indices)
Map the doubles found at given indices. |
|
static double[] |
mapping(double[] vals,
int from,
int to)
Map the values found in the given interval. |
|
static int[] |
mapping(int[] array,
int[] indices)
Map the integers found at given indices. |
|
static Object[] |
mapping(Object[] objects,
int[] indices)
Map the objects found at given indices. |
|
static double[] |
mergeUp(double[] array1,
double[] array2)
Merge two sorted arrays (ascending or up) in one |
|
static void |
reverse(int[] b)
simply reverse the array |
|
static List<Integer> |
searchIndices(double[] values,
double[] intervalCenters,
double halfIntervalRange)
Search the given query intervals into the target values. |
|
static List<Integer> |
searchIndices(double[] values,
double[] intervalCenters,
double halfIntervalRange,
int from)
Search the given query intervals into the target values. |
|
static double[] |
sortDown(double[] array)
Sort double values in descending order. |
|
static int[] |
sortDown(int[] array)
Sort int values in descending order. |
|
static int[] |
sortIndexesDown(double[] array)
|
|
static int[] |
sortIndexesDown(int[] array)
Sort int value indices in descending order. |
|
static int[] |
sortIndexesUp(double[] array)
|
|
static int[] |
sortIndexesUp(int[] array)
Sort int value indices in ascending order. |
|
static int[] |
sortIndices(double[] objects)
|
|
static int[] |
sortIndices(double[] objects,
int[] indices,
int from,
int to)
Reimplementation of quicksort for performance gain. |
|
static double[] |
sortUp(double[] array)
Sort double values in ascending order. |
|
static int[] |
sortUp(int[] array)
Sort int values in ascending order. |
|
static void |
sortUpArrraysOnFirst(double[][] arrays)
sort (increasing) the list of arrays based on the values contained in the first one (think of masses, intensities...) |
|
static double[] |
toDoubleArray(List<Double> list)
Convert a list of Doubles to an array of doubles. |
|
static int[] |
toIntArray(List<Integer> list)
Convert a list of Integers to an array of ints. |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public PrimitiveArrayUtils()
| Method Detail |
|---|
public static void reverse(int[] b)
public static Object[] mapping(Object[] objects,
int[] indices)
objects - the objects to map.indices - the indices of objects array.
Objects.
public static int[] mapping(int[] array,
int[] indices)
array - the integers to map.indices - the indices of objects array.
ints.
public static double[] mapping(double[] vals,
int[] indices)
vals - the values to map.indices - the indices of objects array.
doubles.
public static double[] mapping(double[] vals,
int from,
int to)
vals - the values to map.from - the first index.to - the last index.
doubles.public static int[] convert2ints(Object[] objects)
objects - the objects to convert.public static Integer[] ints2Integers(int[] ints)
ints - the ints to convert.public static List<Integer> asIntList(int[] ints)
ints - the ints to convert.public static <T> List<T> asList(T[] os)
os - the object array to convert.public static Double[] doubles2Doubles(double[] dbls)
dbls - the array to convert.public static int[] sortUp(int[] array)
array - the int array to sort.
public static int[] sortDown(int[] array)
array - the int array to sort.
public static double[] sortUp(double[] array)
array - the double array to sort.
public static double[] sortDown(double[] array)
array - the double array to sort.
public static int[] sortIndexesUp(int[] array)
array - the int array to sort indices.
public static int[] sortIndexesDown(int[] array)
array - the int array to sort indices.
public static int[] sortIndexesUp(double[] array)
public static int[] sortIndexesDown(double[] array)
public static double[] mergeUp(double[] array1,
double[] array2)
array1 - the first sorted arrayarray2 - the second sorted array
public static final int[] sortIndices(double[] objects)
public static final int[] sortIndices(double[] objects,
int[] indices,
int from,
int to)
objects - the array of object to sort.from - the lower limit.to - the upper limit.public static void sortUpArrraysOnFirst(double[][] arrays)
arrays -
IllegalArgumentException - if 0 arrays are passed of if length
differs
public static void getNthHighestElement(double[] array,
int rank)
public static double[] floats2doubles(float[] fArray)
public static int[] getIndexRange(double[] values,
double start,
double end)
values where each is contained in the
given interval.
values - the values to get the range from.start - the interval included start.end - the interval excluded end.
public static IntegerSequence getIndexRange(double[] values,
Interval interval)
interval - of definition.
IllegalArgumentException - if values are not sorted.
public static List<Integer> searchIndices(double[] values,
double[] intervalCenters,
double halfIntervalRange)
values - the sorted values to find indices in.intervalCenters - the sorted interval centers query.halfIntervalRange - the half-range interval for all query value.
IllegalArgumentException - - if the arrays are not sorted.
public static List<Integer> searchIndices(double[] values,
double[] intervalCenters,
double halfIntervalRange,
int from)
values - the sorted values to find indices in.intervalCenters - the sorted interval centers query.halfIntervalRange - the half-range interval for all query value.from - the begin index to search into values.
IllegalArgumentException - - if the arrays are not sorted.
public static double[] getSubArray(double[] values,
int from,
int to)
public static final byte[] intToByteArray(int value)
value - the integer to convert.public static final int byteArrayToInt(byte[] bytes)
bytes - the bytes to convert into integer.public static final double[] toDoubleArray(List<Double> list)
Doubles to an array of doubles.
list - the list to convert.
public static final int[] toIntArray(List<Integer> list)
Integers to an array of ints.
list - the list to convert.
public static <T> double[] loadArray(T object,
org.apache.commons.collections15.Transformer<T,double[]> o2a,
double[] copy)
T-object in a given copy array.
T - the object typed wrapping double[].object - the T-object to copy doubles from.copy - the array to copy doubles into.o2a - the transformer to access double[] from T-object.
copy loaded with doubles or a new array if
copy is not defined or had reduced capacity.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||