Class Arrays


  • public class Arrays
    extends Object
    Static methods for implementing Scheme (SRFI-25) arrays.
    • Constructor Detail

      • Arrays

        public Arrays()
    • Method Detail

      • shape

        public static Array shape​(Object[] vals)
        Convert a sequence of (lower,upper) bounds to a SRFI-25 shape.
      • handleShapeSpecifier

        public static int[] handleShapeSpecifier​(Array shape,
                                                 int rank,
                                                 int[] dimensions,
                                                 boolean toShape)
        Process a shape specifier.
        Parameters:
        shape - A canonical shape (rank*2 array) or a shape specifier (vector whose length is the rank).
        rank - The rank of arrays of that shape.
        dimensions - Ignored if toShape. Otherwise, must have length==rank, and is modified with (hi-lo).
        toShape - : True if used by ->shape.
        Returns:
        If toShape: a rank*2 shape array as an int[]; otherwise: vector of low-bounds (or null if all zero).
      • allocateArray

        public static GeneralArray allocateArray​(Array shape)
        Convenience method for resolving shape specifiers.
      • makeFromValues

        public static Array makeFromValues​(Array shape,
                                           Object[] values)
      • makeFromSimple

        public static Array makeFromSimple​(int[] dimensions,
                                           int[] lowBounds,
                                           Object buffer,
                                           PrimType elementType)
      • getBuiltArray

        public static <E> Array<E> getBuiltArray​(Array shape,
                                                 Procedure getter)