org.eso.fits
Class FitsKeyword

java.lang.Object
  extended by org.eso.fits.FitsKeyword

public class FitsKeyword
extends java.lang.Object

FitsKeyword class describes a single FITS header keyword as defined by the FITS standard (ref. NOST-1.2). The implementation also support the hierarchical keyword convension as defined by the ESO Data Interface Control Board. The name of a keyword is converted to uppercase and different hierarchical levels are separated by '.' i.e. the keyword 'HIERARCH ESO TEL NAME =' will get the name 'ESO.TEL.NAME'.


Field Summary
static int BOOLEAN
           
static int COMMENT
           
static int DATE
           
static int INTEGER
           
static int NONE
           
static int REAL
           
static int STRING
           
 
Constructor Summary
FitsKeyword(byte[] card)
          Constructor for FitsKeyword class from a 80 character byte array.
FitsKeyword(java.lang.String card)
          Constructor for FitsKeyword class from String.
FitsKeyword(java.lang.String name, boolean value, java.lang.String comment)
          Constructor for FitsKeyword class specifying name, value and comment for a boolean keyword.
FitsKeyword(java.lang.String name, java.util.Date value, java.lang.String comment)
          Constructor for FitsKeyword class specifying name, value and comment for a date keyword.
FitsKeyword(java.lang.String name, double value, java.lang.String comment)
          Constructor for FitsKeyword class specifying name, value and comment for a real keyword.
FitsKeyword(java.lang.String name, int value, java.lang.String comment)
          Constructor for FitsKeyword class specifying name, value and comment for an integer keyword.
FitsKeyword(java.lang.String name, java.lang.String comment)
          Constructor for FitsKeyword class specifying name and comment for a comment keyword'
FitsKeyword(java.lang.String name, java.lang.String value, java.lang.String comment)
          Constructor for FitsKeyword class specifying name, value and comment for a string keyword.
 
Method Summary
 boolean getBool()
          Method provides the value of a FITS keyword as boolean.
 java.lang.String getComment()
          Get method to obtain comment of FITS keyword.
 java.util.Date getDate()
          Method provides the value of a FITS keyword as a Date object for keywords of type DATE.
 int getInt()
          Method provides the value of a FITS keyword as integer for keyword types INTEGER and REAL.
 java.lang.String getName()
          Get method to provide name of FITS keyword.
 double getReal()
          Method provides the value of a FITS keyword as double for keyword types INTEGER and REAL.
 java.lang.String getString()
          Method provides the value of a FITS keyword as a String.
 int getType()
          Get method to provide type of FITS keyword.
 boolean isEmpty()
          Check if FITS keyword is empty that is has all blank (' ') name and comment.
 boolean isModified()
          Check if the FITS keyword was modified since it was created from a FITS header card.
 boolean isValueTruncated()
          Check if the keyword name or value fields were truncated by the last call of the toString method.
 void setComment(java.lang.String comment)
          Set comment field of a FITS keyword
 void setName(java.lang.String name)
          Set name of FITS keyword.
 void setValue(boolean value)
          Set value field for keyword of BOOLEAN type.
 void setValue(java.util.Date value)
          Set value field for keyword of DATE type.
 void setValue(double value)
          Set value field for keyword of REAL type.
 void setValue(int value)
          Set value field for keyword of INTEGER type.
 void setValue(java.lang.String value)
          Set value field for keyword of STRING type.
 java.lang.String toString()
          Method generates an 80 character Sting of the keyword in FITS format.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

NONE

public static final int NONE
See Also:
Constant Field Values

COMMENT

public static final int COMMENT
See Also:
Constant Field Values

STRING

public static final int STRING
See Also:
Constant Field Values

BOOLEAN

public static final int BOOLEAN
See Also:
Constant Field Values

INTEGER

public static final int INTEGER
See Also:
Constant Field Values

REAL

public static final int REAL
See Also:
Constant Field Values

DATE

public static final int DATE
See Also:
Constant Field Values
Constructor Detail

FitsKeyword

public FitsKeyword(byte[] card)
            throws FitsException
Constructor for FitsKeyword class from a 80 character byte array.

Parameters:
card - byte array with 80 characters FITS header card
Throws:
FitsException

FitsKeyword

public FitsKeyword(java.lang.String card)
            throws FitsException
Constructor for FitsKeyword class from String.

Parameters:
card - String with 80 characters FITS header card
Throws:
FitsException

