public final class ArrayLikeUtil
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static NumberArrayAdapter<java.lang.Double,double[]> |
DOUBLEARRAYADAPTER
Use a double array in the array API.
|
static FeatureVectorAdapter<?> |
FEATUREVECTORADAPTER
Static instance.
|
static NumberArrayAdapter<java.lang.Float,float[]> |
FLOATARRAYADAPTER
Use a float array in the array API.
|
private static ListArrayAdapter<java.lang.Object> |
LISTADAPTER
Static instance for lists.
|
private static NumberListArrayAdapter<java.lang.Number> |
NUMBERLISTADAPTER
Static instance for lists of numbers.
|
static NumberVectorAdapter |
NUMBERVECTORADAPTER
Use a number vector in the array API.
|
Modifier | Constructor and Description |
---|---|
private |
ArrayLikeUtil()
Fake constructor.
|
Modifier and Type | Method and Description |
---|---|
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> ArrayAdapter<T,java.util.List<? extends T>> |
listAdapter(java.util.List<? extends T> dummy)
Cast the static instance.
|
static <T extends java.lang.Number> |
numberListAdapter(java.util.List<? extends T> dummy)
Cast the static instance.
|
static <A> double[] |
toPrimitiveDoubleArray(A array,
NumberArrayAdapter<?,? super A> adapter)
Convert a numeric array-like to a
double[] . |
static double[] |
toPrimitiveDoubleArray(java.util.List<? extends java.lang.Number> array)
Convert a list of numbers to
double[] . |
static double[] |
toPrimitiveDoubleArray(NumberVector 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(java.util.List<? extends java.lang.Number> array)
Convert a list of numbers to
float[] . |
static float[] |
toPrimitiveFloatArray(NumberVector 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(java.util.List<? extends java.lang.Number> array)
Convert a list of numbers to
int[] . |
static int[] |
toPrimitiveIntegerArray(NumberVector obj)
Convert a number vector to
int[] . |
private static final ListArrayAdapter<java.lang.Object> LISTADAPTER
private static final NumberListArrayAdapter<java.lang.Number> NUMBERLISTADAPTER
public static final FeatureVectorAdapter<?> FEATUREVECTORADAPTER
public static final NumberVectorAdapter NUMBERVECTORADAPTER
public static final NumberArrayAdapter<java.lang.Double,double[]> DOUBLEARRAYADAPTER
public static final NumberArrayAdapter<java.lang.Float,float[]> FLOATARRAYADAPTER
public static <T> ArrayAdapter<T,java.util.List<? extends T>> listAdapter(java.util.List<? extends T> dummy)
dummy
- Dummy variable, for type inferencepublic static <T extends java.lang.Number> NumberArrayAdapter<T,java.util.List<? extends T>> numberListAdapter(java.util.List<? extends T> dummy)
dummy
- Dummy variable, for type inferencepublic static <F> FeatureVectorAdapter<F> featureVectorAdapter(FeatureVector<F> prototype)
prototype
- Prototype value, for type inferencepublic static <A> int getIndexOfMaximum(A array, NumberArrayAdapter<?,A> adapter) throws java.lang.IndexOutOfBoundsException
A
- array typearray
- Array to inspectadapter
- API adapter classjava.lang.IndexOutOfBoundsException
- if the length of the array is 0.public static int getIndexOfMaximum(double[] array) throws java.lang.IndexOutOfBoundsException
array
- Array to inspectjava.lang.IndexOutOfBoundsException
- 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(java.util.List<? extends java.lang.Number> array)
double[]
.array
- List of numberspublic static double[] toPrimitiveDoubleArray(NumberVector obj)
double[]
.obj
- Object to convertpublic static <A> float[] toPrimitiveFloatArray(A array, NumberArrayAdapter<?,? super A> adapter)
float[]
.array
- Array-likeadapter
- Adapterpublic static float[] toPrimitiveFloatArray(java.util.List<? extends java.lang.Number> array)
float[]
.array
- List of numberspublic static float[] toPrimitiveFloatArray(NumberVector obj)
float[]
.obj
- Object to convertpublic static <A> int[] toPrimitiveIntegerArray(A array, NumberArrayAdapter<?,? super A> adapter)
int[]
.array
- Array-likeadapter
- Adapterpublic static int[] toPrimitiveIntegerArray(java.util.List<? extends java.lang.Number> array)
int[]
.array
- List of numberspublic static int[] toPrimitiveIntegerArray(NumberVector obj)
int[]
.obj
- Object to convertCopyright © 2019 ELKI Development Team. License information.