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.estimation.measurements.gnss;
18
19 import java.util.ArrayList;
20 import java.util.HashMap;
21 import java.util.List;
22 import java.util.Map;
23 import org.orekit.gnss.GnssSignal;
24 import org.orekit.time.AbsoluteDate;
25
26 /**
27 * This class is used to contains all the data computed within cycle-slip detector.
28 * All these parameters are what user can get from the detectors.
29 * @author David Soulard
30 * @since 10.2
31 */
32 public class CycleSlipDetectorResults {
33
34 /** Integer corresponding to the PRN number of the satellite. */
35 private String satellite;
36
37 /** Date from which for this satellite cycle-slip detection begins. */
38 private Map<GnssSignal, AbsoluteDate> begin;
39
40 /** Date up to which for this satellite cycle-slip detection is valid. */
41 private Map<GnssSignal, AbsoluteDate> end;
42
43 /** List of date at which cycle slip occurs. */
44 private Map<GnssSignal, List<AbsoluteDate>> results;
45
46 /**
47 * Constructor.
48 * @param satellite name of the satellite considered: "system - PRN" (e.g. "GPS - 07" for the satellite GPS 7.
49 * @param date current date
50 * @param signal signal corresponding to the measurements.
51 */
52 CycleSlipDetectorResults(final String satellite, final AbsoluteDate date, final GnssSignal signal) {
53 this.begin = new HashMap<>();
54 this.end = new HashMap<>();
55 this.results = new HashMap<>();
56 this.satellite = satellite;
57 begin.put(signal, date);
58 end.put(signal, date);
59 results.put(signal, new ArrayList<>());
60 }
61
62 /**
63 * Get the satellite name.
64 * @return satellite name
65 */
66 public String getSatelliteName() {
67 return satellite;
68 }
69
70 /**
71 * Return the end date at the given frequency.
72 * <p>
73 * For dual-Frequency cycle-slip detector, the {@link GnssSignal} contained
74 * in the map is the higher frequency (e.g. for L1-L2 the signal in the map will be L1)
75 * </p>
76 * @param signal frequency
77 * @return date of end of validity of the detectors
78 */
79 public AbsoluteDate getEndDate(final GnssSignal signal) {
80 return end.get(signal);
81 }
82
83 /**
84 * Return the date of validity beginning of the detector.
85 * @param signal frequency
86 * @return AbsoluteDate
87 */
88 public AbsoluteDate getBeginDate(final GnssSignal signal) {
89 return begin.get(signal);
90 }
91
92 /**
93 * Get the cycle slip Map with contains the results.
94 * <p>
95 * For dual-Frequency cycle-slip detector, the {@link GnssSignal} contained
96 * in the map is the higher frequency (e.g. for L1-L2 the signal in the map will be L1)
97 * </p>
98 * @return cycle slip map containing the results
99 */
100 public Map<GnssSignal, List<AbsoluteDate>> getCycleSlipMap() {
101 return results;
102 }
103
104 /**
105 * Add a new cycle-slip date into the Map for the given signal.
106 * @param signal signal of the measurement used to detect the cycle-slip
107 * @param date date of the cycle-slip detected.
108 */
109 void addCycleSlipDate(final GnssSignal signal, final AbsoluteDate date) {
110 final List<AbsoluteDate> newList = results.get(signal);
111 newList.add(date);
112 results.put(signal, newList);
113 }
114
115 /**
116 * Knowing the satellite already exist, adding data for another signal.
117 * @param signal signal corresponding to the data
118 * @param date date of measurement
119 */
120 void addAtOtherFrequency(final GnssSignal signal, final AbsoluteDate date) {
121 begin.put(signal, date);
122 end.put(signal, date);
123 results.put(signal, new ArrayList<>());
124 }
125
126 /**
127 * Setter for the ending data.
128 * @param signal signal at which the measurement at current date is taken.
129 * @param date new date of end
130 */
131 void setDate(final GnssSignal signal, final AbsoluteDate date) {
132 end.put(signal, date);
133 }
134
135 }