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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

  62.     /** Processing method. */
  63.     private final TokenProcessor processor;

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

  70.     /** Process an token.
  71.      * @param token token to process
  72.      * @param context context binding
  73.      * @param container container to fill
  74.      * @return true of token was accepted
  75.      */
  76.     public boolean process(final ParseToken token, final ContextBinding context, final CovarianceHistoryMetadata container) {
  77.         return processor.process(token, context, container);
  78.     }

  79.     /** Interface for processing one token. */
  80.     interface TokenProcessor {
  81.         /** Process one token.
  82.          * @param token token to process
  83.          * @param context context binding
  84.          * @param container container to fill
  85.          * @return true of token was accepted
  86.          */
  87.         boolean process(ParseToken token, ContextBinding context, CovarianceHistoryMetadata container);
  88.     }

  89. }