eap.fits
Class FitsColumn

java.lang.Object
  extended byeap.fits.FitsColumn
Direct Known Subclasses:
FitsASCIIColumn, FitsBinaryColumn

public abstract class FitsColumn
extends Object

Holds the information about a column in an ASCII or binary table.


Field Summary
protected  int bytes
           
protected  int count
          the repeat count parsed from the TFORM keyword
protected  String form
          the TFORM keyword value for this column
protected  Class representation
           
protected  char type
          the one character type code parsed from the TFORM keyword
 
Constructor Summary
FitsColumn(FitsHeader header, int col)
          Create a column object from the information in an HDU header, for a given column.
 
Method Summary
 int getCount()
          Returns the repeat count for this column.
 int getElementSize()
          returns the size in bytes of a single data element.
 String getName()
          returns a String representing the raw undecorated column name.
 String getUnits()
          returns a String representing the physical units for this column or null if none are specified in the FITS file
 int getWidth()
          returns the width of this column in bytes, in the main table.
 boolean isScaled()
          returns true if the column has a number value and there is an adjustment specified by the TSCALEn or TZEROn keywords.
 Class rawRepresentation()
          returns the Java class used to represent raw unscaled values in this column
 Object represent(Boolean value)
          convert an object into one of the official representation for this column.
 Object represent(byte value)
          convert a primitive type into the official representation for this column
 Object represent(double value)
          convert a primitive type into the official representation for this column
 Object represent(float value)
          convert a primitive type into the official representation for this column
 Object represent(int value)
          convert a primitive type into the official representation for this column
 Object represent(long value)
          convert a primitive type into the official representation for this column
 Object represent(Number value)
          convert an object into one of the official representation for this column.
 Object represent(Object value)
          convert an object into one of the official representation for this column.
 Object represent(String value)
          convert an object into one of the official representation for this column.
 Object scale(Object raw)
          Apply the column scaling to a value.
 Class scaledRepresentation()
          returns the Java class used to represent values in this column after scaling has been applied.
 Object unscale(Object scaled)
          reverse the scaling process.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

form

protected String form
the TFORM keyword value for this column


type

protected char type
the one character type code parsed from the TFORM keyword


count

protected int count
the repeat count parsed from the TFORM keyword


representation

protected Class representation

bytes

protected int bytes
Constructor Detail

FitsColumn

public FitsColumn(FitsHeader header,
                  int col)
           throws FitsException
Create a column object from the information in an HDU header, for a given column. This is the one case where the column number counts from "1" as it does in the FITS keywords.

Parameters:
header - the FITS header from which to extract column information
col - the column to read from the FITS file. Note: this value counts from "1" unlike most other column indices in this package.
Throws:
FitsException - if there is a problem with the FITS format.
Method Detail

rawRepresentation

public Class rawRepresentation()
returns the Java class used to represent raw unscaled values in this column


scaledRepresentation

public Class scaledRepresentation()
returns the Java class used to represent values in this column after scaling has been applied.


getUnits

public String getUnits()
returns a String representing the physical units for this column or null if none are specified in the FITS file


getName

public String getName()
returns a String representing the raw undecorated column name. or NULL if none are specified in the FITS file


getCount

public int getCount()
Returns the repeat count for this column. This is the number of vector elements or 1 for string columns.


getWidth

public int getWidth()
returns the width of this column in bytes, in the main table. This means it returns 128 for variable length columns because that is the size of the data pointers.


getElementSize

public int getElementSize()
returns the size in bytes of a single data element.


represent

public Object represent(Number value)
convert an object into one of the official representation for this column. Returns null for an unknown column type. If converting to a boolean, returns false if the integer representation of the number is zero, and true otherwise.


represent

public Object represent(String value)
convert an object into one of the official representation for this column. It returns null for an unknown column type

Throws:
NumberFormatException - if the string value is unsucessfully parsed into a number.

represent

public Object represent(Boolean value)
convert an object into one of the official representation for this column. If the native type is a number, then false is represented as zero and true is represented as one.


represent

public Object represent(Object value)
convert an object into one of the official representation for this column. If the object is a number or boolean the special represent methods for thoses classes is used. Otherwise the string method is used with the string representation of the value.


represent

public Object represent(byte value)
convert a primitive type into the official representation for this column


represent

public Object represent(int value)
convert a primitive type into the official representation for this column


represent

public Object represent(long value)
convert a primitive type into the official representation for this column


represent

public Object represent(float value)
convert a primitive type into the official representation for this column


represent

public Object represent(double value)
convert a primitive type into the official representation for this column


isScaled

public boolean isScaled()
returns true if the column has a number value and there is an adjustment specified by the TSCALEn or TZEROn keywords.


scale

public Object scale(Object raw)
Apply the column scaling to a value. String columns have trailing blanks stripped off, but otherwise non-number values remain unchanged.

Parameters:
raw - the unscaled value
Returns:
the scaled value

unscale

public Object unscale(Object scaled)
reverse the scaling process. Non-numbers are unchanged by this method.

Parameters:
scaled - ascaled value.
Returns:
the unscaled value which would scale to the scaled value.