Package nom.tam.fits
Class HeaderCardBuilder
- java.lang.Object
-
- nom.tam.fits.HeaderCardBuilder
-
public class HeaderCardBuilder extends java.lang.Object
builder pattern implementation for easy readable header card creation.
-
-
Field Summary
Fields Modifier and Type Field Description private HeaderCard
card
the current card to fill.private Header
header
the header to fill.private IFitsHeader
key
the current selected key.private int
scale
scale to use for decimal values.
-
Constructor Summary
Constructors Modifier Constructor Description protected
HeaderCardBuilder(Header header, IFitsHeader key)
constructor to the header card builder.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description HeaderCard
card()
get the current build card of the builder.HeaderCardBuilder
card(IFitsHeader newKey)
switch focus to the card with the specified key.HeaderCardBuilder
comment(java.lang.String newComment)
set the comment of the current card.Header
header()
HeaderCardBuilder
noScale()
use no scale for the following decimal values.HeaderCardBuilder
scale(int newScale)
set the scale for the following decimal values.HeaderCardBuilder
value(boolean newValue)
set the value of the current card.If the card did not exist yet the card will be created.HeaderCardBuilder
value(double newValue)
set the value of the current card.If the card did not exist yet the card will be created.HeaderCardBuilder
value(float newValue)
set the value of the current card.If the card did not exist yet the card will be created.HeaderCardBuilder
value(int newValue)
set the value of the current card.If the card did not exist yet the card will be created.HeaderCardBuilder
value(long newValue)
set the value of the current card.If the card did not exist yet the card will be created.HeaderCardBuilder
value(java.lang.String newValue)
set the value of the current card.If the card did not exist yet the card will be created.HeaderCardBuilder
value(java.math.BigDecimal newValue)
set the value of the current card.If the card did not exist yet the card will be created.HeaderCardBuilder
value(java.util.Date newValue)
set the value of the current card.
-
-
-
Field Detail
-
header
private final Header header
the header to fill.
-
card
private HeaderCard card
the current card to fill.
-
key
private IFitsHeader key
the current selected key.
-
scale
private int scale
scale to use for decimal values.
-
-
Constructor Detail
-
HeaderCardBuilder
protected HeaderCardBuilder(Header header, IFitsHeader key)
constructor to the header card builder.- Parameters:
header
- the header to fill.key
- the first header card to set.
-
-
Method Detail
-
card
public HeaderCard card()
get the current build card of the builder.- Returns:
- the current card
-
card
public HeaderCardBuilder card(IFitsHeader newKey)
switch focus to the card with the specified key. If the card does not exist the card will be created when the value or the comment is set.- Parameters:
newKey
- the new card to set- Returns:
- this
-
comment
public HeaderCardBuilder comment(java.lang.String newComment) throws HeaderCardException
set the comment of the current card. If the card does not exist yet the card is created with a null value, if the card needs a value use the value setter first!- Parameters:
newComment
- the new comment to set.- Returns:
- this
- Throws:
HeaderCardException
- if the card creation failed.
-
value
public HeaderCardBuilder value(boolean newValue) throws HeaderCardException
set the value of the current card.If the card did not exist yet the card will be created.- Parameters:
newValue
- the new value to set.- Returns:
- this
- Throws:
HeaderCardException
- if the card creation failed.
-
value
public HeaderCardBuilder value(java.util.Date newValue) throws HeaderCardException
set the value of the current card. If the card did not exist yet the card will be created.- Parameters:
newValue
- the new value to set.- Returns:
- this
- Throws:
HeaderCardException
- if the card creation failed.
-
value
public HeaderCardBuilder value(double newValue) throws HeaderCardException
set the value of the current card.If the card did not exist yet the card will be created.- Parameters:
newValue
- the new value to set.- Returns:
- this
- Throws:
HeaderCardException
- if the card creation failed.
-
value
public HeaderCardBuilder value(java.math.BigDecimal newValue) throws HeaderCardException
set the value of the current card.If the card did not exist yet the card will be created.- Parameters:
newValue
- the new value to set.- Returns:
- this
- Throws:
HeaderCardException
- if the card creation failed.
-
value
public HeaderCardBuilder value(float newValue) throws HeaderCardException
set the value of the current card.If the card did not exist yet the card will be created.- Parameters:
newValue
- the new value to set.- Returns:
- this
- Throws:
HeaderCardException
- if the card creation failed.
-
value
public HeaderCardBuilder value(int newValue) throws HeaderCardException
set the value of the current card.If the card did not exist yet the card will be created.- Parameters:
newValue
- the new value to set.- Returns:
- this
- Throws:
HeaderCardException
- if the card creation failed.
-
value
public HeaderCardBuilder value(long newValue) throws HeaderCardException
set the value of the current card.If the card did not exist yet the card will be created.- Parameters:
newValue
- the new value to set.- Returns:
- this
- Throws:
HeaderCardException
- if the card creation failed.
-
value
public HeaderCardBuilder value(java.lang.String newValue) throws HeaderCardException
set the value of the current card.If the card did not exist yet the card will be created.- Parameters:
newValue
- the new value to set.- Returns:
- this
- Throws:
HeaderCardException
- if the card creation failed.
-
scale
public HeaderCardBuilder scale(int newScale)
set the scale for the following decimal values.- Parameters:
newScale
- the new scale to use- Returns:
- this
-
noScale
public HeaderCardBuilder noScale()
use no scale for the following decimal values.- Returns:
- this
-
header
public Header header()
- Returns:
- the filled header.
-
-