uk.ac.starlink.array
Class MouldArrayImpl

java.lang.Object
  extended by uk.ac.starlink.array.WrapperArrayImpl
      extended by 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 Summary
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).
 
Method Summary
 OrderedNDShape getShape()
          Returns an object representing the shape (origin and dimensions) and pixel sequence of this object.
 
Methods inherited from class uk.ac.starlink.array.WrapperArrayImpl
canMap, close, getAccess, getBadValue, getMapped, getType, getWrapped, isRandom, isReadable, isWritable, multipleAccess, open, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

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 Detail

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


Copyright © 2015 Central Laboratory of the Research Councils. All Rights Reserved.