TdmMetadataKey.java

  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.tdm;

  18. import org.orekit.files.ccsds.definitions.Units;
  19. import org.orekit.files.ccsds.utils.ContextBinding;
  20. import org.orekit.files.ccsds.utils.lexical.ParseToken;
  21. import org.orekit.utils.units.Unit;


  22. /** Keys for {@link TdmMetadata TDM container} entries.
  23.  * @author Maxime Journot
  24.  * @since 11.0
  25.  */
  26. public enum TdmMetadataKey {

  27.     /** Identifier for the tracking data. */
  28.     TRACK_ID((token, context, container) -> token.processAsNormalizedString(container::setTrackId)),

  29.     /** Lit of data types in the data section. */
  30.     DATA_TYPES((token, context, container) -> token.processAsEnumsList(ObservationType.class, container::setDataTypes)),

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

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

  35.     /** First participant entry. */
  36.     PARTICIPANT_1((token, context, container) -> token.processAsIndexedNormalizedString(1, container::addParticipant)),

  37.     /** Second participant entry. */
  38.     PARTICIPANT_2((token, context, container) -> token.processAsIndexedNormalizedString(2, container::addParticipant)),

  39.     /** Third participant entry. */
  40.     PARTICIPANT_3((token, context, container) -> token.processAsIndexedNormalizedString(3, container::addParticipant)),

  41.     /** Fourth participant entry. */
  42.     PARTICIPANT_4((token, context, container) -> token.processAsIndexedNormalizedString(4, container::addParticipant)),

  43.     /** Fifth participant entry. */
  44.     PARTICIPANT_5((token, context, container) -> token.processAsIndexedNormalizedString(5, container::addParticipant)),

  45.     /** Mode entry. */
  46.     MODE((token, context, container) -> token.processAsEnum(TrackingMode.class, container::setMode)),

  47.     /** Path entry. */
  48.     PATH((token, context, container) -> token.processAsIntegerArrayNoSpace(container::setPath)),

  49.     /** Path 1 entry. */
  50.     PATH_1((token, context, container) -> token.processAsIntegerArrayNoSpace(container::setPath1)),

  51.     /** Path 2 entry. */
  52.     PATH_2((token, context, container) -> token.processAsIntegerArrayNoSpace(container::setPath2)),

  53.     /** External ephemeris file for the participant 1. */
  54.     EPHEMERIS_NAME_1((token, context, container) -> token.processAsIndexedNormalizedString(1, container::addEphemerisName)),

  55.     /** External ephemeris file for the participant 2. */
  56.     EPHEMERIS_NAME_2((token, context, container) -> token.processAsIndexedNormalizedString(2, container::addEphemerisName)),

  57.     /** External ephemeris file for the participant 3. */
  58.     EPHEMERIS_NAME_3((token, context, container) -> token.processAsIndexedNormalizedString(3, container::addEphemerisName)),

  59.     /** External ephemeris file for the participant 4. */
  60.     EPHEMERIS_NAME_4((token, context, container) -> token.processAsIndexedNormalizedString(4, container::addEphemerisName)),

  61.     /** External ephemeris file for the participant 5. */
  62.     EPHEMERIS_NAME_5((token, context, container) -> token.processAsIndexedNormalizedString(5, container::addEphemerisName)),

  63.     /** Transmit band entry. */
  64.     TRANSMIT_BAND((token, context, container) -> token.processAsUppercaseString(container::setTransmitBand)),

  65.     /** Receive band entry. */
  66.     RECEIVE_BAND((token, context, container) -> token.processAsUppercaseString(container::setReceiveBand)),

  67.     /** Turnaround numerator entry. */
  68.     TURNAROUND_NUMERATOR((token, context, container) -> token.processAsInteger(container::setTurnaroundNumerator)),

  69.     /** turnaround denominator entry. */
  70.     TURNAROUND_DENOMINATOR((token, context, container) -> token.processAsInteger(container::setTurnaroundDenominator)),

  71.     /** Timetag reference entry. */
  72.     TIMETAG_REF((token, context, container) -> token.processAsEnum(TimetagReference.class, container::setTimetagRef)),

  73.     /** Integration interval entry. */
  74.     INTEGRATION_INTERVAL((token, context, container) -> token.processAsDouble(Unit.SECOND, context.getParsedUnitsBehavior(),
  75.                                                                               container::setIntegrationInterval)),

  76.     /** Integration reference entry. */
  77.     INTEGRATION_REF((token, context, container) -> token.processAsEnum(IntegrationReference.class, container::setIntegrationRef)),

  78.     /** Frequency offset entry. */
  79.     FREQ_OFFSET((token, context, container) -> token.processAsDouble(Unit.HERTZ, context.getParsedUnitsBehavior(),
  80.                                                                      container::setFreqOffset)),

  81.     /** Range mode entry. */
  82.     RANGE_MODE((token, context, container) -> token.processAsEnum(RangeMode.class, container::setRangeMode)),

  83.     /** Range modulus entry (beware the unit is Range Units here). */
  84.     RANGE_MODULUS((token, context, container) -> token.processAsDouble(Unit.ONE, context.getParsedUnitsBehavior(),
  85.                                                                        container::setRawRangeModulus)),

  86.     /** Range units entry. */
  87.     RANGE_UNITS((token, context, container) -> token.processAsEnum(RangeUnits.class, container::setRangeUnits)),

  88.     /** Angle type entry. */
  89.     ANGLE_TYPE((token, context, container) -> token.processAsEnum(AngleType.class, container::setAngleType)),

  90.     /** reference frame entry. */
  91.     REFERENCE_FRAME((token, context, container) -> token.processAsFrame(container::setReferenceFrame, context, true, false, false)),

  92.     /** Interpolation method for transmit phase count. */
  93.     INTERPOLATION((token, context, container) -> token.processAsUppercaseString(container::setInterpolationMethod)),

  94.     /** Interpolation degree for transmit phase count. */
  95.     INTERPOLATION_DEGREE((token, context, container) -> token.processAsInteger(container::setInterpolationDegree)),

  96.     /** Bias that was added to Doppler count in the data section. */
  97.     DOPPLER_COUNT_BIAS((token, context, container) -> token.processAsDouble(Unit.HERTZ, context.getParsedUnitsBehavior(),
  98.                                                                             container::setDopplerCountBias)),

  99.     /** Scaled by which Doppler count was multiplied in the data section. */
  100.     DOPPLER_COUNT_SCALE((token, context, container) -> token.processAsDouble(Unit.ONE, context.getParsedUnitsBehavior(),
  101.                                                                             container::setDopplerCountScale)),

  102.     /** Indicator for occurred rollover in Doppler count. */
  103.     DOPPLER_COUNT_ROLLOVER((token, context, container) -> token.processAsBoolean(container::setDopplerCountRollover)),

  104.     /** First transmit delay entry. */
  105.     TRANSMIT_DELAY_1((token, context, container) -> token.processAsIndexedDouble(1, Unit.SECOND, context.getParsedUnitsBehavior(),
  106.                                                                                  container::addTransmitDelay)),

  107.     /** Second transmit delay entry. */
  108.     TRANSMIT_DELAY_2((token, context, container) -> token.processAsIndexedDouble(2, Unit.SECOND, context.getParsedUnitsBehavior(),
  109.                                                                                  container::addTransmitDelay)),

  110.     /** Third transmit delay entry. */
  111.     TRANSMIT_DELAY_3((token, context, container) -> token.processAsIndexedDouble(3, Unit.SECOND, context.getParsedUnitsBehavior(),
  112.                                                                                  container::addTransmitDelay)),

  113.     /** Fourth transmit delay entry. */
  114.     TRANSMIT_DELAY_4((token, context, container) -> token.processAsIndexedDouble(4, Unit.SECOND, context.getParsedUnitsBehavior(),
  115.                                                                                  container::addTransmitDelay)),

  116.     /** Fifth transmit delay entry. */
  117.     TRANSMIT_DELAY_5((token, context, container) -> token.processAsIndexedDouble(5, Unit.SECOND, context.getParsedUnitsBehavior(),
  118.                                                                                  container::addTransmitDelay)),

  119.     /** First receive delay entry. */
  120.     RECEIVE_DELAY_1((token, context, container) -> token.processAsIndexedDouble(1, Unit.SECOND, context.getParsedUnitsBehavior(),
  121.                                                                                 container::addReceiveDelay)),

  122.     /** Second receive delay entry. */
  123.     RECEIVE_DELAY_2((token, context, container) -> token.processAsIndexedDouble(2, Unit.SECOND, context.getParsedUnitsBehavior(),
  124.                                                                                 container::addReceiveDelay)),

  125.     /** Third receive delay entry. */
  126.     RECEIVE_DELAY_3((token, context, container) -> token.processAsIndexedDouble(3, Unit.SECOND, context.getParsedUnitsBehavior(),
  127.                                                                                 container::addReceiveDelay)),

  128.     /** Fourth receive delay entry. */
  129.     RECEIVE_DELAY_4((token, context, container) -> token.processAsIndexedDouble(4, Unit.SECOND, context.getParsedUnitsBehavior(),
  130.                                                                                 container::addReceiveDelay)),

  131.     /** Fifth receive delay entry. */
  132.     RECEIVE_DELAY_5((token, context, container) -> token.processAsIndexedDouble(5, Unit.SECOND, context.getParsedUnitsBehavior(),
  133.                                                                                 container::addReceiveDelay)),

  134.     /** data quality entry. */
  135.     DATA_QUALITY((token, context, container) -> token.processAsEnum(DataQuality.class, container::setDataQuality)),

  136.     /** Angle 1 correction entry. */
  137.     CORRECTION_ANGLE_1((token, context, container) -> token.processAsDouble(Unit.DEGREE, context.getParsedUnitsBehavior(),
  138.                                                                             container::setCorrectionAngle1)),

  139.     /** Angle 2 correction entry. */
  140.     CORRECTION_ANGLE_2((token, context, container) -> token.processAsDouble(Unit.DEGREE, context.getParsedUnitsBehavior(),
  141.                                                                             container::setCorrectionAngle2)),

  142.     /** Doppler correction entry. */
  143.     CORRECTION_DOPPLER((token, context, container) -> token.processAsDouble(Units.KM_PER_S, context.getParsedUnitsBehavior(),
  144.                                                                             container::setCorrectionDoppler)),

  145.     /** Magnitude correction entry. */
  146.     CORRECTION_MAG((token, context, container) -> token.processAsDouble(Unit.ONE, context.getParsedUnitsBehavior(),
  147.                                                                         container::setCorrectionMagnitude)),

  148.     /** Range correction entry (beware the unit is Range Units here). */
  149.     CORRECTION_RANGE((token, context, container) -> token.processAsDouble(Unit.ONE, context.getParsedUnitsBehavior(),
  150.                                                                           container::setRawCorrectionRange)),

  151.     /** Radar Cross Section correction entry. */
  152.     CORRECTION_RCS((token, context, container) -> token.processAsDouble(Units.M2, context.getParsedUnitsBehavior(),
  153.                                                                         container::setCorrectionRcs)),

  154.     /** Receive correction entry. */
  155.     CORRECTION_RECEIVE((token, context, container) -> token.processAsDouble(Unit.HERTZ, context.getParsedUnitsBehavior(),
  156.                                                                             container::setCorrectionReceive)),

  157.     /** Transmit correction entry. */
  158.     CORRECTION_TRANSMIT((token, context, container) -> token.processAsDouble(Unit.HERTZ, context.getParsedUnitsBehavior(),
  159.                                                                              container::setCorrectionTransmit)),

  160.     /** Yearly aberration correction entry. */
  161.     CORRECTION_ABERRATION_YEARLY((token, context, container) -> token.processAsDouble(Unit.DEGREE, context.getParsedUnitsBehavior(),
  162.                                                                                       container::setCorrectionAberrationYearly)),

  163.     /** Diurnal aberration correction entry. */
  164.     CORRECTION_ABERRATION_DIURNAL((token, context, container) -> token.processAsDouble(Unit.DEGREE, context.getParsedUnitsBehavior(),
  165.                                                                                        container::setCorrectionAberrationDiurnal)),

  166.     /** Applied correction entry. */
  167.     CORRECTIONS_APPLIED((token, context, container) -> token.processAsEnum(CorrectionApplied.class, container::setCorrectionsApplied));

  168.     /** Processing method. */
  169.     private final transient TokenProcessor processor;

  170.     /** Simple constructor.
  171.      * @param processor processing method
  172.      */
  173.     TdmMetadataKey(final TokenProcessor processor) {
  174.         this.processor = processor;
  175.     }

  176.     /** Process an token.
  177.      * @param token token to process
  178.      * @param context context binding
  179.      * @param container container to fill
  180.      * @return true if token was accepted
  181.      */
  182.     public boolean process(final ParseToken token, final ContextBinding context, final TdmMetadata container) {
  183.         return processor.process(token, context, container);
  184.     }

  185.     /** Interface for processing one token. */
  186.     interface TokenProcessor {
  187.         /** Process one token.
  188.          * @param token token to process
  189.          * @param context context binding
  190.          * @param container container to fill
  191.      * @return true if token was accepted
  192.          */
  193.         boolean process(ParseToken token, ContextBinding context, TdmMetadata container);
  194.     }

  195. }