1 /* Copyright 2002-2026 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.rinex.navigation.parsers.ephemeris;
18
19 import org.orekit.files.rinex.navigation.RinexNavigationParser;
20 import org.orekit.files.rinex.navigation.parsers.ParseInfo;
21 import org.orekit.files.rinex.navigation.parsers.RecordLineParser;
22 import org.orekit.propagation.analytical.gnss.data.AbstractEphemerisMessage;
23
24 /** Parser for abstract ephemeris.
25 * @param <T> type of the ephemeris message
26 * @author Bryan Cazabonne
27 * @author Luc Maisonobe
28 * @since 14.0
29 */
30 public abstract class AbstractEphemerisParser<T extends AbstractEphemerisMessage> extends RecordLineParser {
31
32 /** Container for parsing data. */
33 private final ParseInfo parseInfo;
34
35 /** Container for ephemeris message. */
36 private final T message;
37
38 /** Simple constructor.
39 * @param parseInfo container for parsing data
40 * @param message container for navigation message
41 */
42 protected AbstractEphemerisParser(final ParseInfo parseInfo, final T message) {
43 this.parseInfo = parseInfo;
44 this.message = message;
45 }
46
47 /** Get the container for parsing data.
48 * @return container for parsing data
49 */
50 public ParseInfo getParseInfo() {
51 return parseInfo;
52 }
53
54 /** Get the container for the navigation message.
55 * @return container for the navigation message
56 */
57 public T getMessage() {
58 return message;
59 }
60
61 /** {@inheritDoc} */
62 @Override
63 public void parseLine01() {
64 message.setX(parseInfo.parseDouble1(RinexNavigationParser.KM));
65 message.setXDot(parseInfo.parseDouble2(RinexNavigationParser.KM_PER_S));
66 message.setXDotDot(parseInfo.parseDouble3(RinexNavigationParser.KM_PER_S2));
67 }
68
69 /** {@inheritDoc} */
70 @Override
71 public void parseLine02() {
72 message.setY(parseInfo.parseDouble1(RinexNavigationParser.KM));
73 message.setYDot(parseInfo.parseDouble2(RinexNavigationParser.KM_PER_S));
74 message.setYDotDot(parseInfo.parseDouble3(RinexNavigationParser.KM_PER_S2));
75 }
76
77 /** {@inheritDoc} */
78 @Override
79 public void parseLine03() {
80 message.setZ(parseInfo.parseDouble1(RinexNavigationParser.KM));
81 message.setZDot(parseInfo.parseDouble2(RinexNavigationParser.KM_PER_S));
82 message.setZDotDot(parseInfo.parseDouble3(RinexNavigationParser.KM_PER_S2));
83 }
84
85 }