Package uk.ac.starlink.array
Class DefaultArrayDescription
java.lang.Object
uk.ac.starlink.array.DefaultArrayDescription
- All Implemented Interfaces:
ArrayDescription
- Direct Known Subclasses:
BridgeNDArray
,DefaultArrayAccess
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
FieldsModifier and TypeFieldDescriptionprotected final long[]
Array dimensions; equal toarrayShape.getDims()
.protected final BadHandler
The array bad value handler as returned by the getBadHandler method.protected final boolean
The array random access availability as returned by the isRandom method.protected final boolean
The array readability as returned by the isReadable method.protected final boolean
The array writability as returned by teh isWritable method.protected final long
Number of dimensions; equal toarrayShape.getNumDims()
.protected final long
Number of pixels; equal toarrayShape.getNumPixels()
.protected final Order
Pixel ordering scheme; equal toarrayShape.getOrder()
.protected final long[]
Array origin; equal toarrayShape.getOrigin()
.protected final OrderedNDShape
The array shape as returned by the getShape method.protected final Type
The array type as returned by the getType method. -
Constructor Summary
ConstructorsConstructorDescriptionDefaultArrayDescription
(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
Modifier and TypeMethodDescriptionGets an object capable of handling bad pixel values for this array.getShape()
Gets the OrderedNDShape object which describes the origin, dimensions and pixel ordering scheme of this array.getType()
Returns the type of the primitive data in this array.boolean
isRandom()
Indicates whether random access is available.boolean
Indicates whether the pixels of this array may be read.boolean
Indicates whether the pixels of this array may be written.
-
Field Details
-
arrayShape
The array shape as returned by the getShape method. -
arrayType
The array type as returned by the getType method. -
arrayHandler
The array bad value handler as returned by the getBadHandler method. -
arrayIsRandom
protected final boolean arrayIsRandomThe array random access availability as returned by the isRandom method. -
arrayIsReadable
protected final boolean arrayIsReadableThe array readability as returned by the isReadable method. -
arrayIsWritable
protected final boolean arrayIsWritableThe array writability as returned by teh isWritable method. -
arrayOrder
Pixel ordering scheme; equal toarrayShape.getOrder()
. -
arrayNpix
protected final long arrayNpixNumber of pixels; equal toarrayShape.getNumPixels()
. -
arrayNdim
protected final long arrayNdimNumber of dimensions; equal toarrayShape.getNumDims()
. -
arrayDims
protected final long[] arrayDimsArray dimensions; equal toarrayShape.getDims()
. -
arrayOrigin
protected final long[] arrayOriginArray origin; equal toarrayShape.getOrigin()
.
-
-
Constructor Details
-
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
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
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 Details
-
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
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
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
-