Package de.gsi.math

Class ArrayUtils


  • public final class ArrayUtils
    extends java.lang.Object
    Utility class containing only static functions used to manipulate arrays.
    Author:
    rstein, braeun
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static double[] convertToDouble​(boolean[] array)  
      static double[] convertToDouble​(boolean[] array, double scale)  
      static double[] convertToDouble​(byte[] array)  
      static double[] convertToDouble​(byte[] array, double scale)  
      static double[] convertToDouble​(float[] array)  
      static double[] convertToDouble​(float[] array, double scale)  
      static double[] convertToDouble​(int[] array)  
      static double[] convertToDouble​(int[] array, double scale)  
      static double[] convertToDouble​(long[] array)  
      static double[] convertToDouble​(long[] array, double scale)  
      static double[] convertToDouble​(short[] array)  
      static double[] convertToDouble​(short[] array, double scale)  
      static double[] createArray​(double offset, double scale, int size)
      Creates an array of values x = i * scale + offset
      static void fillArray​(boolean[] array, boolean value)
      fast filling of an array with a default value
      initialise a smaller piece of the array and use the System.arraycopy call to fill in the rest of the array in an expanding binary fashion
      static void fillArray​(byte[] array, byte value)
      fast filling of an array with a default value
      initialise a smaller piece of the array and use the System.arraycopy call to fill in the rest of the array in an expanding binary fashion
      static void fillArray​(double[] array, double value)
      fast filling of an array with a default value
      initialize a smaller piece of the array and use the System.arraycopy call to fill in the rest of the array in an expanding binary fashion
      static void fillArray​(double[] array, int indexStart, int indexStop, double value)
      fast filling of an array with a default value
      initialise a smaller piece of the array and use the System.arraycopy call to fill in the rest of the array in an expanding binary fashion
      static void fillArray​(float[] array, float value)
      fast filling of an array with a default value
      initialise a smaller piece of the array and use the System.arraycopy call to fill in the rest of the array in an expanding binary fashion
      static void fillArray​(float[] array, int indexStart, int indexStop, float value)
      fast filling of an array with a default value
      initialise a smaller piece of the array and use the System.arraycopy call to fill in the rest of the array in an expanding binary fashion
      static void fillArray​(int[] array, int value)
      fast filling of an array with a default value
      initialise a smaller piece of the array and use the System.arraycopy call to fill in the rest of the array in an expanding binary fashion
      static void fillArray​(long[] array, long value)
      fast filling of an array with a default value
      initialise a smaller piece of the array and use the System.arraycopy call to fill in the rest of the array in an expanding binary fashion
      static void fillArray​(short[] array, short value)
      fast filling of an array with a default value
      initialise a smaller piece of the array and use the System.arraycopy call to fill in the rest of the array in an expanding binary fashion
      static <T> void fillArray​(T[] array, int indexStart, int indexStop, T value)
      fast filling of an array with a default value
      initialise a smaller piece of the array and use the System.arraycopy call to fill in the rest of the array in an expanding binary fashion
      static <T> void fillArray​(T[] array, T value)
      fast filling of an array with a default value
      initialize a smaller piece of the array and use the System.arraycopy call to fill in the rest of the array in an expanding binary fashion
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • convertToDouble

        public static double[] convertToDouble​(boolean[] array)
      • convertToDouble

        public static double[] convertToDouble​(boolean[] array,
                                               double scale)
      • convertToDouble

        public static double[] convertToDouble​(byte[] array)
      • convertToDouble

        public static double[] convertToDouble​(byte[] array,
                                               double scale)
      • convertToDouble

        public static double[] convertToDouble​(float[] array)
      • convertToDouble

        public static double[] convertToDouble​(float[] array,
                                               double scale)
      • convertToDouble

        public static double[] convertToDouble​(int[] array)
      • convertToDouble

        public static double[] convertToDouble​(int[] array,
                                               double scale)
      • convertToDouble

        public static double[] convertToDouble​(long[] array)
      • convertToDouble

        public static double[] convertToDouble​(long[] array,
                                               double scale)
      • convertToDouble

        public static double[] convertToDouble​(short[] array)
      • convertToDouble

        public static double[] convertToDouble​(short[] array,
                                               double scale)
      • createArray

        public static double[] createArray​(double offset,
                                           double scale,
                                           int size)
        Creates an array of values x = i * scale + offset
        Parameters:
        offset - the offset value
        scale - the scale value
        size - the size of the created array
        Returns:
        array of values
      • fillArray

        public static void fillArray​(boolean[] array,
                                     boolean value)
        fast filling of an array with a default value
        initialise a smaller piece of the array and use the System.arraycopy call to fill in the rest of the array in an expanding binary fashion
        Parameters:
        array - input array
        value - value to fill each element
      • fillArray

        public static void fillArray​(byte[] array,
                                     byte value)
        fast filling of an array with a default value
        initialise a smaller piece of the array and use the System.arraycopy call to fill in the rest of the array in an expanding binary fashion
        Parameters:
        array - input array
        value - value to fill each element
      • fillArray

        public static void fillArray​(double[] array,
                                     double value)
        fast filling of an array with a default value
        initialize a smaller piece of the array and use the System.arraycopy call to fill in the rest of the array in an expanding binary fashion
        Parameters:
        array - to be initialized
        value - the value for each to be set element
      • fillArray

        public static void fillArray​(double[] array,
                                     int indexStart,
                                     int indexStop,
                                     double value)
        fast filling of an array with a default value
        initialise a smaller piece of the array and use the System.arraycopy call to fill in the rest of the array in an expanding binary fashion
        Parameters:
        array - to be initialised
        indexStart - the first index to be set
        indexStop - the last index to be set
        value - the value for each to be set element
      • fillArray

        public static void fillArray​(float[] array,
                                     float value)
        fast filling of an array with a default value
        initialise a smaller piece of the array and use the System.arraycopy call to fill in the rest of the array in an expanding binary fashion
        Parameters:
        array - input array
        value - value to fill each element
      • fillArray

        public static void fillArray​(float[] array,
                                     int indexStart,
                                     int indexStop,
                                     float value)
        fast filling of an array with a default value
        initialise a smaller piece of the array and use the System.arraycopy call to fill in the rest of the array in an expanding binary fashion
        Parameters:
        array - to be initialised
        indexStart - the first index to be set
        indexStop - the last index to be set
        value - the value for each to be set element
      • fillArray

        public static void fillArray​(int[] array,
                                     int value)
        fast filling of an array with a default value
        initialise a smaller piece of the array and use the System.arraycopy call to fill in the rest of the array in an expanding binary fashion
        Parameters:
        array - input array
        value - value to fill each element
      • fillArray

        public static void fillArray​(long[] array,
                                     long value)
        fast filling of an array with a default value
        initialise a smaller piece of the array and use the System.arraycopy call to fill in the rest of the array in an expanding binary fashion
        Parameters:
        array - input array
        value - value to fill each element
      • fillArray

        public static void fillArray​(short[] array,
                                     short value)
        fast filling of an array with a default value
        initialise a smaller piece of the array and use the System.arraycopy call to fill in the rest of the array in an expanding binary fashion
        Parameters:
        array - input array
        value - value to fill each element
      • fillArray

        public static <T> void fillArray​(T[] array,
                                         int indexStart,
                                         int indexStop,
                                         T value)
        fast filling of an array with a default value
        initialise a smaller piece of the array and use the System.arraycopy call to fill in the rest of the array in an expanding binary fashion
        Type Parameters:
        T - element type
        Parameters:
        array - to be initialised
        indexStart - the first index to be set
        indexStop - the last index to be set
        value - the value for each to be set element
      • fillArray

        public static <T> void fillArray​(T[] array,
                                         T value)
        fast filling of an array with a default value
        initialize a smaller piece of the array and use the System.arraycopy call to fill in the rest of the array in an expanding binary fashion
        Type Parameters:
        T - element type
        Parameters:
        array - to be initialized
        value - the value for each to be set element