Record Class PyValue.Array

java.lang.Object
java.lang.Record
com.eco.bio7.pyffm.PyValue.Array
Record Components:
data - a double[], float[], long[], int[], short[] or byte[] (also for the unsigned types: the bits as in numpy) or boolean[]
dtype - the numpy type: "f8", "f4", "i8", "i4", "i2", "i1", "u1", "u2", "u4", "u8", "b1"
shape - the shape ({} for a scalar)
All Implemented Interfaces:
PyValue
Enclosing interface:
PyValue

public static record PyValue.Array(Object data, String dtype, int[] shape) extends Record implements PyValue
A numeric or boolean array.
  • Nested Class Summary

    Nested classes/interfaces inherited from interface PyValue

    PyValue.Array, PyValue.Frame, PyValue.None, PyValue.Other, PyValue.PyDict, PyValue.PyList, PyValue.Str
    Modifier and Type
    Interface
    Description
    static final record 
    A numeric or boolean array.
    static final record 
    A table (a pandas DataFrame): the columns by name (each an Array or Str) and the row labels (null for the default 0..n-1).
    static final record 
    None.
    static final record 
    Any other object: its type and repr (not transferable).
    static final record 
    A dict (the keys as strings, in their order).
    static final record 
    A list or tuple.
    static final record 
    Strings (null elements are None in Python).
  • Constructor Summary

    Constructors
    Constructor
    Description
    Array(Object data, String dtype, int[] shape)
    Creates an instance of a Array record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    double
    The first element as double.
    double[][]
    A 2-d array as rows of doubles.
    double[]
    The data as double values (a copy, unsigned types as unsigned values).
    int[]
    The data as int values (rounded towards zero).
    Returns the value of the data record component.
    Returns the value of the dtype record component.
    boolean
    Indicates whether some other object is "equal to" this one.
    double
    getDouble(int i)
    The element as double (unsigned types as unsigned values).
    int
    Returns a hash code value for this object.
    boolean
    Returns true for a scalar (shape {}).
    int
    The number of elements.
    int[]
    Returns the value of the shape record component.
    Returns a string representation of this record class.

    Methods inherited from class Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • Array

      public Array(Object data, String dtype, int[] shape)
      Creates an instance of a Array record class.
      Parameters:
      data - the value for the data record component
      dtype - the value for the dtype record component
      shape - the value for the shape record component
  • Method Details

    • length

      public int length()
      Description copied from interface: PyValue
      The number of elements.
      Specified by:
      length in interface PyValue
    • isScalar

      public boolean isScalar()
      Returns true for a scalar (shape {}).
    • getDouble

      public double getDouble(int i)
      The element as double (unsigned types as unsigned values).
    • asDoubles

      public double[] asDoubles()
      The data as double values (a copy, unsigned types as unsigned values).
    • asInts

      public int[] asInts()
      The data as int values (rounded towards zero).
    • asDouble

      public double asDouble()
      The first element as double.
    • asDoubleMatrix

      public double[][] asDoubleMatrix()
      A 2-d array as rows of doubles.
    • equals

      public boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • hashCode

      public int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • toString

      public String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • data

      public Object data()
      Returns the value of the data record component.
      Returns:
      the value of the data record component
    • dtype

      public String dtype()
      Returns the value of the dtype record component.
      Returns:
      the value of the dtype record component
    • shape

      public int[] shape()
      Returns the value of the shape record component.
      Returns:
      the value of the shape record component