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.ndm.cdm;
18  
19  import java.util.List;
20  
21  import org.orekit.data.DataContext;
22  import org.orekit.files.ccsds.ndm.NdmConstituent;
23  import org.orekit.files.ccsds.ndm.odm.UserDefined;
24  import org.orekit.utils.IERSConventions;
25  
26  /**
27   * This class stores all the information of the Conjunction Data Message (CDM) File parsed
28   * by CdmParser. It contains the header and a list of segments each
29   * containing metadata and a list of data lines.
30   * @author Melina Vanel
31   * @since 11.2
32   */
33  public class Cdm extends NdmConstituent<CdmHeader, CdmSegment> {
34  
35      /** Root element for XML files. */
36      public static final String ROOT = "cdm";
37  
38      /** Key for format version. */
39      public static final String FORMAT_VERSION_KEY = "CCSDS_CDM_VERS";
40  
41      /** Simple constructor.
42       * @param header file header
43       * @param segments file segments
44       * @param conventions IERS conventions
45       * @param dataContext used for creating frames, time scales, etc.
46       */
47      public Cdm(final CdmHeader header, final List<CdmSegment> segments,
48                     final IERSConventions conventions, final DataContext dataContext) {
49          super(header, segments, conventions, dataContext);
50      }
51  
52      /** Get the file metadata.
53       * @return file metadata
54       */
55      public CdmRelativeMetadata getRelativeMetadata() {
56          return getSegments().get(0).getMetadata().getRelativeMetadata();
57      }
58  
59      /** Get the file metadata.
60       * @return file metadata
61       */
62      public CdmMetadata getMetadataObject1() {
63          return getSegments().get(0).getMetadata();
64      }
65  
66      /** Get the file metadata.
67       * @return file metadata
68       */
69      public CdmMetadata getMetadataObject2() {
70          return getSegments().get(1).getMetadata();
71      }
72  
73      /** Get the file data.
74       * @return file data
75       */
76      public CdmData getDataObject1() {
77          return getSegments().get(0).getData();
78      }
79  
80      /** Get the file data.
81       * @return file data
82       */
83      public CdmData getDataObject2() {
84          return getSegments().get(1).getData();
85      }
86  
87      /** Get user defined parameters.
88       * <p> This method will return null if the user defined block is not present in the CDM</p>
89       * @return file data
90       */
91      public UserDefined getUserDefinedParameters() {
92          return getSegments().get(0).getData().getUserDefinedBlock();
93      }
94  
95  }