Class Shaper

java.lang.Object
uk.ac.bristol.star.cdf.Shaper

public abstract class Shaper extends Object
Takes care of turning raw variable record values into shaped record values. The raw values are those stored in the CDF data stream, and the shaped ones are those notionally corresponding to record values.
Since:
20 Jun 2013
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    Shaper(int[] dimSizes, boolean[] dimVarys)
    Constructor.
  • Method Summary

    Modifier and Type
    Method
    Description
    static Shaper
    createShaper(DataType dataType, int[] dimSizes, boolean[] dimVarys, boolean rowMajor)
    Returns an appropriate shaper instance.
    abstract int
    getArrayIndex(int[] coords)
    Returns the index into the raw value array at which the value for the given element of the notional array can be found.
    int[]
    Returns the dimensions of the notional array.
    boolean[]
    Returns the dimension variances of the array.
    abstract int
    Returns the number of array elements in the raw value array.
    abstract Class<?>
    Returns the data type of the result of the shape method.
    abstract int
    Returns the number of array elements in the shaped value array.
    abstract Object
    shape(Object rawValue, boolean rowMajor)
    Takes a raw value array and turns it into an object of the notional shape for this shaper.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • Shaper

      protected Shaper(int[] dimSizes, boolean[] dimVarys)
      Constructor.
      Parameters:
      dimSizes - dimensionality of shaped array
      dimVarys - for each dimension, true for varying, false for fixed
  • Method Details

    • getRawItemCount

      public abstract int getRawItemCount()
      Returns the number of array elements in the raw value array.
      Returns:
      raw value array size
    • getShapedItemCount

      public abstract int getShapedItemCount()
      Returns the number of array elements in the shaped value array.
      Returns:
      shaped value array size
    • getDimSizes

      public int[] getDimSizes()
      Returns the dimensions of the notional array.
      Returns:
      dimension sizes array
    • getDimVarys

      public boolean[] getDimVarys()
      Returns the dimension variances of the array.
      Returns:
      for each dimension, true if the data varies, false if fixed
    • getShapeClass

      public abstract Class<?> getShapeClass()
      Returns the data type of the result of the shape method.
      Returns:
      shaped value class
    • shape

      public abstract Object shape(Object rawValue, boolean rowMajor)
      Takes a raw value array and turns it into an object of the notional shape for this shaper. The returned object is new; it is not rawValue.
      Parameters:
      rawValue - input raw value array
      Returns:
      rowMajor required majority for result; true for row major, false for column major
    • getArrayIndex

      public abstract int getArrayIndex(int[] coords)
      Returns the index into the raw value array at which the value for the given element of the notional array can be found.
      Parameters:
      coords - coordinate array, same length as dimensionality
      Returns:
      index into raw value array
    • createShaper

      public static Shaper createShaper(DataType dataType, int[] dimSizes, boolean[] dimVarys, boolean rowMajor)
      Returns an appropriate shaper instance.
      Parameters:
      dataType - data type
      dimSizes - dimensions of notional shaped array
      dimVarys - variances of shaped array
      rowMajor - majority of raw data array; true for row major, false for column major