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 BadHandlerThe array bad value handler as returned by the getBadHandler method.protected final booleanThe array random access availability as returned by the isRandom method.protected final booleanThe array readability as returned by the isReadable method.protected final booleanThe array writability as returned by teh isWritable method.protected final longNumber of dimensions; equal toarrayShape.getNumDims().protected final longNumber of pixels; equal toarrayShape.getNumPixels().protected final OrderPixel ordering scheme; equal toarrayShape.getOrder().protected final long[]Array origin; equal toarrayShape.getOrigin().protected final OrderedNDShapeThe array shape as returned by the getShape method.protected final TypeThe 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.booleanisRandom()Indicates whether random access is available.booleanIndicates whether the pixels of this array may be read.booleanIndicates 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 thedescparameter, except that the BadHandler, Type, Window and Order attributes of thereqparameter if they are not null, and its Random attribute will be the logical OR of the Random attributes ofdescandreq.- Parameters:
desc- an existing ArrayDescription objectreq- a Requirements object
-
-
Method Details
-
getShape
Description copied from interface:ArrayDescriptionGets 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:
getShapein interfaceArrayDescription- Returns:
- an OrderedNDShape object appropriate to this array
-
getType
Description copied from interface:ArrayDescriptionReturns the type of the primitive data in this array. The return value must not change over the lifetime of this object.- Specified by:
getTypein interfaceArrayDescription- Returns:
- a Type object indicating the primitive element type
-
getBadHandler
Description copied from interface:ArrayDescriptionGets 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:
getBadHandlerin interfaceArrayDescription- Returns:
- the bad value handler
-
isRandom
public boolean isRandom()Description copied from interface:ArrayDescriptionIndicates 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:
isRandomin interfaceArrayDescription- Returns:
- true if random access is possible
-
isReadable
public boolean isReadable()Description copied from interface:ArrayDescriptionIndicates whether the pixels of this array may be read. The return value must not change over the lifetime of this object.- Specified by:
isReadablein interfaceArrayDescription- Returns:
- true if this array is readable
-
isWritable
public boolean isWritable()Description copied from interface:ArrayDescriptionIndicates whether the pixels of this array may be written. The return value must not change over the lifetime of this object.- Specified by:
isWritablein interfaceArrayDescription- Returns:
- true if this array is writable
-