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

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


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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

  72.     /** Processing method. */
  73.     private final TokenProcessor processor;

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

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

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

  99. }