SsrIgm02.java

  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. package org.orekit.gnss.metric.messages.ssr.igm;

  18. import java.util.ArrayList;
  19. import java.util.Collections;
  20. import java.util.HashMap;
  21. import java.util.List;
  22. import java.util.Map;

  23. import org.orekit.gnss.SatelliteSystem;

  24. /**
  25.  * GNSS SSR Clock Correction Message.
  26.  * @author Bryan Cazabonne
  27.  * @since 11.0
  28.  */
  29. public class SsrIgm02 extends SsrIgmMessage<SsrIgm02Header, SsrIgm02Data> {

  30.     /**
  31.      * Constructor.
  32.      * @param typeCode message number
  33.      * @param system satellite system
  34.      * @param header message header
  35.      * @param data message data
  36.      */
  37.     public SsrIgm02(final int typeCode, final SatelliteSystem system,
  38.                     final SsrIgm02Header header, final List<SsrIgm02Data> data) {
  39.         super(typeCode, system, header, data);
  40.     }

  41.     /**
  42.      * Get the SSR IGM02 data parsed in the SSR message.
  43.      * @return the SSR IGM02 data for the parsed message
  44.      */
  45.     public Map<String, List<SsrIgm02Data>> getSsrIgm02Data() {

  46.         // Initialize map
  47.         final Map<String, List<SsrIgm02Data>> ssrIgm02Data = new HashMap<>();

  48.         // Loop on parsed data and fill map
  49.         for (final SsrIgm02Data currentData : getData()) {
  50.             final int ssrIgm02Id = currentData.getSatelliteID();
  51.             final String ssrIgm02IdString = ssrIgm02Id < 10 ? "0" + String.valueOf(ssrIgm02Id) : String.valueOf(ssrIgm02Id);
  52.             final String id = getSatelliteSystem().getKey() + ssrIgm02IdString;
  53.             ssrIgm02Data.putIfAbsent(id, new ArrayList<>());
  54.             ssrIgm02Data.get(id).add(currentData);
  55.         }

  56.         // Return an unmodifiable map of the parsed data
  57.         return Collections.unmodifiableMap(ssrIgm02Data);

  58.     }

  59. }