public final class ArrayUtility extends Object
Modifier and Type | Field and Description |
---|---|
static double |
DOUBLE_EPS
Default threshold for double epsilon tests is 1e-12.
|
static float |
FLOAT_EPS
Default threshold for float epsilon tests is 1e-6.
|
Modifier and Type | Method and Description |
---|---|
static double[] |
concat(double[] target,
double[] con,
double[] cat)
Retuns an array containing the contents of con and
cat.
|
static float[] |
concat(float[] target,
float[] con,
float[] cat)
Retuns an array containing the contents of con and
cat.
|
static int[] |
concat(int[] target,
int[] con,
int[] cat)
Retuns an array containing the contents of con and
cat.
|
static double[] |
copy(double[] source,
double[] target)
Returns copy of source which is the target if it is not
null and has the right size.
|
static float[] |
copy(float[] source,
float[] target)
Returns copy of source which is the target if it is not
null and has the right size.
|
static int[] |
copy(int[] source,
int[] target)
Returns copy of source which is the target if it is not
null and has the right size.
|
static boolean |
equal(double[] a,
double[] b)
Test whether arrays a and b are equal using an epsilon test.
|
static boolean |
equal(double[] a,
double[] b,
double eps)
Test whether arrays a and b are equal using an epsilon test.
|
static boolean |
equal(float[] a,
float[] b)
Test whether arrays a and b are equal using an epsilon test.
|
static boolean |
equal(float[] a,
float[] b,
float eps)
Test whether arrays a and b are equal using an epsilon test.
|
static boolean |
equal(int[] a,
int[] b)
Test whether arrays a and b are equal.
|
static void |
fill(double[] target,
double value)
Fills target with value.
|
static void |
fill(double[] target,
int position,
int length,
double value)
Fills target from postion to postion+length-1
with value.
|
static void |
fill(float[] target,
float value)
Fills target with value.
|
static void |
fill(float[] target,
int position,
int length,
float value)
Fills target from postion to postion+length-1
with value.
|
static void |
fill(int[] target,
int value)
Fills target with value.
|
static void |
fill(int[] target,
int position,
int length,
int value)
Fills target from postion to postion+length-1
with value.
|
static double |
max(double[] target)
Returns the maximum of target.
|
static double |
max(double[] target,
int position,
int length)
Returns the maximum of target from postion to postion+length-1.
|
static float |
max(float[] target)
Returns the maximum of target.
|
static float |
max(float[] target,
int position,
int length)
Returns the maximum of target from postion to postion+length-1.
|
static int |
max(int[] target)
Returns the maximum of target.
|
static int |
max(int[] target,
int position,
int length)
Returns the maximum of target from postion to postion+length-1.
|
static double |
min(double[] target)
Returns the minimum of target.
|
static double |
min(double[] target,
int position,
int length)
Returns the minimum of target from postion to postion+length-1.
|
static float |
min(float[] target)
Returns the minimum of target.
|
static float |
min(float[] target,
int position,
int length)
Returns the minimum of target from postion to postion+length-1.
|
static int |
min(int[] target)
Returns the minimum of target/.
|
static int |
min(int[] target,
int position,
int length)
Returns the minimum of target from postion to postion+length-1.
|
static double[] |
resize(double[] target,
int size)
Like
size(double[],int) but copies also the contents of
the target if nessecary. |
static float[] |
resize(float[] target,
int size)
Like
size(float[],int) but copies also the contents of
the target if nessecary. |
static int[] |
resize(int[] target,
int size)
Like
size(int[],int) but copies also the contents of
the target if nessecary. |
static double[] |
size(double[] target,
int size)
Just returns target if its length equal size.
|
static float[] |
size(float[] target,
int size)
Just returns target if its length equals size.
|
static int[] |
size(int[] target,
int size)
Just returns target if its length equals size.
|
static double |
sum(double[] target)
Returns the sum of target.
|
static double |
sum(double[] target,
int position,
int length)
Returns the sum of target from postion to postion+length-1.
|
static float |
sum(float[] target)
Returns the sum of target.
|
static float |
sum(float[] target,
int position,
int length)
Returns the sum of target from postion to postion+length-1.
|
static int |
sum(int[] target)
Returns the sum of target.
|
static int |
sum(int[] target,
int position,
int length)
Returns the sum of target from postion to postion+length-1.
|
static double[] |
unrole(double[] target,
double[] values,
int numOfTimes)
Returns an array containing numOfTimes copies of the
contens of values.
|
static float[] |
unrole(float[] target,
float[] values,
int numOfTimes)
Returns an array containing numOfTimes copies of the
contens of values.
|
static int[] |
unrole(int[] target,
int[] values,
int numOfTimes)
Returns an array containing numOfTimes copies of the
contens of values.
|
public static final float FLOAT_EPS
public static final double DOUBLE_EPS
public static final boolean equal(double[] a, double[] b, double eps)
a
- double arrayb
- double arrayeps
- threshold for epsilon testpublic static final boolean equal(double[] a, double[] b)
DOUBLE_EPS
a
- double arrayb
- double arraypublic static final double[] copy(double[] source, double[] target)
public static final double[] size(double[] target, int size)
public static final double[] resize(double[] target, int size)
size(double[],int)
but copies also the contents of
the target if nessecary.public static final double[] unrole(double[] target, double[] values, int numOfTimes)
null
and has the right size.public static final double[] concat(double[] target, double[] con, double[] cat)
null
and has the right size.public static final void fill(double[] target, double value)
public static final void fill(double[] target, int position, int length, double value)
public static final double sum(double[] target)
public static final double sum(double[] target, int position, int length)
public static final double min(double[] target)
public static final double min(double[] target, int position, int length)
public static final double max(double[] target)
public static final double max(double[] target, int position, int length)
public static final boolean equal(float[] a, float[] b, float eps)
a
- float arrayb
- float arrayeps
- threshold for epsilon testpublic static final boolean equal(float[] a, float[] b)
FLOAT_EPS
a
- float arrayb
- float arraypublic static final float[] copy(float[] source, float[] target)
public static final float[] size(float[] target, int size)
public static final float[] resize(float[] target, int size)
size(float[],int)
but copies also the contents of
the target if nessecary.public static final float[] unrole(float[] target, float[] values, int numOfTimes)
null
and has the right size.public static final float[] concat(float[] target, float[] con, float[] cat)
null
and has the right size.public static final void fill(float[] target, float value)
public static final void fill(float[] target, int position, int length, float value)
public static final float sum(float[] target)
public static final float sum(float[] target, int position, int length)
public static final float min(float[] target)
public static final float min(float[] target, int position, int length)
public static final float max(float[] target)
public static final float max(float[] target, int position, int length)
public static final boolean equal(int[] a, int[] b)
a
- int arrayb
- int arraypublic static final int[] copy(int[] source, int[] target)
public static final int[] size(int[] target, int size)
public static final int[] resize(int[] target, int size)
size(int[],int)
but copies also the contents of
the target if nessecary.public static final int[] unrole(int[] target, int[] values, int numOfTimes)
null
and has the right size.public static final int[] concat(int[] target, int[] con, int[] cat)
null
and has the right size.public static final void fill(int[] target, int value)
public static final void fill(int[] target, int position, int length, int value)
public static final int sum(int[] target)
public static final int sum(int[] target, int position, int length)
public static final int min(int[] target)
public static final int min(int[] target, int position, int length)
public static final int max(int[] target)
public static final int max(int[] target, int position, int length)