Package ucar.array

Class ArrayVlen<T>

  • All Implemented Interfaces:
    Iterable<Array<T>>

    public final class ArrayVlen<T>
    extends Array<Array<T>>
    Array of variable length primitive arrays of T, eg double[length][]. Cast resulting Array, eg to Array. This is mutable, to assist users in constructing. See set(index, value).
    • Method Detail

      • factory

        public static <T> ArrayVlen<T> factory​(ArrayType dataType,
                                               int[] shape)
        Creates a Vlen of type dataType, and the given shape. The shape of the resulting array has vlen dimension removed, if present.
      • factory

        public static <T> ArrayVlen<T> factory​(ArrayType dataType,
                                               int[] shape,
                                               Object storage)
        Creates a Vlen of type dataType, and the given shape and primitive array like double[][]. The shape of the resulting array has vlen dimension removed, if present.
      • createFromStorage

        public static <T> ArrayVlen<T> createFromStorage​(ArrayType dataType,
                                                         int[] shape,
                                                         StorageMutable storage)
        Creates a Vlen of type dataType, and the given shape and primitive array like double[][]. The shape of the resulting array has vlen dimension removed, if present.
      • createStorage

        public static <T> StorageMutable<Array<T>> createStorage​(ArrayType dataType,
                                                                 int length,
                                                                 Object dataArray)
        Creates storage for a Vlen of type dataType, and the given length and primitive array like double[][].
      • createVlenArray

        public static Object createVlenArray​(ArrayType dataType,
                                             int length)
        Creates primitive array like double[length][] for a Vlen of type dataType, and the given length.
      • isVlen

        public boolean isVlen()
        Description copied from class: Array
        Is variable length and will be represented by Vlen<T>
        Overrides:
        isVlen in class Array<Array<T>>
      • totalLength

        public long totalLength()
        Element count of all the values in this Array.
      • get

        public Array<T> get​(int... index)
        Description copied from class: Array
        Get the element indicated by the list of multidimensional indices.
        Specified by:
        get in class Array<Array<T>>
        Parameters:
        index - list of indices, one for each dimension. For vlen, the last is ignored.
      • get

        public Array<T> get​(Index index)
        Description copied from class: Array
        Get the element indicated by Index.
        Specified by:
        get in class Array<Array<T>>
        Parameters:
        index - multidimensional indices.
      • set

        public void set​(int index,
                        Object value)
        Set the ith value. Do not use after construction.
        Parameters:
        index - 1d index
        value - a primitive array of T, eg double[] of any length, or an Array of T.