FitsKeyword

public FitsKeyword(java.lang.String name,
                   java.lang.String comment)
Constructor for FitsKeyword class specifying name and comment for a comment keyword'

Parameters:
name - String with name of keyword
comment - String with keyword comment

FitsKeyword

public FitsKeyword(java.lang.String name,
                   java.lang.String value,
                   java.lang.String comment)
Constructor for FitsKeyword class specifying name, value and comment for a string keyword.

Parameters:
name - String with name of keyword
value - String value of keyword
comment - String with keyword comment

FitsKeyword

public FitsKeyword(java.lang.String name,
                   boolean value,
                   java.lang.String comment)
Constructor for FitsKeyword class specifying name, value and comment for a boolean keyword.

Parameters:
name - String with name of keyword
value - boolean value of keyword
comment - String with keyword comment

FitsKeyword

public FitsKeyword(java.lang.String name,
                   int value,
                   java.lang.String comment)
Constructor for FitsKeyword class specifying name, value and comment for an integer keyword.

Parameters:
name - String with name of keyword
value - int value of keyword
comment - String with keyword comment

FitsKeyword

public FitsKeyword(java.lang.String name,
                   double value,
                   java.lang.String comment)
Constructor for FitsKeyword class specifying name, value and comment for a real keyword.

Parameters:
name - String with name of keyword
value - double value of keyword
comment - String with keyword comment

FitsKeyword

public FitsKeyword(java.lang.String name,
                   java.util.Date value,
                   java.lang.String comment)
Constructor for FitsKeyword class specifying name, value and comment for a date keyword.

Parameters:
name - String with name of keyword
value - Date value of keyword
comment - String with keyword comment
Method Detail

getBool

public final boolean getBool()
Method provides the value of a FITS keyword as boolean. For INTEGER type keywords, all none-zero values will return true. The method returns FALSE for all keyword types other than BOOLEAN, REAL and INTEGER.


getInt

public final int getInt()
Method provides the value of a FITS keyword as integer for keyword types INTEGER and REAL. Zero is returned for all other types.


getReal

public final double getReal()
Method provides the value of a FITS keyword as double for keyword types INTEGER and REAL. Zero is returned for all other types.


getDate

public final java.util.Date getDate()
Method provides the value of a FITS keyword as a Date object for keywords of type DATE. For STRING type keywords the string is converted to a Date if possible otherwise a NULL pointer is returned.


getString

public final java.lang.String getString()
Method provides the value of a FITS keyword as a String. If not value field is defined NULL is returned.


setValue

public final void setValue(java.lang.String value)
Set value field for keyword of STRING type. Note: the keyword type will be changed to STRING.

Parameters:
value - String with value of keyword value field

setValue

public final void setValue(boolean value)
Set value field for keyword of BOOLEAN type. Note: the keyword type will be changed to BOOLEAN.

Parameters:
value - booelan with value of keyword value field

setValue

public final void setValue(int value)
Set value field for keyword of INTEGER type. Note: the keyword type will be changed to INTEGER.

Parameters:
value - integer with value of keyword value field

setValue

public final void setValue(double value)
Set value field for keyword of REAL type. Note: the keyword type will be changed to REAL.

Parameters:
value - double with value of keyword value field

setValue

public final void setValue(java.util.Date value)
Set value field for keyword of DATE type. Note: the keyword type will be changed to DATE.

Parameters:
value - double with value of keyword value field

toString

public java.lang.String toString()
Method generates an 80 character Sting of the keyword in FITS format. Note: fields may be truncated due the the 80 char. limit.

Overrides:
toString in class java.lang.Object

isValueTruncated

public boolean isValueTruncated()
Check if the keyword name or value fields were truncated by the last call of the toString method.


isEmpty

public boolean isEmpty()
Check if FITS keyword is empty that is has all blank (' ') name and comment.


isModified

public boolean isModified()
Check if the FITS keyword was modified since it was created from a FITS header card.


getName

public java.lang.String getName()
Get method to provide name of FITS keyword.


setName

public void setName(java.lang.String name)
Set name of FITS keyword.


getType

public int getType()
Get method to provide type of FITS keyword.


getComment

public java.lang.String getComment()
Get method to obtain comment of FITS keyword.


setComment

public void setComment(java.lang.String comment)
Set comment field of a FITS keyword

Parameters:
comment - String with the keyword comment.