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  
19  import org.orekit.files.ccsds.utils.ContextBinding;
20  import org.orekit.files.ccsds.utils.lexical.ParseToken;
21  
22  
23  /** Keys for {@link OemMetadata OEM container} entries.
24   * @author Luc Maisonobe
25   * @since 11.0
26   */
27  public enum OemMetadataKey {
28  
29      /** Start time entry. */
30      START_TIME((token, context, container) -> token.processAsDate(container::setStartTime, context)),
31  
32      /** Stop time entry. */
33      STOP_TIME((token, context, container) -> token.processAsDate(container::setStopTime, context)),
34  
35      /** Useable start time entry. */
36      USEABLE_START_TIME((token, context, container) -> token.processAsDate(container::setUseableStartTime, context)),
37  
38      /** Useable stop time entry. */
39      USEABLE_STOP_TIME((token, context, container) -> token.processAsDate(container::setUseableStopTime, context)),
40  
41      /** Interpolation method in ephemeris. */
42      INTERPOLATION((token, context, container) -> token.processAsEnum(InterpolationMethod.class, container::setInterpolationMethod)),
43  
44      /** Interpolation degree in ephemeris. */
45      INTERPOLATION_DEGREE((token, context, container) -> token.processAsInteger(container::setInterpolationDegree));
46  
47      /** Processing method. */
48      private final transient TokenProcessor processor;
49  
50      /** Simple constructor.
51       * @param processor processing method
52       */
53      OemMetadataKey(final TokenProcessor processor) {
54          this.processor = processor;
55      }
56  
57      /** Process an token.
58       * @param token token to process
59       * @param context context binding
60       * @param container container to fill
61       * @return true of token was accepted
62       */
63      public boolean process(final ParseToken token, final ContextBinding context, final OemMetadata container) {
64          return processor.process(token, context, container);
65      }
66  
67      /** Interface for processing one token. */
68      interface TokenProcessor {
69          /** Process one 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          boolean process(ParseToken token, ContextBinding context, OemMetadata container);
76      }
77  
78  }