TrajectoryStateHistoryMetadataKey.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.odm.ocm;

  18. import org.orekit.files.ccsds.ndm.odm.oem.InterpolationMethod;
  19. import org.orekit.files.ccsds.utils.ContextBinding;
  20. import org.orekit.files.ccsds.utils.lexical.ParseToken;
  21. import org.orekit.files.ccsds.utils.lexical.TokenType;


  22. /** Keys for {@link TrajectoryStateHistoryMetadata rajectory state history container} entries.
  23.  * @author Luc Maisonobe
  24.  * @since 11.0
  25.  */
  26. public enum TrajectoryStateHistoryMetadataKey {

  27.     /** Comment entry. */
  28.     COMMENT((token, context, container) ->
  29.             token.getType() == TokenType.ENTRY ? container.addComment(token.getContentAsNormalizedString()) : true),

  30.     /** Trajectory identification number. */
  31.     TRAJ_ID((token, context, container) -> token.processAsFreeTextString(container::setTrajID)),

  32.     /** Identification number of previous trajectory. */
  33.     TRAJ_PREV_ID((token, context, container) -> token.processAsFreeTextString(container::setTrajPrevID)),

  34.     /** Identification number of next trajectory. */
  35.     TRAJ_NEXT_ID((token, context, container) -> token.processAsFreeTextString(container::setTrajNextID)),

  36.     /** Basis of this trajectory state time history data. */
  37.     TRAJ_BASIS((token, context, container) -> token.processAsFreeTextString(container::setTrajBasis)),

  38.     /** Identification number of the orbit determination or simulation upon which this trajectory is based.*/
  39.     TRAJ_BASIS_ID((token, context, container) -> token.processAsFreeTextString(container::setTrajBasisID)),

  40.     /** Interpolation method to be used. */
  41.     INTERPOLATION((token, context, container) -> token.processAsEnum(InterpolationMethod.class, container::setInterpolationMethod)),

  42.     /** Interpolation degree. */
  43.     INTERPOLATION_DEGREE((token, context, container) -> token.processAsInteger(container::setInterpolationDegree)),

  44.     /** Orbit propagator used to generate this trajectory.
  45.      * @since 11.2
  46.      */
  47.     PROPAGATOR((token, context, container) -> token.processAsFreeTextString(container::setPropagator)),

  48.     /** Origin of the reference frame of the trajectory. */
  49.     CENTER_NAME((token, context, container) -> token.processAsCenter(container::setCenter,
  50.                                                                      context.getDataContext().getCelestialBodies())),

  51.     /** Reference frame of the trajectory. */
  52.     TRAJ_REF_FRAME((token, context, container) -> token.processAsFrame(container::setTrajReferenceFrame, context, true, false, false)),

  53.     /** Epoch of the {@link #TRAJ_REF_FRAME trajectory reference frame}. */
  54.     TRAJ_FRAME_EPOCH((token, context, container) -> token.processAsDate(container::setTrajFrameEpoch, context)),

  55.     /** Useable start time entry. */
  56.     USEABLE_START_TIME((token, context, container) -> token.processAsDate(container::setUseableStartTime, context)),

  57.     /** Useable stop time entry. */
  58.     USEABLE_STOP_TIME((token, context, container) -> token.processAsDate(container::setUseableStopTime, context)),

  59.     /** Integer orbit revolution number entry. */
  60.     ORB_REVNUM((token, context, container) -> token.processAsInteger(container::setOrbRevNum)),

  61.     /** Basis for orbit revolution number entry. */
  62.     ORB_REVNUM_BASIS((token, context, container) -> token.processAsInteger(container::setOrbRevNumBasis)),

  63.     /** Type of averaging (Osculating, mean Brouwer, other...). */
  64.     ORB_AVERAGING((token, context, container) -> token.processAsFreeTextString(container::setOrbAveraging)),

  65.     /** Trajectory element set type.
  66.      * @see OrbitElementsType
  67.      */
  68.     TRAJ_TYPE((token, context, container) -> token.processAsEnum(OrbitElementsType.class, container::setTrajType)),

  69.     /** SI units for each elements of the trajectory state. */
  70.     TRAJ_UNITS((token, context, container) -> token.processAsUnitList(container::setTrajUnits));

  71.     /** Processing method. */
  72.     private final transient TokenProcessor processor;

  73.     /** Simple constructor.
  74.      * @param processor processing method
  75.      */
  76.     TrajectoryStateHistoryMetadataKey(final TokenProcessor processor) {
  77.         this.processor = processor;
  78.     }

  79.     /** Process an token.
  80.      * @param token token to process
  81.      * @param context context binding
  82.      * @param container container to fill
  83.      * @return true of token was accepted
  84.      */
  85.     public boolean process(final ParseToken token, final ContextBinding context, final TrajectoryStateHistoryMetadata container) {
  86.         return processor.process(token, context, container);
  87.     }

  88.     /** Interface for processing one token. */
  89.     interface TokenProcessor {
  90.         /** Process one token.
  91.          * @param token token to process
  92.          * @param context context binding
  93.          * @param container container to fill
  94.          * @return true of token was accepted
  95.          */
  96.         boolean process(ParseToken token, ContextBinding context, TrajectoryStateHistoryMetadata container);
  97.     }

  98. }