Package uk.ac.starlink.array
Class DefaultArrayDescription
- java.lang.Object
-
- uk.ac.starlink.array.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 toarrayShape.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 toarrayShape.getNumDims()
.protected long
arrayNpix
Number of pixels; equal toarrayShape.getNumPixels()
.protected Order
arrayOrder
Pixel ordering scheme; equal toarrayShape.getOrder()
.protected long[]
arrayOrigin
Array origin; equal toarrayShape.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.
-
Constructor Summary
Constructors Constructor Description DefaultArrayDescription(ArrayDescription descrip)
Constructs an ArrayDescription object with attributes copied from an existing one.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.DefaultArrayDescription(OrderedNDShape oshape, Type type, BadHandler badHandler, boolean isRandom, boolean isReadable, boolean isWritable)
Constructs an ArrayDescription object with all its attributes specified explicitly.
-
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.
-
-
-
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 toarrayShape.getOrder()
.
-
arrayNpix
protected final long arrayNpix
Number of pixels; equal toarrayShape.getNumPixels()
.
-
arrayNdim
protected final long arrayNdim
Number of dimensions; equal toarrayShape.getNumDims()
.
-
arrayDims
protected final long[] arrayDims
Array dimensions; equal toarrayShape.getDims()
.
-
arrayOrigin
protected final long[] arrayOrigin
Array origin; equal toarrayShape.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 shapetype
- array typebadHandler
- array bad value handlerisRandom
- whether random access is providedisReadable
- whether read access is providedisWritable
- 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 objectreq
- 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 interfaceArrayDescription
- 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 interfaceArrayDescription
- 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 interfaceArrayDescription
- 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 interfaceArrayDescription
- 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 interfaceArrayDescription
- 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 interfaceArrayDescription
- Returns:
- true if this array is writable
-
-