1 package nom.tam.fits;
2
3 /*
4 * #%L
5 * nom.tam FITS library
6 * %%
7 * Copyright (C) 2004 - 2024 nom-tam-fits
8 * %%
9 * This is free and unencumbered software released into the public domain.
10 *
11 * Anyone is free to copy, modify, publish, use, compile, sell, or
12 * distribute this software, either in source code form or as a compiled
13 * binary, for any purpose, commercial or non-commercial, and by any
14 * means.
15 *
16 * In jurisdictions that recognize copyright laws, the author or authors
17 * of this software dedicate any and all copyright interest in the
18 * software to the public domain. We make this dedication for the benefit
19 * of the public at large and to the detriment of our heirs and
20 * successors. We intend this dedication to be an overt act of
21 * relinquishment in perpetuity of all present and future rights to this
22 * software under copyright law.
23 *
24 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
25 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
26 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
27 * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
28 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
29 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
30 * OTHER DEALINGS IN THE SOFTWARE.
31 * #L%
32 */
33
34 import nom.tam.fits.header.Standard;
35
36 /**
37 * This class provides a modifiable map in which the comment fields for FITS header keywords produced by this library
38 * are set. The map is a simple String -> String map where the key Strings are normally class:keyword:id where class
39 * is the class name where the keyword is set, keyword is the keyword set and id is an integer used to distinguish
40 * multiple instances. Most users need not worry about this class, but users who wish to customize the appearance of
41 * FITS files may update the map. The code itself is likely to be needed to understand which values in the map must be
42 * modified.
43 *
44 * @deprecated (<i>for internal use</i>) No longer needed
45 */
46 @Deprecated
47 public final class HeaderCommentsMap {
48
49 @SuppressWarnings("javadoc")
50 @Deprecated
51 public static void deleteComment(String key) {
52 key = simplyfyKey(key);
53 for (Standard value : Standard.values()) {
54 value.setCommentByKey(key, "");
55 }
56 }
57
58 @SuppressWarnings("javadoc")
59 @Deprecated
60 public static String getComment(String key) {
61 key = simplyfyKey(key);
62 for (Standard value : Standard.values()) {
63 String comment = value.getCommentByKey(key);
64 if (comment != null) {
65 return comment;
66 }
67 }
68 return null;
69 }
70
71 private static String simplyfyKey(String key) {
72 int firstDbPoint = key.indexOf(':');
73 if (firstDbPoint > 0) {
74 int secondDoublePoint = key.indexOf(':', firstDbPoint + 1);
75 if (secondDoublePoint > 0) {
76 return key.substring(0, secondDoublePoint);
77 }
78 }
79 return key;
80 }
81
82 @SuppressWarnings("javadoc")
83 @Deprecated
84 public static void updateComment(String key, String comment) {
85 key = simplyfyKey(key);
86 for (Standard value : Standard.values()) {
87 value.setCommentByKey(key, comment);
88 }
89 }
90
91 private HeaderCommentsMap() {
92 }
93 }