|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objecttoxi.util.datatypes.ArrayUtil
public class ArrayUtil
A collection of array utilities.
Constructor Summary | |
---|---|
ArrayUtil()
|
Method Summary | ||
---|---|---|
static
|
addArrayToCollection(T[] array,
java.util.Collection<T> collection)
Adds all array elements to the given collection of the same type. |
|
static
|
arrayToList(T[] array)
Converts the generic array into an ArrayList of the same type. |
|
static float[] |
getAsNormalizedFloatArray(int[] source,
int bits,
int mask,
int peak,
float target)
Creates a normalized version of the values of the given int[] array. |
|
static int |
indexInArray(float needle,
float[] stack,
int maxLen)
Returns the index of the element where the given value is found in the array. |
|
static int |
indexInArray(int needle,
int[] stack,
int maxLen)
Returns the index of the element where the given value is found in the array. |
|
static float[] |
normalizeFloatArray(float[] buffer,
float peak,
float target)
Normalizes the values in the given array to the new absolute target value. |
|
static void |
reverse(byte[] array)
Reverses the item order of the supplied byte array. |
|
static void |
reverse(char[] array)
Reverses the item order of the supplied char array. |
|
static void |
reverse(float[] array)
Reverses the item order of the supplied float array. |
|
static void |
reverse(int[] array)
Reverses the item order of the supplied int array. |
|
static void |
reverse(short[] array)
Reverses the item order of the supplied short array. |
|
static
|
reverse(T[] array)
Reverses the item order of the supplied array (generic types). |
|
static
|
shuffle(T[] array)
Rearranges the array items in random order using the default java.util.Random generator. |
|
static
|
shuffle(T[] array,
java.util.Random rnd)
Rearranges the array items in random order using the given RNG. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ArrayUtil()
Method Detail |
---|
public static <T> void addArrayToCollection(T[] array, java.util.Collection<T> collection)
T
- array
- arraycollection
- existing collection or null (to create a new ArrayList
automatically)public static <T> java.util.ArrayList<T> arrayToList(T[] array)
ArrayList
of the same type.
array
-
public static float[] getAsNormalizedFloatArray(int[] source, int bits, int mask, int peak, float target)
// use 16 bits as shift offset for accessing red channel float[] red = ArrayUtil.getAsNormalizedFloatArray(argbPixels, 16, 255, 255);
source
- source databits
- number of bits to right shift each valuemask
- bitmask to apply after bitshiftingpeak
- peak value (in the source domain) to normalize againsttarget
- peak of the normalized values
public static int indexInArray(float needle, float[] stack, int maxLen)
needle
- number to findstack
- array to searchmaxLen
- number of elements to search
public static int indexInArray(int needle, int[] stack, int maxLen)
needle
- number to findstack
- array to searchmaxLen
- number of elements to search
public static float[] normalizeFloatArray(float[] buffer, float peak, float target)
buffer
- arraypeak
- current peak in the source domaintarget
- new peak in the target domain
public static void reverse(byte[] array)
array
- public static void reverse(char[] array)
array
- public static void reverse(float[] array)
array
- public static void reverse(int[] array)
array
- public static void reverse(short[] array)
array
- public static <T> void reverse(T[] array)
array
- public static <T> void shuffle(T[] array)
array
- public static <T> void shuffle(T[] array, java.util.Random rnd)
array
- rnd
-
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |