OrbitCovarianceHistoryMetadataKey.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.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 OrbitCovarianceHistoryMetadata covariance history container} entries.
  23.  * @author Luc Maisonobe
  24.  * @since 11.0
  25.  */
  26. public enum OrbitCovarianceHistoryMetadataKey {

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

  30.     /** Covariance identification number. */
  31.     COV_ID((token, context, container) -> token.processAsFreeTextString(container::setCovID)),

  32.     /** Identification number of previous covariance. */
  33.     COV_PREV_ID((token, context, container) -> token.processAsFreeTextString(container::setCovPrevID)),

  34.     /** Identification number of next covariance. */
  35.     COV_NEXT_ID((token, context, container) -> token.processAsFreeTextString(container::setCovNextID)),

  36.     /** Basis of this covariance time history data. */
  37.     COV_BASIS((token, context, container) -> token.processAsFreeTextString(container::setCovBasis)),

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

  40.     /** Reference frame of the covariance. */
  41.     COV_REF_FRAME((token, context, container) -> token.processAsFrame(container::setCovReferenceFrame, context, true, true, false)),

  42.     /** Epoch of the {@link #COV_REF_FRAME covariance reference frame}. */
  43.     COV_FRAME_EPOCH((token, context, container) -> token.processAsDate(container::setCovFrameEpoch, context)),

  44.     /** Minimum scale factor to apply to achieve realism. */
  45.     COV_SCALE_MIN((token, context, container) -> token.processAsDouble(Unit.ONE, context.getParsedUnitsBehavior(),
  46.                                                                        container::setCovScaleMin)),

  47.     /** Maximum scale factor to apply to achieve realism. */
  48.     COV_SCALE_MAX((token, context, container) -> token.processAsDouble(Unit.ONE, context.getParsedUnitsBehavior(),
  49.                                                                        container::setCovScaleMax)),

  50.     /** Masure of confidence in covariance error matching reality. */
  51.     COV_CONFIDENCE((token, context, container) -> token.processAsDouble(Unit.PERCENT, context.getParsedUnitsBehavior(),
  52.                                                                         container::setCovConfidence)),

  53.     /** Covariance element set type.
  54.      * @see OrbitElementsType
  55.      */
  56.     COV_TYPE((token, context, container) -> token.processAsEnum(OrbitElementsType.class, container::setCovType)),

  57.     /** Covariance ordering. */
  58.     COV_ORDERING((token, context, container) -> token.processAsEnum(Ordering.class, container::setCovOrdering)),

  59.     /** SI units for each elements of the covariance. */
  60.     COV_UNITS((token, context, container) -> token.processAsUnitList(container::setCovUnits));

  61.     /** Processing method. */
  62.     private final transient TokenProcessor processor;

  63.     /** Simple constructor.
  64.      * @param processor processing method
  65.      */
  66.     OrbitCovarianceHistoryMetadataKey(final TokenProcessor processor) {
  67.         this.processor = processor;
  68.     }

  69.     /** Process an 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.     public boolean process(final ParseToken token, final ContextBinding context, final OrbitCovarianceHistoryMetadata container) {
  76.         return processor.process(token, context, container);
  77.     }

  78.     /** Interface for processing one token. */
  79.     interface TokenProcessor {
  80.         /** Process one 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.         boolean process(ParseToken token, ContextBinding context, OrbitCovarianceHistoryMetadata container);
  87.     }

  88. }