numericalMethods.util
Class Arrays

java.lang.Object
  |
  +--numericalMethods.util.Arrays

public final class Arrays
extends java.lang.Object

This class provides utilities for arrays as static methods.

Most operation performed on the target array can imply a change of its length. Those methods create a new array and return this instead of the original which is only returned if it has already the right length.


Method Summary
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 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 getMax(double[] target)
          Returns the maximum of target.
static double getMax(double[] target, int position, int length)
          Returns the maximum of target from postion to postion+length-1.
static float getMax(float[] target)
          Returns the maximum of target.
static float getMax(float[] target, int position, int length)
          Returns the maximum of target from postion to postion+length-1.
static int getMax(int[] target)
          Returns the maximum of target.
static int getMax(int[] target, int position, int length)
          Returns the maximum of target from postion to postion+length-1.
static double getMin(double[] target)
          Returns the minimum of target.
static double getMin(double[] target, int position, int length)
          Returns the minimum of target from postion to postion+length-1.
static float getMin(float[] target)
          Returns the minimum of target.
static float getMin(float[] target, int position, int length)
          Returns the minimum of target from postion to postion+length-1.
static int getMin(int[] target)
          Returns the minimum of target/.
static int getMin(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 equals 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[] 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.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

size

public static final double[] size(double[] target,
                                  int size)
Just returns target if its length equals size. Otherwise, this includes target is null, it creates an array of length size and returns this instead.

resize

public static final double[] resize(double[] target,
                                    int size)
Like size(double[],int) but copies also the contents of the target if nessecary.

unrole

public static final double[] unrole(double[] target,
                                    double[] values,
                                    int numOfTimes)
Returns an array containing numOfTimes copies of the contens of values. The method uses target if it is not null and has the right size.

concat

public static final double[] concat(double[] target,
                                    double[] con,
                                    double[] cat)
Retuns an array containing the contents of con and cat. The method uses target if it is not null and has the right size.

fill

public static final void fill(double[] target,
                              double value)
Fills target with value.

fill

public static final void fill(double[] target,
                              int position,
                              int length,
                              double value)
Fills target from postion to postion+length-1 with value.

getMin

public static final double getMin(double[] target)
Returns the minimum of target.

getMin

public static final double getMin(double[] target,
                                  int position,
                                  int length)
Returns the minimum of target from postion to postion+length-1.

getMax

public static final double getMax(double[] target)
Returns the maximum of target.

getMax

public static final double getMax(double[] target,
                                  int position,
                                  int length)
Returns the maximum of target from postion to postion+length-1.

size

public static final float[] size(float[] target,
                                 int size)
Just returns target if its length equals size. Otherwise, this includes target is null, it creates an array of length size and returns this instead.

resize

public static final float[] resize(float[] target,
                                   int size)
Like size(float[],int) but copies also the contents of the target if nessecary.

unrole

public static final float[] unrole(float[] target,
                                   float[] values,
                                   int numOfTimes)
Returns an array containing numOfTimes copies of the contens of values. The method uses target if it is not null and has the right size.

concat

public static final float[] concat(float[] target,
                                   float[] con,
                                   float[] cat)
Retuns an array containing the contents of con and cat. The method uses target if it is not null and has the right size.

fill

public static final void fill(float[] target,
                              float value)
Fills target with value.

fill

public static final void fill(float[] target,
                              int position,
                              int length,
                              float value)
Fills target from postion to postion+length-1 with value.

getMin

public static final float getMin(float[] target)
Returns the minimum of target.

getMin

public static final float getMin(float[] target,
                                 int position,
                                 int length)
Returns the minimum of target from postion to postion+length-1.

getMax

public static final float getMax(float[] target)
Returns the maximum of target.

getMax

public static final float getMax(float[] target,
                                 int position,
                                 int length)
Returns the maximum of target from postion to postion+length-1.

size

public static final int[] size(int[] target,
                               int size)
Just returns target if its length equals size. Otherwise, this includes target is null, it creates an array of length size and returns this instead.

resize

public static final int[] resize(int[] target,
                                 int size)
Like size(int[],int) but copies also the contents of the target if nessecary.

unrole

public static final int[] unrole(int[] target,
                                 int[] values,
                                 int numOfTimes)
Returns an array containing numOfTimes copies of the contens of values. The method uses target if it is not null and has the right size.

concat

public static final int[] concat(int[] target,
                                 int[] con,
                                 int[] cat)
Retuns an array containing the contents of con and cat. The method uses target if it is not null and has the right size.

fill

public static final void fill(int[] target,
                              int value)
Fills target with value.

fill

public static final void fill(int[] target,
                              int position,
                              int length,
                              int value)
Fills target from postion to postion+length-1 with value.

getMin

public static final int getMin(int[] target)
Returns the minimum of target/.

getMin

public static final int getMin(int[] target,
                               int position,
                               int length)
Returns the minimum of target from postion to postion+length-1.

getMax

public static final int getMax(int[] target)
Returns the maximum of target.

getMax

public static final int getMax(int[] target,
                               int position,
                               int length)
Returns the maximum of target from postion to postion+length-1.