1 /* Copyright 2002-2024 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.cdm;
18
19 import org.orekit.files.ccsds.utils.ContextBinding;
20 import org.orekit.files.ccsds.utils.lexical.ParseToken;
21 import org.orekit.files.ccsds.utils.lexical.TokenType;
22 import org.orekit.utils.units.Unit;
23
24 /** Keys for {@link AdditionalCovarianceMetadata covariance metadatail y a} entries.
25 */
26 public enum AdditionalCovarianceMetadataKey {
27
28 /** Comment entry. */
29 COMMENT((token, context, container) ->
30 token.getType() == TokenType.ENTRY ? container.addComment(token.getContentAsNormalizedString()) : true),
31
32 /** The atmospheric density forecast error. */
33 DENSITY_FORECAST_UNCERTAINTY((token, context, container) -> token.processAsDouble(Unit.NONE, context.getParsedUnitsBehavior(),
34 container::setDensityForecastUncertainty)),
35
36 /** The minimum suggested covariance scale factor. */
37 CSCALE_FACTOR_MIN((token, context, container) -> token.processAsDouble(Unit.NONE, context.getParsedUnitsBehavior(),
38 container::setcScaleFactorMin)),
39
40 /** The (median) suggested covariance scale factor. */
41 CSCALE_FACTOR((token, context, container) -> token.processAsDouble(Unit.NONE, context.getParsedUnitsBehavior(),
42 container::setcScaleFactor)),
43
44 /** The maximum suggested covariance scale factor. */
45 CSCALE_FACTOR_MAX((token, context, container) -> token.processAsDouble(Unit.NONE, context.getParsedUnitsBehavior(),
46 container::setcScaleFactorMax)),
47
48 /** The source (or origin) of the specific orbital data for this object. */
49 SCREENING_DATA_SOURCE((token, context, container) -> token.processAsFreeTextString(container::setScreeningDataSource)),
50
51 /** The Drag Consider Parameter (DCP) sensitivity vector (position errors at TCA). */
52 DCP_SENSITIVITY_VECTOR_POSITION((token, context, container) -> token.processAsDoubleArray(Unit.NONE, context.getParsedUnitsBehavior(),
53 container::setDcpSensitivityVectorPosition)),
54
55 /** The Drag Consider Parameter (DCP) sensitivity vector (velocity errors at TCA). */
56 DCP_SENSITIVITY_VECTOR_VELOCITY((token, context, container) -> token.processAsDoubleArray(Unit.NONE, context.getParsedUnitsBehavior(),
57 container::setDcpSensitivityVectorVelocity));
58
59 /** Processing method. */
60 private final transient TokenProcessor processor;
61
62 /** Simple constructor.
63 * @param processor processing method
64 */
65 AdditionalCovarianceMetadataKey(final TokenProcessor processor) {
66 this.processor = processor;
67 }
68
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 public boolean process(final ParseToken token, final ContextBinding context, final AdditionalCovarianceMetadata container) {
76 return processor.process(token, context, container);
77 }
78
79 /** Interface for processing one token. */
80 interface TokenProcessor {
81 /** Process one token.
82 * @param token token to process
83 * @param context context binding
84 * @param container container to fill
85 * @return true of token was accepted
86 */
87 boolean process(ParseToken token, ContextBinding context, AdditionalCovarianceMetadata container);
88 }
89
90 }