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  
19  import org.orekit.files.ccsds.utils.lexical.ParseToken;
20  import org.orekit.files.ccsds.utils.lexical.TokenType;
21  
22  /** Keywords for ACM data sub-structure.
23   * @author Luc Maisonobe
24   * @since 12.0
25   */
26  public enum AcmDataSubStructureKey {
27  
28      /** Attitude state time history section. */
29      ATT((token, parser) -> parser.manageAttitudeStateSection(token.getType() == TokenType.START)),
30  
31      /** Trajectory state time history section. */
32      att((token, parser) -> parser.manageAttitudeStateSection(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      /** Attitude determination section. */
53      AD((token, parser) -> parser.manageAttitudeDeterminationSection(token.getType() == TokenType.START)),
54  
55      /** Orbit determination section. */
56      ad((token, parser) -> parser.manageAttitudeDeterminationSection(token.getType() == TokenType.START)),
57  
58      /** User-defined parameters section. */
59      USER((token, parser) -> parser.manageUserDefinedParametersSection(token.getType() == TokenType.START)),
60  
61      /** User-defined parameters section. */
62      user((token, parser) -> parser.manageUserDefinedParametersSection(token.getType() == TokenType.START));
63  
64      /** Processing method. */
65      private final transient TokenProcessor processor;
66  
67      /** Simple constructor.
68       * @param processor processing method
69       */
70      AcmDataSubStructureKey(final TokenProcessor processor) {
71          this.processor = processor;
72      }
73  
74      /** Process one token.
75       * @param token token to process
76       * @param parser ACM file parser
77       * @return true of token was accepted
78       */
79      public boolean process(final ParseToken token, final AcmParser parser) {
80          return processor.process(token, parser);
81      }
82  
83      /** Interface for processing one token. */
84      interface TokenProcessor {
85          /** Process one token.
86           * @param token token to process
87           * @param parser ACM file parser
88           * @return true of token was accepted
89           */
90          boolean process(ParseToken token, AcmParser parser);
91      }
92  
93  }