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  
19  import org.orekit.files.ccsds.utils.lexical.ParseToken;
20  import org.orekit.files.ccsds.utils.lexical.TokenType;
21  
22  /** Keywords for OCM data sub-structure.
23   * @author Luc Maisonobe
24   * @since 11.0
25   */
26  public enum OcmDataSubStructureKey {
27  
28      /** Trajectory state time history section. */
29      TRAJ((token, parser) -> parser.manageTrajectoryStateSection(token.getType() == TokenType.START)),
30  
31      /** Trajectory state time history section. */
32      traj((token, parser) -> parser.manageTrajectoryStateSection(token.getType() == TokenType.START)),
33  
34      /** Physical properties section. */
35      PHYS((token, parser) -> parser.managePhysicalPropertiesSection(token.getType() == TokenType.START)),
36  
37      /** Physical properties section. */
38      phys((token, parser) -> parser.managePhysicalPropertiesSection(token.getType() == TokenType.START)),
39  
40      /** Covariance time history section. */
41      COV((token, parser) -> parser.manageCovarianceHistorySection(token.getType() == TokenType.START)),
42  
43      /** Covariance time history section. */
44      cov((token, parser) -> parser.manageCovarianceHistorySection(token.getType() == TokenType.START)),
45  
46      /** Maneuvers section. */
47      MAN((token, parser) -> parser.manageManeuversSection(token.getType() == TokenType.START)),
48  
49      /** Maneuvers section. */
50      man((token, parser) -> parser.manageManeuversSection(token.getType() == TokenType.START)),
51  
52      /** Perturbations parameters section. */
53      PERT((token, parser) -> parser.managePerturbationParametersSection(token.getType() == TokenType.START)),
54  
55      /** Perturbations parameters section. */
56      pert((token, parser) -> parser.managePerturbationParametersSection(token.getType() == TokenType.START)),
57  
58      /** Orbit determination section. */
59      OD((token, parser) -> parser.manageOrbitDeterminationSection(token.getType() == TokenType.START)),
60  
61      /** Orbit determination section. */
62      od((token, parser) -> parser.manageOrbitDeterminationSection(token.getType() == TokenType.START)),
63  
64      /** User-defined parameters section. */
65      USER((token, parser) -> parser.manageUserDefinedParametersSection(token.getType() == TokenType.START)),
66  
67      /** User-defined parameters section. */
68      user((token, parser) -> parser.manageUserDefinedParametersSection(token.getType() == TokenType.START));
69  
70      /** Processing method. */
71      private final transient TokenProcessor processor;
72  
73      /** Simple constructor.
74       * @param processor processing method
75       */
76      OcmDataSubStructureKey(final TokenProcessor processor) {
77          this.processor = processor;
78      }
79  
80      /** Process one token.
81       * @param token token to process
82       * @param parser OCM file parser
83       * @return true of token was accepted
84       */
85      public boolean process(final ParseToken token, final OcmParser parser) {
86          return processor.process(token, parser);
87      }
88  
89      /** Interface for processing one token. */
90      interface TokenProcessor {
91          /** Process one token.
92           * @param token token to process
93           * @param parser OCM file parser
94           * @return true of token was accepted
95           */
96          boolean process(ParseToken token, OcmParser parser);
97      }
98  
99  }