org.jscience.io.fits
Class FitsColumn

java.lang.Object
  extended by org.jscience.io.fits.FitsColumn
Direct Known Subclasses:
FitsASCIIColumn, FitsBinaryColumn

public abstract class FitsColumn
extends java.lang.Object

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


Field Summary
protected  int bytes
          DOCUMENT ME!
protected  int count
          the repeat count parsed from the TFORM keyword
protected  java.lang.String form
          the TFORM keyword value for this column
protected  java.lang.Class representation
          DOCUMENT ME!
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.
 java.lang.String getName()
          returns a String representing the raw undecorated column name.
 java.lang.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.
 java.lang.Class rawRepresentation()
          returns the Java class used to represent raw unscaled values in this column
 java.lang.Object represent(java.lang.Boolean value)
          convert an object into one of the official representation for this column.
 java.lang.Object represent(byte value)
          convert a primitive type into the official representation for this column
 java.lang.Object represent(double value)
          convert a primitive type into the official representation for this column
 java.lang.Object represent(float value)
          convert a primitive type into the official representation for this column
 java.lang.Object represent(int value)
          convert a primitive type into the official representation for this column
 java.lang.Object represent(long value)
          convert a primitive type into the official representation for this column
 java.lang.Object represent(java.lang.Number value)
          convert an object into one of the official representation for this column.
 java.lang.Object represent(java.lang.Object value)
          convert an object into one of the official representation for this column.
 java.lang.Object represent(java.lang.String value)
          convert an object into one of the official representation for this column.
 java.lang.Object scale(java.lang.Object raw)
          Apply the column scaling to a value.
 java.lang.Class scaledRepresentation()
          returns the Java class used to represent values in this column after scaling has been applied.
 java.lang.Object unscale(java.lang.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 java.lang.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 java.lang.Class representation
DOCUMENT ME!


bytes

protected int bytes
DOCUMENT ME!

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 java.lang.Class rawRepresentation()
returns the Java class used to represent raw unscaled values in this column

Returns:
DOCUMENT ME!

scaledRepresentation

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

Returns:
DOCUMENT ME!

getUnits

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

Returns:
DOCUMENT ME!

getName

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

Returns:
DOCUMENT ME!

getCount

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

Returns:
DOCUMENT ME!

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.

Returns:
DOCUMENT ME!

getElementSize

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

Returns:
DOCUMENT ME!

represent

public java.lang.Object represent(java.lang.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.

Parameters:
value - DOCUMENT ME!
Returns:
DOCUMENT ME!

represent

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

Parameters:
value - DOCUMENT ME!
Returns:
DOCUMENT ME!

represent

public java.lang.Object represent(java.lang.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.

Parameters:
value - DOCUMENT ME!
Returns:
DOCUMENT ME!

represent

public java.lang.Object represent(java.lang.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.

Parameters:
value - DOCUMENT ME!
Returns:
DOCUMENT ME!

represent

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

Parameters:
value - DOCUMENT ME!
Returns:
DOCUMENT ME!

represent

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

Parameters:
value - DOCUMENT ME!
Returns:
DOCUMENT ME!

represent

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

Parameters:
value - DOCUMENT ME!
Returns:
DOCUMENT ME!

represent

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

Parameters:
value - DOCUMENT ME!
Returns:
DOCUMENT ME!

represent

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

Parameters:
value - DOCUMENT ME!
Returns:
DOCUMENT ME!

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.

Returns:
DOCUMENT ME!

scale

public java.lang.Object scale(java.lang.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 java.lang.Object unscale(java.lang.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.