CycleSlipDetectorResults.java

  1. /* Copyright 2002-2020 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. import java.util.ArrayList;
  19. import java.util.HashMap;
  20. import java.util.List;
  21. import java.util.Map;
  22. import org.orekit.gnss.Frequency;
  23. import org.orekit.time.AbsoluteDate;

  24. /**
  25.  * This class is used to contains all the data computed within cycle-slip detector.
  26.  * All these parameters are what user can get from the detectors.
  27.  * @author David Soulard
  28.  * @since 10.2
  29.  */
  30. public class CycleSlipDetectorResults {

  31.     /** Integer corresponding to the PRN number of the satellite. */
  32.     private String satellite;

  33.     /** Date from which for this satellite cycle-slip detection begins. */
  34.     private Map<Frequency, AbsoluteDate> begin;

  35.     /** Date up to  which for this satellite  cycle-slip detection is valid. */
  36.     private Map<Frequency, AbsoluteDate> end;

  37.     /** List of date at which cycle slip occurs. */
  38.     private Map<Frequency, List<AbsoluteDate>> results;

  39.     /**
  40.      * Constructor.
  41.      * @param satellite name of the satellite considered: "system - PRN" (e.g. "GPS - 07" for the satellite GPS 7.
  42.      * @param date current date
  43.      * @param freq frequency corresponding to the measurements.
  44.      */
  45.     CycleSlipDetectorResults(final String satellite, final AbsoluteDate date, final Frequency freq) {
  46.         this.begin     = new HashMap<>();
  47.         this.end       = new HashMap<>();
  48.         this.results   = new HashMap<>();
  49.         this.satellite = satellite;
  50.         begin.put(freq, date);
  51.         end.put(freq, date);
  52.         results.put(freq, new ArrayList<AbsoluteDate>());
  53.     }

  54.     /**
  55.      * Get the satellite name.
  56.      * @return satellite name
  57.      */
  58.     public String getSatelliteName() {
  59.         return satellite;
  60.     }

  61.     /**
  62.      * Return the end date at the given frequency.
  63.      * <p>
  64.      * For dual-Frequency cycle-slip detector, the {@link Frequency} contained
  65.      * in the map is the higher frequency (e.g. for L1-L2 the frequency in the map will be L1)
  66.      * </p>
  67.      * @param f frequency
  68.      * @return date of end of validity of the detectors
  69.      */
  70.     public AbsoluteDate getEndDate(final Frequency f) {
  71.         return end.get(f);
  72.     }

  73.     /**
  74.      * Return the date of validity beginning of the detector.
  75.      * @param f frequency
  76.      * @return AbsoluteDate
  77.      */
  78.     public AbsoluteDate getBeginDate(final Frequency f) {
  79.         return begin.get(f);
  80.     }

  81.     /**
  82.      * Get the cycle slip Map with contains the results.
  83.      * <p>
  84.      * For dual-Frequency cycle-slip detector, the {@link Frequency} contained
  85.      * in the map is the higher frequency (e.g. for L1-L2 the frequency in the map will be L1)
  86.      * </p>
  87.      * @return cycle slip map containing the results
  88.      */
  89.     public Map<Frequency, List<AbsoluteDate>> getCycleSlipMap() {
  90.         return results;
  91.     }

  92.     /**
  93.      * Add a new cycle-slip date into the Map at the given frequency.
  94.      * @param f frequency of the measurement used to detect the cycle-slip
  95.      * @param date date of the cycle-slip detected.
  96.      */
  97.     void addCycleSlipDate(final Frequency f, final AbsoluteDate date) {
  98.         final List<AbsoluteDate> newList = results.get(f);
  99.         newList.add(date);
  100.         results.put(f, newList);
  101.     }

  102.     /**
  103.      * Knowing the satellite already exist, adding data at another frequency.
  104.      * @param f frequency corresponding to the data
  105.      * @param date date of measurement
  106.      */
  107.     void addAtOtherFrequency(final Frequency f, final AbsoluteDate date) {
  108.         begin.put(f, date);
  109.         end.put(f, date);
  110.         results.put(f, new ArrayList<AbsoluteDate>());
  111.     }

  112.     /**
  113.      * Setter for the ending data.
  114.      * @param f frequency at which the measurement at current date is taken.
  115.      * @param date new date of end
  116.      */
  117.     void setDate(final Frequency f, final AbsoluteDate date) {
  118.         end.put(f, date);
  119.     }

  120. }