Class Utils


  • public class Utils
    extends java.lang.Object
    A static utility class.
    • Constructor Summary

      Constructors 
      Constructor Description
      Utils()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static Node[] arrayCopyOf​(Node[] array, int n)
      Copies the first n elements of a given array to a new array of size n.
      static int[][] copy2dArray​(int width, int height, int[][] array)
      Copies a given 2d array.
      static float[][] initialize2dArray​(int width, int height, float value)
      Creates a 2d array initialized with the given value.
      • Methods inherited from class java.lang.Object

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

      • Utils

        public Utils()
    • Method Detail

      • initialize2dArray

        public static float[][] initialize2dArray​(int width,
                                                  int height,
                                                  float value)
        Creates a 2d array initialized with the given value.
        Parameters:
        width - width of the new array
        height - height of the new array
        value - the initial value of all elements
        Returns:
        a 2d array initialized with the given value
      • arrayCopyOf

        public static Node[] arrayCopyOf​(Node[] array,
                                         int n)
        Copies the first n elements of a given array to a new array of size n.
        Parameters:
        array - array to copy elements from
        n - number of elements to be copied
        Returns:
        a new array with n first elements from the given array
      • copy2dArray

        public static int[][] copy2dArray​(int width,
                                          int height,
                                          int[][] array)
        Copies a given 2d array.
        Parameters:
        width - width of the array
        height - height of the array
        array - array to be copied
        Returns:
        copy of the given array