spv.spectrum
Class SpectrumHeader

java.lang.Object
  extended by spv.spectrum.SpectrumHeader
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable

public class SpectrumHeader
extends java.lang.Object
implements java.lang.Cloneable, java.io.Serializable

Stores header information.

This version uses a Hashtable object to store header keywords indexed by the keyword name. Thus the original keyword ordering is not preserved upon retrieval.

If the header came from a FITS header object, this FITS header object is also stored in raw form. Support for a "double header" spectrum is also provided.his is useful e.g. when handling spectra stored in FITS extensions with their own header, plus the primary header that applies to the entire file.

Version:
1.0 - 17Feb98, 2.0 - 03Apr02, 2.1 - 08Feb05
Author:
Ivo Busko (Space Telescope Science Institute)
See Also:
Serialized Form

Field Summary
private static java.util.List beggining
           
private static java.lang.String[] beggining_keywords
           
private static java.lang.String COMMENT
           
private  java.util.ArrayList comment_storage
           
private  java.util.ArrayList fits_header_array
           
private static java.lang.String HISTORY
           
private  java.util.ArrayList history_storage
           
private  KeyedVector kw_storage
           
 
Constructor Summary
SpectrumHeader()
          Constructor.
SpectrumHeader(nom.tam.fits.Header fits_header)
          Constructor.
SpectrumHeader(nom.tam.fits.Header fits_header_1, nom.tam.fits.Header fits_header_2)
          Constructor.
 
Method Summary
 void addHistory(java.lang.String record)
          Adds an HISTORY record to the header.
private  void buildFromFitsHeader(nom.tam.fits.Header fits_header)
          Populates the keyword storage with keyword/value pairs taken from a single fits header object.
private  void buildFromFitsHeaderArray()
          Populates the keyword storage with keyword/value pairs taken from the array with fits header objects.
 javax.swing.JTextArea buildJTextArea()
          Builds a JTextArea instance with a raw image of the \ header cards.
protected  java.lang.Object clone()
          Returns a clone copy of this object.
 nom.tam.fits.Header getFITSHeader()
          Generates a FITS header from this header.
 java.util.Enumeration getKeywordList()
          Returns an Enumeration with keyword names.
 java.lang.String getKeywordValue(java.lang.String kwname)
          Given the keyword name, returns the keyword value, or null if there is no such keyword name.
 java.lang.String getLongString()
          Dumps the contents (cards) of a FITS header into a String object.
static java.lang.String GetTargetNameKeyword()
          Returns the keyword used to store the target name.
private  boolean isBeginningKeyword(java.lang.String keyword)
           
private  boolean isTableColumnKeyword(java.lang.String keyword)
           
 void remove(java.lang.String key)
          Remove an element.
 void store(java.lang.String kwname, java.lang.String value)
          Stores a keyword and its value.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

COMMENT

private static final java.lang.String COMMENT
See Also:
Constant Field Values

HISTORY

private static final java.lang.String HISTORY
See Also:
Constant Field Values

beggining_keywords

private static final java.lang.String[] beggining_keywords

beggining

private static java.util.List beggining

fits_header_array

private java.util.ArrayList fits_header_array

kw_storage

private KeyedVector kw_storage

comment_storage

private java.util.ArrayList comment_storage

history_storage

private java.util.ArrayList history_storage
Constructor Detail

SpectrumHeader

public SpectrumHeader()
Constructor.


SpectrumHeader

public SpectrumHeader(nom.tam.fits.Header fits_header)
Constructor.

Parameters:
fits_header - the FITS header associated with this.

SpectrumHeader

public SpectrumHeader(nom.tam.fits.Header fits_header_1,
                      nom.tam.fits.Header fits_header_2)
Constructor. This form of constructor is used in cases e.g. when a spectrum is stored in a FITS extension, and we want to append the extension header to the primary header.

Parameters:
fits_header_1 - the first FITS header associated with this.
fits_header_2 - the second FITS header associated with this.
Method Detail

store

public void store(java.lang.String kwname,
                  java.lang.String value)
Stores a keyword and its value.

COMMENT and HISTORY keywords are also accepted.

Parameters:
kwname - the keyword name
value - the keyword value

remove

public void remove(java.lang.String key)
Remove an element.


addHistory

public void addHistory(java.lang.String record)
Adds an HISTORY record to the header. The supplied record is ammended with version and time information.

Parameters:
record - the record to be added

getKeywordValue

public java.lang.String getKeywordValue(java.lang.String kwname)
Given the keyword name, returns the keyword value, or null if there is no such keyword name. This method returns a new String instance, not a reference to the stored object.

Parameters:
kwname - the keyword name
Returns:
the keyword value

getKeywordList

public java.util.Enumeration getKeywordList()
Returns an Enumeration with keyword names.

Returns:
the Enumeration with keyword names

buildJTextArea

public javax.swing.JTextArea buildJTextArea()
Builds a JTextArea instance with a raw image of the \ header cards.

We use a text area instead of more capable components such as text panes due to the ability of JTextArea objects to append strings. FITS header cards must be appended one by one into the component.

Returns:
a TextArea instance with the header image

getLongString

public java.lang.String getLongString()
Dumps the contents (cards) of a FITS header into a String object.


buildFromFitsHeaderArray

private void buildFromFitsHeaderArray()
Populates the keyword storage with keyword/value pairs taken from the array with fits header objects.


buildFromFitsHeader

private void buildFromFitsHeader(nom.tam.fits.Header fits_header)
Populates the keyword storage with keyword/value pairs taken from a single fits header object.


getFITSHeader

public nom.tam.fits.Header getFITSHeader()
Generates a FITS header from this header.

Keywords that describe table columns ("TTYPE", "TFORM", "TUNIT") are NOT included in the result.

Returns:
the FITS header

isBeginningKeyword

private boolean isBeginningKeyword(java.lang.String keyword)

isTableColumnKeyword

private boolean isTableColumnKeyword(java.lang.String keyword)

GetTargetNameKeyword

public static java.lang.String GetTargetNameKeyword()
Returns the keyword used to store the target name.

Returns:
the keyword used to store the target name

clone

protected java.lang.Object clone()
                          throws java.lang.CloneNotSupportedException
Returns a clone copy of this object.

Overrides:
clone in class java.lang.Object
Returns:
the clone
Throws:
java.lang.CloneNotSupportedException