Cdm.java

  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. import java.util.List;

  19. import org.orekit.data.DataContext;
  20. import org.orekit.files.ccsds.ndm.NdmConstituent;
  21. import org.orekit.files.ccsds.ndm.odm.UserDefined;
  22. import org.orekit.utils.IERSConventions;

  23. /**
  24.  * This class stores all the information of the Conjunction Data Message (CDM) File parsed
  25.  * by CdmParser. It contains the header and a list of segments each
  26.  * containing metadata and a list of data lines.
  27.  * @author Melina Vanel
  28.  * @since 11.2
  29.  */
  30. public class Cdm extends NdmConstituent<CdmHeader, CdmSegment> {

  31.     /** Root element for XML files. */
  32.     public static final String ROOT = "cdm";

  33.     /** Key for format version. */
  34.     public static final String FORMAT_VERSION_KEY = "CCSDS_CDM_VERS";

  35.     /** Simple constructor.
  36.      * @param header file header
  37.      * @param segments file segments
  38.      * @param conventions IERS conventions
  39.      * @param dataContext used for creating frames, time scales, etc.
  40.      */
  41.     public Cdm(final CdmHeader header, final List<CdmSegment> segments,
  42.                    final IERSConventions conventions, final DataContext dataContext) {
  43.         super(header, segments, conventions, dataContext);
  44.     }

  45.     /** Get the file metadata.
  46.      * @return file metadata
  47.      */
  48.     public CdmRelativeMetadata getRelativeMetadata() {
  49.         return getSegments().get(0).getMetadata().getRelativeMetadata();
  50.     }

  51.     /** Get the file metadata.
  52.      * @return file metadata
  53.      */
  54.     public CdmMetadata getMetadataObject1() {
  55.         return getSegments().get(0).getMetadata();
  56.     }

  57.     /** Get the file metadata.
  58.      * @return file metadata
  59.      */
  60.     public CdmMetadata getMetadataObject2() {
  61.         return getSegments().get(1).getMetadata();
  62.     }

  63.     /** Get the file data.
  64.      * @return file data
  65.      */
  66.     public CdmData getDataObject1() {
  67.         return getSegments().get(0).getData();
  68.     }

  69.     /** Get the file data.
  70.      * @return file data
  71.      */
  72.     public CdmData getDataObject2() {
  73.         return getSegments().get(1).getData();
  74.     }

  75.     /** Get user defined parameters.
  76.      * <p> This method will return null if the user defined block is not present in the CDM</p>
  77.      * @return file data
  78.      */
  79.     public UserDefined getUserDefinedParameters() {
  80.         return getSegments().get(0).getData().getUserDefinedBlock();
  81.     }

  82. }