Class FitsKey
- All Implemented Interfaces:
Serializable
,IFitsHeader
- Direct Known Subclasses:
FitsHeaderImpl
A concrete implementation of standardized FITS header keywords. Users may instantiate this class or extend it to define commonly used keywords for their applications, and benefit for the extra checks they afford, and to avoid typos when using these.
FITS keywords must be composed of uppper-case 'A'-'Z', digits, underscore ('_') and hyphen ('-') characters. Additionally, lower case 'n' may be used as a place-holder for a numerical index, and the keyword name may end with a lower-case 'a' to indicate that it may be used for/with alternate WCS coordinate systems. (We also allow '/' because some STScI keywords use it even though it violates the FITS standard.)
- Since:
- 1.19
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface nom.tam.fits.header.IFitsHeader
IFitsHeader.HDU, IFitsHeader.SOURCE, IFitsHeader.VALUE
-
Field Summary
Fields inherited from interface nom.tam.fits.header.IFitsHeader
MAX_INDEX
-
Constructor Summary
ConstructorDescriptionFitsKey
(String headerName, IFitsHeader.HDU hdu, IFitsHeader.VALUE valueType, String comment) Creates a new standardized user-defined FITS keyword.FitsKey
(String headerName, IFitsHeader.SOURCE status, IFitsHeader.HDU hdu, IFitsHeader.VALUE valueType, String comment) Creates a new standardized FITS keyword with the specific usage constraints.FitsKey
(String headerName, IFitsHeader.VALUE valueType, String comment) Creates a new standardized user-defined FITS keyword. -
Method Summary
Modifier and TypeMethodDescriptioncomment()
Returns the comment associated to this FITS header entry.hdu()
Returns the type of HDU(s) in which this header entry may be used.final FitsKey
impl()
(primarily for internal use) Returns the concrete implementation of this header entry, which provides implementation of access methods.static boolean
isCommentStyleKey
(String key) (for internal use) Checks if a keywords is known to be a comment-style keyword.key()
Returns the FITS header keyword (or keyword template) for this header entry.status()
Returns the standard convention, which defines this FITS header entryThe type(s) of value(s) this FITS header entry might take.Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface nom.tam.fits.header.IFitsHeader
extractIndices, n
-
Constructor Details
-
FitsKey
public FitsKey(String headerName, IFitsHeader.SOURCE status, IFitsHeader.HDU hdu, IFitsHeader.VALUE valueType, String comment) throws IllegalArgumentException Creates a new standardized FITS keyword with the specific usage constraints. The keyword must be composed of uppper-case 'A'-'Z', digits, underscore ('_') and hyphen ('-') characters. Additionally, lower case 'n' may be used as a place-holder for a numerical index, and the keyword name may end with a lower-case 'a' to indicate that it may be used for/with alternate WCS coordinate systems. (We also allow '/' because some STScI keywords use it even though it violates the FITS standard.)- Parameters:
headerName
- The keyword as it will appear in the FITS headers, usually a string with up to 8 characters, containing uppper case letters (A-Z), digits (0-9), and/or underscore (_
) or hyphen (-
) characters for standard FITS keywords.status
- The convention that defines this keywordhdu
- the type of HDU this keyword may appear invalueType
- the type of value that may be associated with this keywordcomment
- the standard comment to include with this keyword- Throws:
IllegalArgumentException
- if the keyword name is invalid.
-
FitsKey
public FitsKey(String headerName, IFitsHeader.HDU hdu, IFitsHeader.VALUE valueType, String comment) throws IllegalArgumentException Creates a new standardized user-defined FITS keyword. The keyword will have source set toIFitsHeader.SOURCE.UNKNOWN
. The keyword must be composed of uppper-case 'A'-'Z', digits, underscore ('_') and hyphen ('-') characters. Additionally, lower case 'n' may be used as a place-holder for a numerical index, and the keyword name may end with a lower-case 'a' to indicate that it may be used for/with alternate WCS coordinate systems. (We also allow '/' because some STScI keywords use it even though it violates the FITS standard.)- Parameters:
headerName
- The keyword as it will appear in the FITS headers, usually a string with up to 8 characters, containing uppper case letters (A-Z), digits (0-9), and/or underscore (_
) or hyphen (-
) characters for standard FITS keywords.hdu
- the type of HDU this keyword may appear invalueType
- the type of value that may be associated with this keywordcomment
- the standard comment to include with this keyword- Throws:
IllegalArgumentException
- if the keyword name is invalid.- Since:
- 1.19
-
FitsKey
public FitsKey(String headerName, IFitsHeader.VALUE valueType, String comment) throws IllegalArgumentException Creates a new standardized user-defined FITS keyword. The keyword will have source set toIFitsHeader.SOURCE.UNKNOWN
and HDY type toIFitsHeader.HDU.ANY
. The keyword must be composed of uppper-case 'A'-'Z', digits, underscore ('_') and hyphen ('-') characters. Additionally, lower case 'n' may be used as a place-holder for a numerical index, and the keyword name may end with a lower-case 'a' to indicate that it may be used for/with alternate WCS coordinate systems. (We also allow '/' because some STScI keywords use it even though it violates the FITS standard.)- Parameters:
headerName
- The keyword as it will appear in the FITS headers, usually a string with up to 8 characters, containing uppper case letters (A-Z), digits (0-9), and/or underscore (_
) or hyphen (-
) characters for standard FITS keywords.valueType
- the type of value that may be associated with this keywordcomment
- the standard comment to include with this keyword- Throws:
IllegalArgumentException
- if the keyword name is invalid.- Since:
- 1.19
-
-
Method Details
-
impl
Description copied from interface:IFitsHeader
(primarily for internal use) Returns the concrete implementation of this header entry, which provides implementation of access methods.- Specified by:
impl
in interfaceIFitsHeader
- Returns:
- the implementation of this keyword, which provides the actual access methods. Implementations of this interface should simply return themselves.
-
comment
Description copied from interface:IFitsHeader
Returns the comment associated to this FITS header entry. The comment is entirely optional, and it may not be appear in full (or at all) in the FITS header. Comments should thus never contain essential information. Their purpose is only to provide non-essential extra information for human use.- Specified by:
comment
in interfaceIFitsHeader
- Returns:
- the associated standard comment.
- See Also:
-
hdu
Description copied from interface:IFitsHeader
Returns the type of HDU(s) in which this header entry may be used.- Specified by:
hdu
in interfaceIFitsHeader
- Returns:
- the HDU type(s) that this keyword may support.
-
key
Description copied from interface:IFitsHeader
Returns the FITS header keyword (or keyword template) for this header entry. Standard FITS keywords are limited to 8 characters, and contain only epper-case letters, numbers, hyphen, and underscore characters. Lower-case 'n' characters may be included as placeholders for indexing conventions that must be filled before the keyword may be used in headers and/or header cards.
- Specified by:
key
in interfaceIFitsHeader
- Returns:
- the FITS header keyword for this entry. The returned keyword may include an indexing pattern (lower-case
'n' characters), which may need to be filled via
IFitsHeader.n(int...)
before the keyword may be used to construct header cards or be used in FITS headers. (Alternative coordinate markers, via lower case 'a' at the end of the keyword definition, are stripped and should not be included in the returned keyword name pattern.) - See Also:
-
status
Description copied from interface:IFitsHeader
Returns the standard convention, which defines this FITS header entry- Specified by:
status
in interfaceIFitsHeader
- Returns:
- the standard or convention that specifies this FITS heacer keyword
-
valueType
Description copied from interface:IFitsHeader
The type(s) of value(s) this FITS header entry might take.- Specified by:
valueType
in interfaceIFitsHeader
- Returns:
- the value type(s) for this FITS header entry
-
isCommentStyleKey
(for internal use) Checks if a keywords is known to be a comment-style keyword. That is, it checks if thekey
argument matches anyIFitsHeader
constructed via this implementation with avalueType
argument that wasnull
, or if the key is empty.- Parameters:
key
- the keyword to check- Returns:
true
if the key is empty or if it matches any knownIFitsHeader
keywords implemented through this class that have valueType ofnull
. Otherwisefalse
.- Since:
- 1.17
-