1   /* Copyright 2022-2026 Luc Maisonobe
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  
18  package org.orekit.files.ccsds.ndm.adm.acm;
19  
20  import java.util.Optional;
21  
22  import org.orekit.annotation.Nullable;
23  import org.orekit.files.ccsds.definitions.FrameFacade;
24  import org.orekit.files.ccsds.section.CommentsContainer;
25  
26  /** Metadata for covariance history.
27   * <p>
28   * Beware that the Orekit getters and setters all rely on SI units. The parsers
29   * and writers take care of converting these SI units into CCSDS mandatory units.
30   * The {@link org.orekit.utils.units.Unit Unit} class provides useful
31   * {@link org.orekit.utils.units.Unit#fromSI(double) fromSi} and
32   * {@link org.orekit.utils.units.Unit#toSI(double) toSI} methods in case the callers
33   * already use CCSDS units instead of the API SI units. The general-purpose
34   * {@link org.orekit.utils.units.Unit Unit} class (without an 's') and the
35   * CCSDS-specific {@link org.orekit.files.ccsds.definitions.Units Units} class
36   * (with an 's') also provide some predefined units. These predefined units and the
37   * {@link org.orekit.utils.units.Unit#fromSI(double) fromSi} and
38   * {@link org.orekit.utils.units.Unit#toSI(double) toSI} conversion methods are indeed
39   * what the parsers and writers use for the conversions.
40   * </p>
41   * @author Luc Maisonobe
42   * @since 12.0
43   */
44  public class AttitudeCovarianceHistoryMetadata extends CommentsContainer {
45  
46      /** Covariance identification number. */
47      @Nullable
48      private String covID;
49  
50      /** Identification number of previous covariance. */
51      @Nullable
52      private String covPrevID;
53  
54      /** Basis of this covariance time history data. */
55      @Nullable
56      private String covBasis;
57  
58      /** Identification number of the covariance determination or simulation upon which this covariance is based. */
59      @Nullable
60      private String covBasisID;
61  
62      /** Reference frame of the covariance. */
63      @Nullable
64      private FrameFacade covReferenceFrame;
65  
66      /** Covariance element set type. */
67      private AttitudeCovarianceType covType;
68  
69      /** Empty constructor.
70       * <p>
71       * This constructor is not strictly necessary, but it prevents spurious
72       * javadoc warnings with JDK 18 and later.
73       * </p>
74       * @since 12.0
75       */
76      public AttitudeCovarianceHistoryMetadata() {
77          // nothing to do
78      }
79  
80      /** {@inheritDoc} */
81      @Override
82      public void validate(final double version) {
83          super.validate(version);
84          checkNotNull(covType, AttitudeCovarianceHistoryMetadataKey.COV_TYPE.name());
85      }
86  
87      /** Get covariance identification number.
88       * @return covariance identification number
89       */
90      public Optional<String> getCovID() {
91          return Optional.ofNullable(covID);
92      }
93  
94      /** Set covariance identification number.
95       * @param covID covariance identification number
96       */
97      public void setCovID(final String covID) {
98          refuseFurtherComments();
99          this.covID = covID;
100     }
101 
102     /** Get identification number of previous covariance.
103      * @return identification number of previous covariance
104      */
105     public Optional<String> getCovPrevID() {
106         return Optional.ofNullable(covPrevID);
107     }
108 
109     /** Set identification number of previous covariance.
110      * @param covPrevID identification number of previous covariance
111      */
112     public void setCovPrevID(final String covPrevID) {
113         refuseFurtherComments();
114         this.covPrevID = covPrevID;
115     }
116 
117     /** Get basis of this covariance time history data.
118      * @return basis of this covariance time history data
119      */
120     public Optional<String> getCovBasis() {
121         return Optional.ofNullable(covBasis);
122     }
123 
124     /** Set basis of this covariance time history data.
125      * @param covBasis basis of this covariance time history data
126      */
127     public void setCovBasis(final String covBasis) {
128         refuseFurtherComments();
129         this.covBasis = covBasis;
130     }
131 
132     /** Get identification number of the orbit determination or simulation upon which this covariance is based.
133      * @return identification number of the orbit determination or simulation upon which this covariance is based
134      */
135     public Optional<String> getCovBasisID() {
136         return Optional.ofNullable(covBasisID);
137     }
138 
139     /** Set identification number of the orbit determination or simulation upon which this covariance is based.
140      * @param covBasisID identification number of the orbit determination or simulation upon which this covariance is based
141      */
142     public void setCovBasisID(final String covBasisID) {
143         refuseFurtherComments();
144         this.covBasisID = covBasisID;
145     }
146 
147     /** Get reference frame of the covariance.
148      * @return reference frame of the covariance
149      */
150     public Optional<FrameFacade> getCovReferenceFrame() {
151         return Optional.ofNullable(covReferenceFrame);
152     }
153 
154     /** Set reference frame of the covariance.
155      * @param covReferenceFrame the reference frame to be set
156      */
157     public void setCovReferenceFrame(final FrameFacade covReferenceFrame) {
158         refuseFurtherComments();
159         this.covReferenceFrame = covReferenceFrame;
160     }
161 
162     /** Get covariance element set type.
163      * @return covariance element set type
164      */
165     public AttitudeCovarianceType getCovType() {
166         return covType;
167     }
168 
169     /** Set covariance element set type.
170      * @param covType covariance element set type
171      */
172     public void setCovType(final AttitudeCovarianceType covType) {
173         refuseFurtherComments();
174         this.covType = covType;
175     }
176 
177 }