ManeuverKey.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.opm;

  18. import org.orekit.files.ccsds.definitions.Units;
  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. import org.orekit.utils.units.Unit;


  23. /** Keys for {@link Maneuver OPM maneuver} entries.
  24.  * @author Luc Maisonobe
  25.  * @since 11.0
  26.  */
  27. public enum ManeuverKey {

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

  31.     /** Epoch of ignition. */
  32.     MAN_EPOCH_IGNITION((token, context, container) -> token.processAsDate(container::setEpochIgnition, context)),

  33.     /** Coordinate system for velocity increment vector. */
  34.     MAN_REF_FRAME((token, context, container) -> token.processAsFrame(container::setReferenceFrame, context, true, true, false)),

  35.     /** Maneuver duration (0 for impulsive maneuvers). */
  36.     MAN_DURATION((token, context, container) -> token.processAsDouble(Unit.SECOND, context.getParsedUnitsBehavior(),
  37.                                                                       container::setDuration)),

  38.     /** Mass change during maneuver (value is < 0). */
  39.     MAN_DELTA_MASS((token, context, container) -> token.processAsDouble(Unit.KILOGRAM, context.getParsedUnitsBehavior(),
  40.                                                                         container::setDeltaMass)),

  41.     /** First component of the velocity increment. */
  42.     MAN_DV_1((token, context, container) -> token.processAsIndexedDouble(0, Units.KM_PER_S, context.getParsedUnitsBehavior(),
  43.                                                                          container::setDV)),

  44.     /** Second component of the velocity increment. */
  45.     MAN_DV_2((token, context, container) -> token.processAsIndexedDouble(1, Units.KM_PER_S, context.getParsedUnitsBehavior(),
  46.                                                                          container::setDV)),

  47.     /** Third component of the velocity increment. */
  48.     MAN_DV_3((token, context, container) -> token.processAsIndexedDouble(2, Units.KM_PER_S, context.getParsedUnitsBehavior(),
  49.                                                                          container::setDV));

  50.     /** Processing method. */
  51.     private final transient TokenProcessor processor;

  52.     /** Simple constructor.
  53.      * @param processor processing method
  54.      */
  55.     ManeuverKey(final TokenProcessor processor) {
  56.         this.processor = processor;
  57.     }

  58.     /** Process one token.
  59.      * @param token token to process
  60.      * @param context context binding
  61.      * @param container container to fill
  62.      * @return true of token was accepted
  63.      */
  64.     public boolean process(final ParseToken token, final ContextBinding context, final Maneuver container) {
  65.         return processor.process(token, context, container);
  66.     }

  67.     /** Interface for processing one token. */
  68.     interface TokenProcessor {
  69.         /** Process one token.
  70.          * @param token token to process
  71.          * @param context context binding
  72.          * @param container container to fill
  73.          * @return true of token was accepted
  74.          */
  75.         boolean process(ParseToken token, ContextBinding context, Maneuver container);
  76.     }

  77. }