Class MouldArrayImpl

java.lang.Object
uk.ac.starlink.array.WrapperArrayImpl
uk.ac.starlink.array.MouldArrayImpl
All Implemented Interfaces:
ArrayImpl

public class MouldArrayImpl extends WrapperArrayImpl
Wraps an NDArray to provide one with identical pixel data, but viewed as a different shape, that is with its origin or dimensions different.
Author:
Mark Taylor (Starlink)
  • Constructor Details

    • MouldArrayImpl

      public MouldArrayImpl(NDArray nda, NDShape shape)
      Creates a new ArrayImpl which which uses the pixels from an underlying NDArray moulded into a different shape (origin/dimensions). The number of pixels must be the same in the base NDArray and the requested new shape.
      Parameters:
      nda - the base NDArray which will supply the pixels
      shape - the shape which this NDArray is to have
      Throws:
      IllegalArgumentException - if shape is does not have the same number of pixels as the shape of nda
  • Method Details

    • getShape

      public OrderedNDShape getShape()
      Description copied from interface: ArrayImpl
      Returns an object representing the shape (origin and dimensions) and pixel sequence of this object. The return value must not change over the lifetime of the object.
      Specified by:
      getShape in interface ArrayImpl
      Overrides:
      getShape in class WrapperArrayImpl
      Returns:
      the ordered shape