1   /* Copyright 2002-2025 CS GROUP
2    * Licensed to CS GROUP (CS) under one or more
3    * contributor license agreements.  See the NOTICE file distributed with
4    * this work for additional information regarding copyright ownership.
5    * CS licenses this file to You under the Apache License, Version 2.0
6    * (the "License"); you may not use this file except in compliance with
7    * the License.  You may obtain a copy of the License at
8    *
9    *   http://www.apache.org/licenses/LICENSE-2.0
10   *
11   * Unless required by applicable law or agreed to in writing, software
12   * distributed under the License is distributed on an "AS IS" BASIS,
13   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14   * See the License for the specific language governing permissions and
15   * limitations under the License.
16   */
17  package org.orekit.files.ccsds.section;
18  
19  import org.orekit.time.AbsoluteDate;
20  
21  /**
22   * Header of a CCSDS Navigation Data Message.
23   * @author Bryan Cazabonne
24   * @since 10.2
25   */
26  public class Header extends CommentsContainer {
27  
28      /** CCSDS Format version. */
29      private double formatVersion;
30  
31      /** Classification. */
32      private String classification;
33  
34      /** Message creation date and time in UTC. */
35      private AbsoluteDate creationDate;
36  
37      /** Creating agency or operator. */
38      private String originator;
39  
40      /** ID that uniquely identifies a message from a given originator. */
41      private String messageId;
42  
43      /** Minimum version for {@link HeaderKey#MESSAGE_ID}. */
44      private final double minVersionMessageId;
45  
46      /** Minimum version for {@link HeaderKey#CLASSIFICATION}. */
47      private final double minVersionClassification;
48  
49      /**
50       * Constructor.
51       * @param minVersionMessageId minimum version for {@link HeaderKey#MESSAGE_ID}
52       * @param minVersionClassification minimum version for {@link HeaderKey#CLASSIFICATION}
53       */
54      public Header(final double minVersionMessageId,
55                    final double minVersionClassification) {
56          this.formatVersion            = Double.NaN;
57          this.minVersionMessageId      = minVersionMessageId;
58          this.minVersionClassification = minVersionClassification;
59      }
60  
61      /** {@inheritDoc} */
62      @Override
63      public void validate(final double version) {
64          super.validate(version);
65          checkNotNull(creationDate, HeaderKey.CREATION_DATE.name());
66          checkNotNull(originator,   HeaderKey.ORIGINATOR.name());
67          checkAllowed(version, messageId,      HeaderKey.MESSAGE_ID.name(),
68                       minVersionMessageId, Double.POSITIVE_INFINITY);
69          checkAllowed(version, classification, HeaderKey.CLASSIFICATION.name(),
70                       minVersionClassification, Double.POSITIVE_INFINITY);
71      }
72  
73      /**
74       * Get the CCSDS NDM (ADM, ODM or TDM) format version.
75       * @return format version
76       */
77      public double getFormatVersion() {
78          return formatVersion;
79      }
80  
81      /**
82       * Set the CCSDS NDM (ADM, ODM or TDM) format version.
83       * @param formatVersion the format version to be set
84       */
85      public void setFormatVersion(final double formatVersion) {
86          this.formatVersion = formatVersion;
87      }
88  
89      /**
90       * Get the classification/caveats.
91       * @return classification/caveats.
92       */
93      public String getClassification() {
94          return classification;
95      }
96  
97      /**
98       * Set the classification/caveats.
99       * @param classification classification/caveats to be set
100      */
101     public void setClassification(final String classification) {
102         refuseFurtherComments();
103         this.classification = classification;
104     }
105 
106     /**
107      * Get the message creation date and time in UTC.
108      * @return the message creation date and time in UTC.
109      */
110     public AbsoluteDate getCreationDate() {
111         return creationDate;
112     }
113 
114     /**
115      * Set the message creation date and time in UTC.
116      * @param creationDate the creation date to be set
117      */
118     public void setCreationDate(final AbsoluteDate creationDate) {
119         refuseFurtherComments();
120         this.creationDate = creationDate;
121     }
122 
123     /**
124      * Get the message originator.
125      * @return originator the message originator.
126      */
127     public String getOriginator() {
128         return originator;
129     }
130 
131     /**
132      * Set the message originator.
133      * @param originator the originator to be set
134      */
135     public void setOriginator(final String originator) {
136         refuseFurtherComments();
137         this.originator = originator;
138     }
139 
140     /**
141      * Get the ID that uniquely identifies a message from a given originator.
142      * @return ID that uniquely identifies a message from a given originator
143      */
144     public String getMessageId() {
145         return messageId;
146     }
147 
148     /**
149      * Set the ID that uniquely identifies a message from a given originator.
150      * @param messageId ID that uniquely identifies a message from a given originator
151      */
152     public void setMessageId(final String messageId) {
153         this.messageId = messageId;
154     }
155 
156 }