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.gnss.metric.messages.ssr.igm;
18  
19  import java.util.ArrayList;
20  import java.util.Collections;
21  import java.util.HashMap;
22  import java.util.List;
23  import java.util.Map;
24  
25  import org.orekit.gnss.SatelliteSystem;
26  
27  /**
28   * GNSS SSR Clock Correction Message.
29   * @author Bryan Cazabonne
30   * @since 11.0
31   */
32  public class SsrIgm02 extends SsrIgmMessage<SsrIgm02Header, SsrIgm02Data> {
33  
34      /**
35       * Constructor.
36       * @param typeCode message number
37       * @param system satellite system
38       * @param header message header
39       * @param data message data
40       */
41      public SsrIgm02(final int typeCode, final SatelliteSystem system,
42                      final SsrIgm02Header header, final List<SsrIgm02Data> data) {
43          super(typeCode, system, header, data);
44      }
45  
46      /**
47       * Get the SSR IGM02 data parsed in the SSR message.
48       * @return the SSR IGM02 data for the parsed message
49       */
50      public Map<String, List<SsrIgm02Data>> getSsrIgm02Data() {
51  
52          // Initialize map
53          final Map<String, List<SsrIgm02Data>> ssrIgm02Data = new HashMap<>();
54  
55          // Loop on parsed data and fill map
56          for (final SsrIgm02Data currentData : getData()) {
57              final int ssrIgm02Id = currentData.getSatelliteID();
58              final String ssrIgm02IdString = ssrIgm02Id < 10 ? "0" + String.valueOf(ssrIgm02Id) : String.valueOf(ssrIgm02Id);
59              final String id = getSatelliteSystem().getKey() + ssrIgm02IdString;
60              ssrIgm02Data.putIfAbsent(id, new ArrayList<>());
61              ssrIgm02Data.get(id).add(currentData);
62          }
63  
64          // Return an unmodifiable map of the parsed data
65          return Collections.unmodifiableMap(ssrIgm02Data);
66  
67      }
68  
69  }