Class DefaultArrayDescription

  • All Implemented Interfaces:
    ArrayDescription
    Direct Known Subclasses:
    BridgeNDArray, DefaultArrayAccess

    public class DefaultArrayDescription
    extends java.lang.Object
    implements ArrayDescription
    Straightforward immutable implementation of the ArrayDescription interface. Doesn't do anything clever - just provided for convenience when implementing subinterfaces of ArrayDescription.
    Author:
    Mark Taylor (Starlink)
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected long[] arrayDims
      Array dimensions; equal to arrayShape.getDims().
      protected BadHandler arrayHandler
      The array bad value handler as returned by the getBadHandler method.
      protected boolean arrayIsRandom
      The array random access availability as returned by the isRandom method.
      protected boolean arrayIsReadable
      The array readability as returned by the isReadable method.
      protected boolean arrayIsWritable
      The array writability as returned by teh isWritable method.
      protected long arrayNdim
      Number of dimensions; equal to arrayShape.getNumDims().
      protected long arrayNpix
      Number of pixels; equal to arrayShape.getNumPixels().
      protected Order arrayOrder
      Pixel ordering scheme; equal to arrayShape.getOrder().
      protected long[] arrayOrigin
      Array origin; equal to arrayShape.getOrigin().
      protected OrderedNDShape arrayShape
      The array shape as returned by the getShape method.
      protected Type arrayType
      The array type as returned by the getType method.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      BadHandler getBadHandler()
      Gets an object capable of handling bad pixel values for this array.
      OrderedNDShape getShape()
      Gets the OrderedNDShape object which describes the origin, dimensions and pixel ordering scheme of this array.
      Type getType()
      Returns the type of the primitive data in this array.
      boolean isRandom()
      Indicates whether random access is available.
      boolean isReadable()
      Indicates whether the pixels of this array may be read.
      boolean isWritable()
      Indicates whether the pixels of this array may be written.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • arrayShape

        protected final OrderedNDShape arrayShape
        The array shape as returned by the getShape method.
      • arrayType

        protected final Type arrayType
        The array type as returned by the getType method.
      • arrayHandler

        protected final BadHandler arrayHandler
        The array bad value handler as returned by the getBadHandler method.
      • arrayIsRandom

        protected final boolean arrayIsRandom
        The array random access availability as returned by the isRandom method.
      • arrayIsReadable

        protected final boolean arrayIsReadable
        The array readability as returned by the isReadable method.
      • arrayIsWritable

        protected final boolean arrayIsWritable
        The array writability as returned by teh isWritable method.
      • arrayOrder

        protected final Order arrayOrder
        Pixel ordering scheme; equal to arrayShape.getOrder().
      • arrayNpix

        protected final long arrayNpix
        Number of pixels; equal to arrayShape.getNumPixels().
      • arrayNdim

        protected final long arrayNdim
        Number of dimensions; equal to arrayShape.getNumDims().
      • arrayDims

        protected final long[] arrayDims
        Array dimensions; equal to arrayShape.getDims().
      • arrayOrigin

        protected final long[] arrayOrigin
        Array origin; equal to arrayShape.getOrigin().
    • Constructor Detail

      • DefaultArrayDescription

        public DefaultArrayDescription​(OrderedNDShape oshape,
                                       Type type,
                                       BadHandler badHandler,
                                       boolean isRandom,
                                       boolean isReadable,
                                       boolean isWritable)
        Constructs an ArrayDescription object with all its attributes specified explicitly.
        Parameters:
        oshape - array shape
        type - array type
        badHandler - array bad value handler
        isRandom - whether random access is provided
        isReadable - whether read access is provided
        isWritable - whether write access is provided
      • DefaultArrayDescription

        public DefaultArrayDescription​(ArrayDescription descrip)
        Constructs an ArrayDescription object with attributes copied from an existing one.
        Parameters:
        descrip - an existing ArrayDescription object whose properties this one is to inherit
      • DefaultArrayDescription

        public DefaultArrayDescription​(ArrayDescription desc,
                                       Requirements req)
        Constructs an ArrayDescription object with attributes copied from an existing one except as overridden by the requirements of a Requirements object. The constructed ArrayDescription will be the same as the the desc parameter, except that the BadHandler, Type, Window and Order attributes of the req parameter if they are not null, and its Random attribute will be the logical OR of the Random attributes of desc and req.
        Parameters:
        desc - an existing ArrayDescription object
        req - a Requirements object
    • Method Detail

      • getShape

        public OrderedNDShape getShape()
        Description copied from interface: ArrayDescription
        Gets the OrderedNDShape object which describes the origin, dimensions and pixel ordering scheme of this array. The return value must not change over the lifetime of this object.
        Specified by:
        getShape in interface ArrayDescription
        Returns:
        an OrderedNDShape object appropriate to this array
      • getType

        public Type getType()
        Description copied from interface: ArrayDescription
        Returns the type of the primitive data in this array. The return value must not change over the lifetime of this object.
        Specified by:
        getType in interface ArrayDescription
        Returns:
        a Type object indicating the primitive element type
      • getBadHandler

        public BadHandler getBadHandler()
        Description copied from interface: ArrayDescription
        Gets an object capable of handling bad pixel values for this array. The return value must not change over the lifetime of this object.
        Specified by:
        getBadHandler in interface ArrayDescription
        Returns:
        the bad value handler
      • isRandom

        public boolean isRandom()
        Description copied from interface: ArrayDescription
        Indicates whether random access is available. If true, it is possible to set the offset to any point within the bounds of the array, but if false it can only ever move forward. The return value must not change over the lifetime of this object.
        Specified by:
        isRandom in interface ArrayDescription
        Returns:
        true if random access is possible
      • isReadable

        public boolean isReadable()
        Description copied from interface: ArrayDescription
        Indicates whether the pixels of this array may be read. The return value must not change over the lifetime of this object.
        Specified by:
        isReadable in interface ArrayDescription
        Returns:
        true if this array is readable
      • isWritable

        public boolean isWritable()
        Description copied from interface: ArrayDescription
        Indicates whether the pixels of this array may be written. The return value must not change over the lifetime of this object.
        Specified by:
        isWritable in interface ArrayDescription
        Returns:
        true if this array is writable