ODParametersKey.java

  1. /* Copyright 2002-2023 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 org.orekit.files.ccsds.utils.ContextBinding;
  19. import org.orekit.files.ccsds.utils.lexical.ParseToken;
  20. import org.orekit.files.ccsds.utils.lexical.TokenType;
  21. import org.orekit.utils.units.Unit;

  22. /** Keys for {@link ODParameters CDM OD parameters} entries.
  23.  * @author Melina Vanel
  24.  * @since 11.2
  25.  */
  26. public enum ODParametersKey {

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

  30.     /** The start of a time interval (UTC) that contains the time of the last accepted observation. */
  31.     TIME_LASTOB_START((token, context, container) -> token.processAsDate(container::setTimeLastObsStart, context)),

  32.     /** The start of a time interval (UTC) that contains the time of the last accepted observation. */
  33.     TIME_LASTOB_END((token, context, container) -> token.processAsDate(container::setTimeLastObsEnd, context)),

  34.     /** The recommended OD time span calculated for the object. */
  35.     RECOMMENDED_OD_SPAN((token, context, container) -> token.processAsDouble(Unit.DAY, context.getParsedUnitsBehavior(),
  36.                                                                              container::setRecommendedOdSpan)),

  37.     /** Based on the observations available and the RECOMMENDED_OD_SPAN, the actual time span used for the OD of the object. */
  38.     ACTUAL_OD_SPAN((token, context, container) -> token.processAsDouble(Unit.DAY, context.getParsedUnitsBehavior(),
  39.                                                                              container::setActualOdSpan)),

  40.     /** The number of observations available for the OD of the object. */
  41.     OBS_AVAILABLE((token, context, container) -> token.processAsInteger(container::setObsAvailable)),

  42.     /** The number of observations accepted for the OD of the object. */
  43.     OBS_USED((token, context, container) -> token.processAsInteger(container::setObsUsed)),

  44.     /** The number of sensor tracks available for the OD of the object. */
  45.     TRACKS_AVAILABLE((token, context, container) -> token.processAsInteger(container::setTracksAvailable)),

  46.     /** The number of sensor tracks accepted for the OD of the object. */
  47.     TRACKS_USED((token, context, container) -> token.processAsInteger(container::setTracksUsed)),

  48.     /** The percentage of residuals accepted in the OD of the object (from 0 to 100). */
  49.     RESIDUALS_ACCEPTED((token, context, container) -> token.processAsDouble(Unit.PERCENT, context.getParsedUnitsBehavior(),
  50.                                                                              container::setResidualsAccepted)),

  51.     /** The weighted Root Mean Square (RMS) of the residuals from a batch least squares OD. */
  52.     WEIGHTED_RMS((token, context, container) -> token.processAsDouble(Unit.ONE, context.getParsedUnitsBehavior(),
  53.                                                                              container::setWeightedRMS)),

  54.     /** The epoch of the orbit determination used for this message (UTC). */
  55.     OD_EPOCH((token, context, container) -> token.processAsDate(container::setOdEpoch, context));


  56.     /** Processing method. */
  57.     private final TokenProcessor processor;

  58.     /** Simple constructor.
  59.      * @param processor processing method
  60.      */
  61.     ODParametersKey(final TokenProcessor processor) {
  62.         this.processor = processor;
  63.     }

  64.     /** Process one token.
  65.      * @param token token to process
  66.      * @param context context binding
  67.      * @param container container to fill
  68.      * @return true of token was accepted
  69.      */
  70.     public boolean process(final ParseToken token, final ContextBinding context, final ODParameters container) {
  71.         return processor.process(token, context, container);
  72.     }

  73.     /** Interface for processing one token. */
  74.     interface TokenProcessor {
  75.         /** Process one token.
  76.          * @param token token to process
  77.          * @param context context binding
  78.          * @param container container to fill
  79.          * @return true of token was accepted
  80.          */
  81.         boolean process(ParseToken token, ContextBinding context, ODParameters container);
  82.     }

  83. }