1 /* Copyright 2002-2024 Luc Maisonobe
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;
18
19 /** Container for satellite system and PRN.
20 * @author Luc Maisonobe
21 * @since 12.0
22 */
23 public class SatInSystem {
24
25 /** Satellite system. */
26 private final SatelliteSystem system;
27
28 /** PRN number. */
29 private final int prn;
30
31 /** Simple constructor.
32 * @param system satellite system
33 * @param prn Pseudo Random Number
34 */
35 public SatInSystem(final SatelliteSystem system, final int prn) {
36 this.system = system;
37 this.prn = prn;
38 }
39
40 /** Get the system this satellite belongs to.
41 * @return system this satellite belongs to
42 */
43 public SatelliteSystem getSystem() {
44 return system;
45 }
46
47 /** Get the Pseudo Random Number of the satellite.
48 * @return Pseudo Random Number of the satellite
49 */
50 public int getPRN() {
51 return prn;
52 }
53
54 /** Get a 2-digits Pseudo Random Number for RINEX files.
55 * @return 2-digits Pseudo Random Number for RINEX files
56 */
57 public int getTwoDigitsRinexPRN() {
58 return system == SatelliteSystem.SBAS ? prn - 100 : (system == SatelliteSystem.QZSS ? prn - 192 : prn);
59 }
60
61 @Override
62 public boolean equals(final Object object) {
63 if (object instanceof SatInSystem) {
64 final SatInSystem other = (SatInSystem) object;
65 return getSystem().equals(other.getSystem()) && getPRN() == other.getPRN();
66 }
67 return false;
68 }
69
70 @Override
71 public int hashCode() {
72 return getSystem().hashCode() ^ getPRN();
73 }
74
75 }