Begin versioning.
[fits.git] / src / nom / tam / fits / HeaderCommentsMap.java
1 /*
2  * This class provides a modifiable map in which the comment fields for FITS
3  * header keywords
4  * produced by this library are set.  The map is a simple String -> String
5  * map where the key Strings are normally class:keyword:id where class is
6  * the class name where the keyword is set, keyword is the keyword set and id
7  * is an integer used to distinguish multiple instances.
8  *
9  * Most users need not worry about this class, but users who wish to customize
10  * the appearance of FITS files may update the map.  The code itself is likely
11  * to be needed to understand which values in the map must be modified.
12  *
13  * Note that the Header writing utilities look for the prefix ntf:: in comments
14  * and if this is found, the comment is replaced by looking in this map for
15  * a key given by the remainder of the original comment.
16  */
17
18 package nom.tam.fits;
19
20 import java.util.HashMap;
21 import java.util.Map;
22
23 public class HeaderCommentsMap {
24
25     private static Map<String,String> commentMap = new HashMap<String,String>();
26     static {
27         commentMap.put("header:extend:1",      "Extensions are permitted");
28         commentMap.put("header:simple:1",      "Java FITS: "+ new java.util.Date());
29         commentMap.put("header:xtension:1",    "Java FITS: "+ new java.util.Date());
30         commentMap.put("header:naxis:1",       "Dimensionality");
31         commentMap.put("header:extend:2",      "Extensions are permitted");
32         commentMap.put("asciitable:pcount:1",  "No group data");
33         commentMap.put("asciitable:gcount:1",  "One group");
34         commentMap.put("asciitable:tfields:1", "Number of fields in table");
35         commentMap.put("asciitable:tbcolN:1",  "Column offset");
36         commentMap.put("asciitable:naxis1:1",  "Size of row in bytes");
37         commentMap.put("undefineddata:naxis1:1","Number of Bytes");
38         commentMap.put("undefineddata:extend:1","Extensions are permitted");
39         commentMap.put("binarytablehdu:pcount:1", "Includes heap");
40         commentMap.put("binarytable:naxis1:1",  "Bytes per row");
41         commentMap.put("fits:checksum:1",       "as of " + FitsDate.getFitsDateString());
42         commentMap.put("basichdu:extend:1",     "Allow extensions");
43         commentMap.put("basichdu:gcount:1",     "Required value");
44         commentMap.put("basichdu:pcount:1",     "Required value");
45         commentMap.put("imagedata:extend:1",    "Extension permitted");
46         commentMap.put("imagedata:pcount:1",    "No extra parameters");
47         commentMap.put("imagedata:gcount:1",    "One group");
48         commentMap.put("tablehdu:tfields:1",    "Number of table fields");
49    /* Null entries:
50     *      header:bitpix:1
51     *      header:simple:2
52     *      header:bitpix:2
53     *      header:naxisN:1
54     *      header:naxis:2
55     *      undefineddata:pcount:1
56     *      undefineddata:gcount:1
57     *      randomgroupsdata:naxis1:1
58     *      randomgroupsdata:naxisN:1
59     *      randomgroupsdata:groups:1
60     *      randomgroupsdata:gcount:1
61     *      randomgroupsdata:pcount:1
62     *      binarytablehdu:theap:1
63     *      binarytablehdu:tdimN:1
64     *      asciitable:tformN:1
65     *      asciitablehdu:tnullN:1
66     *      asciitablehdu:tfields:1
67     *      binarytable:pcount:1
68     *      binarytable:gcount:1
69     *      binarytable:tfields:1
70     *      binarytable:tformN:1
71     *      binarytable:tdimN:1
72     *      tablehdu:naxis2:1
73     */
74     }
75
76     public static String getComment(String key) {
77         return commentMap.get(key);
78     }
79     
80     public  static void updateComment(String key, String comment) {
81         commentMap.put(key, comment);
82     }
83
84     public static void deleteComment(String key) {
85         commentMap.remove(key);
86     }
87 }