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  
18  package org.orekit.files.sinex;
19  
20  import java.util.HashMap;
21  
22  import org.orekit.gnss.SatelliteSystem;
23  
24  /**
25   * Class based on DCB, used to store the data parsed in {@link SinexLoader}
26   * for Differential Code Biases computed for stations.
27   * <p>
28   * Satellites and stations have differentiated classes as stations might have multiple satellite systems.
29   * The data are stored in a Map of DCB, identified by the {@link SatelliteSystem}
30   * </p>
31   * @author Louis Aucouturier
32   * @since 12.0
33   */
34  public class DcbStation {
35  
36      /** Site code. */
37      private String siteCode;
38  
39      /** DCB description container. */
40      private DcbDescription description;
41  
42      /** Map containing DCB objects as a function of the satellite system. */
43      private HashMap<SatelliteSystem, Dcb> dcbMap;
44  
45      /**
46       * Simple constructor.
47       * @param siteCode the site code (station identifier)
48       */
49      public DcbStation(final String siteCode) {
50          this.siteCode    = siteCode;
51          this.description = null;
52          this.dcbMap      = new HashMap<SatelliteSystem, Dcb>();
53      }
54  
55      /**
56       * Get the site code (station identifier).
57       *
58       * @return the site code
59       */
60      public String getSiteCode() {
61          return siteCode;
62      }
63  
64      /**
65       * Get the data contained in "DCB/DESCRIPTION" block of the Sinex file.
66       * <p>
67       * This block gives important parameters from the analysis and defines
68       * the fields in the block ’BIAS/SOLUTION’
69       * </p>
70       * @return the "DCB/DESCRIPTION" parameters.
71       */
72      public DcbDescription getDescription() {
73          return description;
74      }
75  
76      /**
77       * Set the data contained in "DCB/DESCRIPTION" block of the Sinex file.
78       *
79       * @param description the "DCB/DESCRIPTION" parameters to set
80       */
81      public void setDescription(final DcbDescription description) {
82          this.description = description;
83      }
84  
85      /**
86       * Get the DCB data for a given satellite system.
87       *
88       * @param satelliteSystem satellite system
89       * @return the DCB data corresponding to the satellite system
90       *         (can be null is no DCB available)
91       */
92      public Dcb getDcbData(final SatelliteSystem satelliteSystem) {
93          return dcbMap.get(satelliteSystem);
94      }
95  
96      /**
97       * Add the DCB data corresponding to a satellite system.
98       * <p>
99       * If the instance previously contained DCB data for the satellite system, the old value is replaced.
100      * </p>
101      * @param satelliteSystem satellite system for which the DCB is added
102      * @param dcb DCB data
103      */
104     public void addDcb(final SatelliteSystem satelliteSystem, final Dcb dcb) {
105         dcbMap.put(satelliteSystem, dcb);
106     }
107 
108     /**
109      * Get the satellite systems available for the station.
110      *
111      * @return a Set containing all SatelliteSystems available for DCB computation.
112      */
113     public Iterable<SatelliteSystem> getAvailableSatelliteSystems() {
114         return dcbMap.keySet();
115     }
116 
117 }