AdmMetadata.java

  1. /* Copyright 2002-2022 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.adm;

  18. import org.orekit.bodies.CelestialBodies;
  19. import org.orekit.bodies.CelestialBody;
  20. import org.orekit.files.ccsds.definitions.BodyFacade;
  21. import org.orekit.files.ccsds.section.Metadata;

  22. /** This class gathers the meta-data present in the Attitude Data Message (ADM).
  23.  * @author Bryan Cazabonne
  24.  * @since 10.2
  25.  */
  26. public class AdmMetadata extends Metadata {

  27.     /** Spacecraft name for which the attitude data are provided. */
  28.     private String objectName;

  29.     /** Object identifier of the object for which the attitude data are provided. */
  30.     private String objectID;

  31.     /** Body at origin of reference frame. */
  32.     private BodyFacade center;

  33.     /** Simple constructor.
  34.      */
  35.     public AdmMetadata() {
  36.         super(null);
  37.     }

  38.     /** {@inheritDoc} */
  39.     @Override
  40.     public void validate(final double version) {
  41.         super.validate(version);
  42.         checkNotNull(objectName, AdmMetadataKey.OBJECT_NAME);
  43.         checkNotNull(objectID,   AdmMetadataKey.OBJECT_ID);
  44.     }

  45.     /**
  46.      * Get the spacecraft name for which the attitude data are provided.
  47.      * @return the spacecraft name
  48.      */
  49.     public String getObjectName() {
  50.         return objectName;
  51.     }

  52.     /**
  53.      * Set the spacecraft name for which the attitude data are provided.
  54.      * @param objectName the spacecraft name to be set
  55.      */
  56.     public void setObjectName(final String objectName) {
  57.         refuseFurtherComments();
  58.         this.objectName = objectName;
  59.     }

  60.     /**
  61.      * Get the spacecraft ID for which the attitude data are provided.
  62.      * @return the spacecraft ID
  63.      */
  64.     public String getObjectID() {
  65.         return objectID;
  66.     }

  67.     /**
  68.      * Set the spacecraft ID for which the attitude data are provided.
  69.      * @param objectID the spacecraft ID to be set
  70.      */
  71.     public void setObjectID(final String objectID) {
  72.         refuseFurtherComments();
  73.         this.objectID = objectID;
  74.     }

  75.     /** Get the launch year.
  76.      * @return launch year
  77.      */
  78.     public int getLaunchYear() {
  79.         return getLaunchYear(objectID);
  80.     }

  81.     /** Get the launch number.
  82.      * @return launch number
  83.      */
  84.     public int getLaunchNumber() {
  85.         return getLaunchNumber(objectID);
  86.     }

  87.     /** Get the piece of launch.
  88.      * @return piece of launch
  89.      */
  90.     public String getLaunchPiece() {
  91.         return getLaunchPiece(objectID);
  92.     }

  93.     /** Get the body at origin of reference frame.
  94.      * @return the body at origin of reference frame.
  95.      */
  96.     public BodyFacade getCenter() {
  97.         return center;
  98.     }

  99.     /** Set the body at origin of reference frame.
  100.      * @param center body at origin of reference frame
  101.      */
  102.     public void setCenter(final BodyFacade center) {
  103.         refuseFurtherComments();
  104.         this.center = center;
  105.     }

  106.     /**
  107.      * Get boolean testing whether the body corresponding to the centerName
  108.      * attribute can be created through the {@link CelestialBodies}.
  109.      * @return true if {@link CelestialBody} can be created from centerName
  110.      *         false otherwise
  111.      */
  112.     public boolean getHasCreatableBody() {
  113.         return center != null && center.getBody() != null;
  114.     }

  115. }