com.ibm.layout

Class Array1D<T extends Layout>

  • Type Parameters:
    T - a layout class.


    public abstract class Array1D<T extends Layout>
    extends LayoutType
    A 1D array layout.
    • Constructor Summary

      Constructors 
      Modifier Constructor and Description
      protected Array1D(long length, long size) 
    • Method Summary

      All Methods Static Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method and Description
      abstract T at(long index)
      Get an array element
      static <T extends Layout>
      Array1D<T>
      getArray1D(java.lang.Class<T> cls, long length)
      Instantiate a 1D array layout.
      long getLength()
      Get the number of array elements.
      static <E extends Layout,AE extends Array1D<E>>
      AE
      getUserArray1D(java.lang.Class<AE> userArrayCls, java.lang.Class<E> elementLayout, long length)
      Instantiate a user extension of a 1D array layout.
      abstract void put(long index, T value)
      Set an array element
      abstract Array1D<T> range(long startIdx, long length)
      Extract a sub range of the array
      long sizeof()
      Get the data size required for an array of a given length.
      java.lang.String toString() 
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • elementSize

        protected final long elementSize
      • length

        protected final long length
    • Constructor Detail

      • Array1D

        protected Array1D(long length,
                          long size)
    • Method Detail

      • at

        public abstract T at(long index)
        Get an array element
        Parameters:
        index - the element index
        Returns:
        a layout targeting the array element
      • getArray1D

        public static <T extends LayoutArray1D<T> getArray1D(java.lang.Class<T> cls,
                                                               long length)
        Instantiate a 1D array layout. The JVM generates an accessor class that implements the layout's stub interface.
        Parameters:
        cls - The layout class for each array element.
        length - The number of array elements.
        Returns:
        a 1D array layout
      • getLength

        public final long getLength()
        Get the number of array elements.
        Returns:
        the number of array elements
      • getUserArray1D

        public static <E extends Layout,AE extends Array1D<E>> AE getUserArray1D(java.lang.Class<AE> userArrayCls,
                                                                                 java.lang.Class<E> elementLayout,
                                                                                 long length)
        Instantiate a user extension of a 1D array layout. The JVM generates an accessor class that implements the layout's stub interface.
        Parameters:
        userArrayCls - A user-extension of an Array1D interface.
        elementLayout - The element type of the array.
        length - The number of array elements.
        Returns:
        a 1D array layout
      • put

        public abstract void put(long index,
                                 T value)
        Set an array element
        Parameters:
        index - index in 2nd dim param value new value of the array element
      • range

        public abstract Array1D<T> range(long startIdx,
                                         long length)
        Extract a sub range of the array
        Parameters:
        startIdx - the starting array index
        length - the number of array elements to extract
        Returns:
        a layout targeting a sub range of the array
      • sizeof

        public long sizeof()
        Get the data size required for an array of a given length.
        Specified by:
        sizeof in class LayoutType
        Parameters:
        elementSize - the size of the element type
        length - The number of elements.
        Returns:
        the data size in bytes
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
Technology preview - internal use for evaluation purposes only
© Copyright 2014, 2015 IBM Corporation.