uk.ac.starlink.hds
Class ArrayStructure

java.lang.Object
  extended by uk.ac.starlink.hds.ArrayStructure

public class ArrayStructure
extends Object

Represents an array object within an HDS file, as understood by the Starlink ARY library. This is more than an HDS primitive array since it has an explicit (simple array) or implicit (primitive array) origin as well as a data array.

Array file structure

The structures read and written by the Starlink ARY library are not as far as I know documented anywhere, but are defined implicitly by the ARY implementation itself. This class currently makes assumptions about the form of ARY structures based on reverse engineering of HDS/NDF files found in the field. This class should be modified if the above assumptions turn out to be incomplete or erroneous.

Author:
Mark Taylor (Starlink)
See Also:
SUN/11, SGP/38

Constructor Summary
ArrayStructure(HDSObject hobj)
          Creates an ArrayStructure from an existing HDS object.
ArrayStructure(HDSObject struct, NDShape shape, HDSType htype)
          Creates the components of a new SIMPLE array object in a suitable structure.
ArrayStructure(HDSObject parent, String name, HDSType htype, NDShape shape)
          Creates a new SIMPLE array object below the given parent HDS object.
 
Method Summary
 HDSObject getData()
          Gets the HDS object representing the data array itself.
 HDSObject getHDSObject()
          Returns the HDS object at which this array resides.
 OrderedNDShape getShape()
          Gets the shape of the array.
 String getStorage()
          Gets the storage format; either "SIMPLE" or "PRIMITIVE".
 HDSType getType()
          Returns the HDS type of the primitives in the array.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ArrayStructure

public ArrayStructure(HDSObject hobj)
               throws HDSException
Creates an ArrayStructure from an existing HDS object.

Parameters:
hobj - the HDSObject at which the array object is to be found.
Throws:
HDSException - if an error occurred in traversing the HDS tree or hobj does not represent an array

ArrayStructure

public ArrayStructure(HDSObject struct,
                      NDShape shape,
                      HDSType htype)
               throws HDSException
Creates the components of a new SIMPLE array object in a suitable structure. Any existing children of the structure will be removed and new DATA and ORIGIN children will be added describing the array object.

Parameters:
struct - an HDS structure scalar or array element of type ARRAY.
shape - the shape of the new array
htype - the HDS primitive type of the new array
Throws:
HDSException - if an error occurs manipulating the HDS tree

ArrayStructure

public ArrayStructure(HDSObject parent,
                      String name,
                      HDSType htype,
                      NDShape shape)
               throws HDSException
Creates a new SIMPLE array object below the given parent HDS object.

Parameters:
parent - the object below which the new array structure will be created
name - the name of the new array structure
htype - the HDS primitive type of the new array
shape - the shape of the new array
Throws:
HDSException - if an error occurs manipulating the HDS tree
Method Detail

getData

public HDSObject getData()
Gets the HDS object representing the data array itself. This will be a primitive array with dimensions given by getShape().getDims().

Returns:
the primitive array containing the actual data

getShape

public OrderedNDShape getShape()
Gets the shape of the array. This includes the origin and dimensions information. The pixel ordering scheme is always Order.COLUMN_MAJOR.

Returns:
the shape of the array

getStorage

public String getStorage()
Gets the storage format; either "SIMPLE" or "PRIMITIVE".

Returns:
the storage format

getHDSObject

public HDSObject getHDSObject()
Returns the HDS object at which this array resides. This will be the ARRAY structure containing it for a SIMPLE array, or the primitive array object itself for a PRIMITIVE array.

Returns:
the HDS object holding this array object

getType

public HDSType getType()
Returns the HDS type of the primitives in the array.

Returns:
the primitive type of the array


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