
public final class ArrayLikeUtil extends Object
| Modifier and Type | Field and Description | 
|---|---|
static ArrayDBIDsAdapter | 
ARRAYDBIDADAPTER
Use ArrayDBIDs as array. 
 | 
static NumberArrayAdapter<Double,double[]> | 
DOUBLEARRAYADAPTER
Use a double array in the array API. 
 | 
static FeatureVectorAdapter<?> | 
FEATUREVECTORADAPTER
Static instance. 
 | 
static NumberArrayAdapter<Float,float[]> | 
FLOATARRAYADAPTER
Use a float array in the array API. 
 | 
private static IdentityArrayAdapter<?> | 
IDENTITYADAPTER
Static instance. 
 | 
private static ListArrayAdapter<Object> | 
LISTADAPTER
Static instance for lists. 
 | 
private static NumberListArrayAdapter<Number> | 
NUMBERLISTADAPTER
Static instance for lists of numbers. 
 | 
static NumberVectorAdapter<?> | 
NUMBERVECTORADAPTER
Use a number vector in the array API. 
 | 
static TDoubleListAdapter | 
TDOUBLELISTADAPTER
Use a Trove double list as array. 
 | 
| Modifier | Constructor and Description | 
|---|---|
private  | 
ArrayLikeUtil()
Fake constructor. 
 | 
| Modifier and Type | Method and Description | 
|---|---|
static NumberArrayAdapter<Double,double[]> | 
doubleArrayAdapter()
Get the adapter for double arrays. 
 | 
static <F> FeatureVectorAdapter<F> | 
featureVectorAdapter(FeatureVector<F> prototype)
Get the static instance. 
 | 
static <A> int | 
getIndexOfMaximum(A array,
                 NumberArrayAdapter<?,A> adapter)
Returns the index of the maximum of the given values. 
 | 
static int | 
getIndexOfMaximum(double[] array)
Returns the index of the maximum of the given values. 
 | 
static <T> IdentityArrayAdapter<T> | 
identityAdapter(T dummy)
Get the static instance. 
 | 
static <T> ArrayAdapter<T,List<? extends T>> | 
listAdapter(List<? extends T> dummy)
Cast the static instance. 
 | 
static <T extends Number>  | 
numberListAdapter(List<? extends T> dummy)
Cast the static instance. 
 | 
static <N extends Number>  | 
numberVectorAdapter(NumberVector<N> prototype)
Get the static instance. 
 | 
static <A> double[] | 
toPrimitiveDoubleArray(A array,
                      NumberArrayAdapter<?,? super A> adapter)
Convert a numeric array-like to a  
double[]. | 
static double[] | 
toPrimitiveDoubleArray(List<? extends Number> array)
Convert a list of numbers to  
double[]. | 
static <N extends Number>  | 
toPrimitiveDoubleArray(NumberVector<N> obj)
Convert a number vector to  
double[]. | 
static <A> float[] | 
toPrimitiveFloatArray(A array,
                     NumberArrayAdapter<?,? super A> adapter)
Convert a numeric array-like to a  
float[]. | 
static float[] | 
toPrimitiveFloatArray(List<? extends Number> array)
Convert a list of numbers to  
float[]. | 
static <N extends Number>  | 
toPrimitiveFloatArray(NumberVector<N> obj)
Convert a number vector to  
float[]. | 
static <A> int[] | 
toPrimitiveIntegerArray(A array,
                       NumberArrayAdapter<?,? super A> adapter)
Convert a numeric array-like to a  
int[]. | 
static int[] | 
toPrimitiveIntegerArray(List<? extends Number> array)
Convert a list of numbers to  
int[]. | 
static <N extends Number>  | 
toPrimitiveIntegerArray(NumberVector<N> obj)
Convert a number vector to  
int[]. | 
private static final ListArrayAdapter<Object> LISTADAPTER
private static final NumberListArrayAdapter<Number> NUMBERLISTADAPTER
private static final IdentityArrayAdapter<?> IDENTITYADAPTER
public static final FeatureVectorAdapter<?> FEATUREVECTORADAPTER
public static final NumberVectorAdapter<?> NUMBERVECTORADAPTER
public static final NumberArrayAdapter<Double,double[]> DOUBLEARRAYADAPTER
public static final NumberArrayAdapter<Float,float[]> FLOATARRAYADAPTER
public static final TDoubleListAdapter TDOUBLELISTADAPTER
public static final ArrayDBIDsAdapter ARRAYDBIDADAPTER
public static <T> ArrayAdapter<T,List<? extends T>> listAdapter(List<? extends T> dummy)
dummy - Dummy variable, for type inferencepublic static <T extends Number> NumberArrayAdapter<T,List<? extends T>> numberListAdapter(List<? extends T> dummy)
dummy - Dummy variable, for type inferencepublic static <T> IdentityArrayAdapter<T> identityAdapter(T dummy)
dummy - Dummy object for type inferencepublic static <F> FeatureVectorAdapter<F> featureVectorAdapter(FeatureVector<F> prototype)
prototype - Prototype value, for type inferencepublic static <N extends Number> NumberVectorAdapter<N> numberVectorAdapter(NumberVector<N> prototype)
prototype - Prototype value, for type inferencepublic static NumberArrayAdapter<Double,double[]> doubleArrayAdapter()
public static <A> int getIndexOfMaximum(A array,
                        NumberArrayAdapter<?,A> adapter)
                             throws IndexOutOfBoundsException
A - array typearray - Array to inspectadapter - API adapter classIndexOutOfBoundsException - if the length of the array is 0.public static int getIndexOfMaximum(double[] array)
                             throws IndexOutOfBoundsException
array - Array to inspectIndexOutOfBoundsException - if the length of the array is 0.public static <A> double[] toPrimitiveDoubleArray(A array,
                                  NumberArrayAdapter<?,? super A> adapter)
double[].array - Array-likeadapter - Adapterpublic static double[] toPrimitiveDoubleArray(List<? extends Number> array)
double[].array - List of numberspublic static <N extends Number> double[] toPrimitiveDoubleArray(NumberVector<N> obj)
double[].obj - Object to convertpublic static <A> float[] toPrimitiveFloatArray(A array,
                                NumberArrayAdapter<?,? super A> adapter)
float[].array - Array-likeadapter - Adapterpublic static float[] toPrimitiveFloatArray(List<? extends Number> array)
float[].array - List of numberspublic static <N extends Number> float[] toPrimitiveFloatArray(NumberVector<N> obj)
float[].obj - Object to convertpublic static <A> int[] toPrimitiveIntegerArray(A array,
                                NumberArrayAdapter<?,? super A> adapter)
int[].array - Array-likeadapter - Adapterpublic static int[] toPrimitiveIntegerArray(List<? extends Number> array)
int[].array - List of numberspublic static <N extends Number> int[] toPrimitiveIntegerArray(NumberVector<N> obj)
int[].obj - Object to convert