Package rasj

Class RasGMArray

All Implemented Interfaces:
RasGlobalDefs
Direct Known Subclasses:
RasMArrayByte, RasMArrayDouble, RasMArrayFloat, RasMArrayInteger, RasMArrayLong, RasMArrayShort

public class RasGMArray extends RasObject implements RasGlobalDefs

 PURPOSE:
 This class represents a generic MDD in the sense that it
 is independent of the cell base type. The only information
 available is the length in bytes of the base type.
 

More specific MDDs including base type information for more type safety are represented by a set of typed subclasses.

  • Field Details

    • domain

      protected RasMInterval domain
      spatial domain
    • data

      protected byte[] data
      internal array representation in bytes
    • objectData

      protected Object objectData
      internal array representation as Object for use in special marrays
    • currentCell

      protected byte[] currentCell
      internal object for accessing one cell of the array
    • dataSize

      protected long dataSize
      size of internal array representation in bytes
    • typeLength

      protected long typeLength
      length of the cell base type in bytes
    • currentFormat

      protected int currentFormat
      store current data format
    • storageLayout

      protected RasStorageLayout storageLayout
      storage layout object
  • Constructor Details

    • RasGMArray

      public RasGMArray()
      Default constructor.
    • RasGMArray

      public RasGMArray(RasMInterval initDomain, long cellTypeLength)
      Constructor for uninitialized MDD objects
      Parameters:
      initDomain - The initial Domain of the GMArray
      cellTypeLength - The length of the cell type used
    • RasGMArray

      public RasGMArray(RasMInterval initDomain, long cellTypeLength, boolean allocateData)
      Constructor for uninitialized MDD objects
      Parameters:
      initDomain - The initial Domain of the GMArray
      cellTypeLength - The length of the cell type used
      allocateData - control whether to allocate the data or not
    • RasGMArray

      public RasGMArray(RasMInterval initDomain, long cellTypeLength, RasStorageLayout stl)
      Constructor for uninitialized MDD objects with Storage Layout
      Parameters:
      initDomain - The initial Domain of the GMArray
      cellTypeLength - The length of the cell type used
      RasStorageLayout - The storage layout to be used
    • RasGMArray

      public RasGMArray(RasMInterval initDomain, long cellTypeLength, RasStorageLayout stl, boolean allocateData)
      Constructor for uninitialized MDD objects with Storage Layout
      Parameters:
      initDomain - The initial Domain of the GMArray
      cellTypeLength - The length of the cell type used
      allocateData - control whether to allocate the data or not
      RasStorageLayout - The storage layout to be used
    • RasGMArray

      public RasGMArray(RasGMArray obj)
      Copy constructor.
      Parameters:
      obj - a copy of this object will be created
  • Method Details

    • setTo

      public RasGMArray setTo(RasGMArray mArray)
      This method copies the values of mArray to itself.
      Parameters:
      mArray - the values of this MArray will be copied
      Returns:
      itself (after having copied the values from mArray)
    • getCell

      Reads a cell of the MDD. The cell's value is returned as a byte array, the length of which depends on the size of the base type. If you want to get the cell value as a primitive type (like integer or byte), you either have to do a cast or use the type-specific MArrays that are derived from this class.
      Parameters:
      point - the coordinates of the requested cell
      Returns:
      a byte array representing the value of the requested cell.
      Throws:
      RasDimensionMismatchException
      RasIndexOutOfBoundsException
    • getStorageLayout

      public final RasStorageLayout getStorageLayout()
      Returns the storage layout object of this MDD.
      Returns:
      the storage layout object
    • setStorageLayout

      public void setStorageLayout(RasStorageLayout stl) throws RasDimensionMismatchException
      Sets the storage layout object and checks compatibility with the domain.
      Parameters:
      stl - the new storage layout
      Throws:
      RasDimensionMismatchException
    • intersectionWith

      public RasGMArray intersectionWith(RasMInterval where)
      Returns a RasGMArray that is the intersection of the current domain with the specified interval.
      Parameters:
      where - the interval that is used for the intersection
      Returns:
      the result of the intersection of this GMArray with the parameter interval
    • spatialDomain

      public final RasMInterval spatialDomain()
      Gets the spatial domain.
      Returns:
      the spatial domain of this GMArray
    • getArray

      public byte[] getArray()
      Gets the internal representation of this GMAarray (the byte array).
      Returns:
      the byte array representing this GMArray
    • getArraySize

      public final long getArraySize()
      Gets the size of the internal representation of this GMArray (in bytes).
      Returns:
      the size of this GMArray
    • getTypeLength

      public final long getTypeLength()
      Gets the length of cell type (in bytes).
      Returns:
      the cell type length
    • getCurrentFormat

      public final int getCurrentFormat()
      Gets the current data format (RAS_ARRAY).
      Returns:
      the current data format
    • setSpatialDomain

      public void setSpatialDomain(RasMInterval dom)
      Sets the spatial domain.
      Parameters:
      dom - the new spatial domain of this GMArray
    • setArray

      public void setArray(byte[] newData)
      Sets the internal representation of the GMArray.
      Parameters:
      newData - the new byte array representing the contents of this GMArray
    • setArraySize

      public void setArraySize(long newValue)
      Sets the size of the internal representation (in bytes).
      Parameters:
      newValue - the size of the internal representation (the byte array)
    • setTypeLength

      public void setTypeLength(long newValue)
      Sets the length of the cell type (in bytes).
      Parameters:
      newValue - the cell type length
    • setCurrentFormat

      public void setCurrentFormat(int newFormat)
      Sets the current data format.
      Parameters:
      newFormat - the new data format
    • toString

      public String toString()
      gets the String representation
      Overrides:
      toString in class Object
    • toTestString

      public String toTestString()
      gets the String for testing
    • getBaseTypeSchema

      public RasBaseType getBaseTypeSchema()
      Returns the base type schema of this GMArray.
      Returns:
      the base type schema