Class ArrayReader

java.lang.Object
uk.ac.starlink.ttools.filter.ArrayReader

public class ArrayReader extends Object
Reads values from a typed numeric array.
Since:
21 Jan 2022
Author:
Mark Taylor
  • Method Details

    • getLength

      public int getLength(Object array)
      Returns array length for a suitable array object.
      Parameters:
      array - candidate array object
      Returns:
      array length if array is of type expected by this reader, otherwise -1
    • getValue

      public double getValue(Object array, int index)
      Returns element numeric value for a suitable array object.
      Parameters:
      array - candidate array object
      Returns:
      numeric value of element index if array is of tye expected by this reader, otherwise Double.NaN
    • forClass

      public static ArrayReader forClass(Class<?> arrayClazz)
      Returns an instance of this class suitable for a given array class.
      Parameters:
      arrayClazz - class of arrays to read
      Returns:
      array reader instance for array objects of the submitted type, or null if nothing suitable is available