nom.tam.fits
Class CardTable

java.lang.Object
  extended bynom.tam.fits.CardTable

class CardTable
extends Object

This class stores a set of FITS header cards.


Constructor Summary
CardTable()
          Create an empty table to hold FITS cards.
CardTable(int initialCapacity, int capacityIncrement)
          Create an empty table to hold FITS cards.
 
Method Summary
 void addElement(HeaderCard card)
          Add the specified card to the end of this table.
 boolean containsKey(String key)
          Tests if the specified keyword is present in this table.
 HeaderCard elementAt(int index)
          Return the card found at the specified index.
 HeaderCard findKey(String key)
          Finds the first occurence of the specified key.
 int indexOf(HeaderCard card)
          Searches for the first occurence of the given card.
 void insertElementAt(HeaderCard card, int index)
          Inserts the specified card at the specified index.
 void removeElementAt(int index)
          Removes the card at the specified index.
 void setElementAt(HeaderCard card, int index)
          Replace the card at the specified index with the specified card.
 int size()
          Returns the number of cards in this table.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CardTable

public CardTable(int initialCapacity,
                 int capacityIncrement)
Create an empty table to hold FITS cards.

Parameters:
initialCapacity - the initial capacity of the table.
capacityIncrement - the amount by which the capacity is increased when the table overflows.

CardTable

public CardTable()
Create an empty table to hold FITS cards.

Method Detail

addElement

public final void addElement(HeaderCard card)
Add the specified card to the end of this table.

Parameters:
card - the card to be added.

elementAt

public final HeaderCard elementAt(int index)
Return the card found at the specified index.

Parameters:
index - an index into this table.
Throws:
ArrayIndexOutOfBoundsException - if an invalid index was given.

indexOf

public final int indexOf(HeaderCard card)
Searches for the first occurence of the given card.

Parameters:
card - the card be found.
Returns:
the index of the first occurrence of the card; returns -1 if the object is not found.

insertElementAt

public final void insertElementAt(HeaderCard card,
                                  int index)
Inserts the specified card at the specified index. The index must be greater than or equal to 0 and less than or equal to the current size of the vector.

Parameters:
card - the card be inserted.
index - where the card should be inserted.
Throws:
ArrayIndexOutOfBoundsException - if the index was invalid.

removeElementAt

public final void removeElementAt(int index)
Removes the card at the specified index. The index must be greater than or equal to 0 and less than or equal to the current size of the vector.

Parameters:
index - of the card to be removed.
Throws:
ArrayIndexOutOfBoundsException - if the index was invalid.

setElementAt

public final void setElementAt(HeaderCard card,
                               int index)
Replace the card at the specified index with the specified card. The index must be greater than or equal to 0 and less than or equal to the current size of the vector.

Parameters:
index - of the card to be replaced.
Throws:
ArrayIndexOutOfBoundsException - if the index was invalid.

size

public final int size()
Returns the number of cards in this table.

Returns:
the number of cards.

findKey

public final HeaderCard findKey(String key)
Finds the first occurence of the specified key.

Parameters:
key - the keyword to be found.
Returns:
the first card matching this keyword; returns -1 if the keyword was not found.

containsKey

public final boolean containsKey(String key)
Tests if the specified keyword is present in this table.

Parameters:
key - the keyword to be found.
Returns:
true if the specified keyword is present in this table; false otherwise.