com.ibm.layout

Class Array2D<T extends Layout>

  • Type Parameters:
    T - a layout class.


    public abstract class Array2D<T extends Layout>
    extends LayoutType
    A 2D array layout.
    • Field Summary

      Fields 
      Modifier and Type Field and Description
      protected long dim1 
      protected long dim2 
    • Constructor Summary

      Constructors 
      Modifier Constructor and Description
      protected Array2D(long dim1, long dim2, long size) 
    • Method Summary

      All Methods Static Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method and Description
      abstract T at(long i, long j)
      Get an array element
      long dim1()
      Get the length of 1st dimension
      long dim2()
      Get the length of 2nd dimension
      static <T extends Layout>
      Array2D<T>
      getArray2D(java.lang.Class<T> cls, long dim1, long dim2)
      Instantiate a 2D array layout.
      abstract void put(long i, long j, T value)
      Set an array element
      long sizeof()
      Get the data size required for an array of a given size.
      java.lang.String toString() 
      • Methods inherited from class java.lang.Object

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

      • dim1

        protected final long dim1
      • dim2

        protected final long dim2
    • Constructor Detail

      • Array2D

        protected Array2D(long dim1,
                          long dim2,
                          long size)
    • Method Detail

      • at

        public abstract T at(long i,
                             long j)
        Get an array element
        Parameters:
        i - index in 1st dim
        j - index in 2nd dim
        Returns:
        a layout targeting the array element
      • dim1

        public final long dim1()
        Get the length of 1st dimension
        Returns:
        number of elements in 1st dimension.
      • dim2

        public final long dim2()
        Get the length of 2nd dimension
        Returns:
        number of elements in 2nd dimension.
      • getArray2D

        public static <T extends LayoutArray2D<T> getArray2D(java.lang.Class<T> cls,
                                                               long dim1,
                                                               long dim2)
        Instantiate a 2D array layout. The JVM generates an accessor class that implements the layout's stub interface.
        Parameters:
        cls - The layout class for each array element.
        dim1 - The number of elements in the 1st dimension.
        dim2 - The number of elements in the 2nd dimension
        Returns:
        a 2D array layout
      • put

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

        public long sizeof()
        Get the data size required for an array of a given size.
        Specified by:
        sizeof in class LayoutType
        Parameters:
        elementSize - the size of the element type
        dim1 - length of 1st dim
        dim2 - length of 2nd dim
        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.