OemMetadataKey.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.oem;

  18. import org.orekit.files.ccsds.utils.ContextBinding;
  19. import org.orekit.files.ccsds.utils.lexical.ParseToken;


  20. /** Keys for {@link OemMetadata OEM container} entries.
  21.  * @author Luc Maisonobe
  22.  * @since 11.0
  23.  */
  24. public enum OemMetadataKey {

  25.     /** Start time entry. */
  26.     START_TIME((token, context, container) -> token.processAsDate(container::setStartTime, context)),

  27.     /** Stop time entry. */
  28.     STOP_TIME((token, context, container) -> token.processAsDate(container::setStopTime, context)),

  29.     /** Useable start time entry. */
  30.     USEABLE_START_TIME((token, context, container) -> token.processAsDate(container::setUseableStartTime, context)),

  31.     /** Useable stop time entry. */
  32.     USEABLE_STOP_TIME((token, context, container) -> token.processAsDate(container::setUseableStopTime, context)),

  33.     /** Interpolation method in ephemeris. */
  34.     INTERPOLATION((token, context, container) -> token.processAsEnum(InterpolationMethod.class, container::setInterpolationMethod)),

  35.     /** Interpolation degree in ephemeris. */
  36.     INTERPOLATION_DEGREE((token, context, container) -> token.processAsInteger(container::setInterpolationDegree));

  37.     /** Processing method. */
  38.     private final transient TokenProcessor processor;

  39.     /** Simple constructor.
  40.      * @param processor processing method
  41.      */
  42.     OemMetadataKey(final TokenProcessor processor) {
  43.         this.processor = processor;
  44.     }

  45.     /** Process an token.
  46.      * @param token token to process
  47.      * @param context context binding
  48.      * @param container container to fill
  49.      * @return true of token was accepted
  50.      */
  51.     public boolean process(final ParseToken token, final ContextBinding context, final OemMetadata container) {
  52.         return processor.process(token, context, container);
  53.     }

  54.     /** Interface for processing one token. */
  55.     interface TokenProcessor {
  56.         /** Process one token.
  57.          * @param token token to process
  58.          * @param context context binding
  59.          * @param container container to fill
  60.          * @return true of token was accepted
  61.          */
  62.         boolean process(ParseToken token, ContextBinding context, OemMetadata container);
  63.     }

  64. }