AttitudeCovarianceHistoryMetadataKey.java

  1. /* Copyright 2022-2025 Luc Maisonobe
  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.adm.acm;

  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. /** Keys for {@link AttitudeCovarianceHistoryMetadata covariance history container} entries.
  22.  * @author Luc Maisonobe
  23.  * @since 12.0
  24.  */
  25. public enum AttitudeCovarianceHistoryMetadataKey {

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

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

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

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

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

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

  39.     /** Covariance element set type.
  40.      * @see AttitudeCovarianceType
  41.      */
  42.     COV_TYPE((token, context, container) -> token.processAsEnum(AttitudeCovarianceType.class, container::setCovType));

  43.     /** Processing method. */
  44.     private final transient TokenProcessor processor;

  45.     /** Simple constructor.
  46.      * @param processor processing method
  47.      */
  48.     AttitudeCovarianceHistoryMetadataKey(final TokenProcessor processor) {
  49.         this.processor = processor;
  50.     }

  51.     /** Process an token.
  52.      * @param token token to process
  53.      * @param context context binding
  54.      * @param container container to fill
  55.      * @return true of token was accepted
  56.      */
  57.     public boolean process(final ParseToken token, final ContextBinding context, final AttitudeCovarianceHistoryMetadata container) {
  58.         return processor.process(token, context, container);
  59.     }

  60.     /** Interface for processing one token. */
  61.     interface TokenProcessor {
  62.         /** Process one token.
  63.          * @param token token to process
  64.          * @param context context binding
  65.          * @param container container to fill
  66.          * @return true of token was accepted
  67.          */
  68.         boolean process(ParseToken token, ContextBinding context, AttitudeCovarianceHistoryMetadata container);
  69.     }

  70. }