1   /* Copyright 2002-2026 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;
18  
19  import org.orekit.time.clocks.ClockModel;
20  
21  /** Class modeling a satellite that can be observed.
22   *
23   * @author Luc Maisonobe
24   * @since 9.3
25   */
26  public class ObservableSatellite extends AbstractParticipant {
27  
28      /** Prefix for satellite names. */
29      private static final String SAT_PREFIX = "sat-";
30  
31      /** Index of the propagator related to this satellite. */
32      private final int propagatorIndex;
33  
34      /** Simple constructor.
35       * <p>
36       * This constructor builds a default name based on the propagator index.
37       * </p>
38       * @param propagatorIndex index of the propagator related to this satellite
39       */
40      public ObservableSatellite(final int propagatorIndex) {
41          this(propagatorIndex, null);
42      }
43  
44      /** Simple constructor.
45       * @param propagatorIndex index of the propagator related to this satellite
46       * @param name satellite name (if null, a default name built from index will be used)
47       * @since 13.0
48       */
49      public ObservableSatellite(final int propagatorIndex, final String name) {
50          super(getName(name, propagatorIndex));
51          this.propagatorIndex = propagatorIndex;
52      }
53  
54      /** Simple constructor.
55       * @param propagatorIndex index of the propagator related to this satellite
56       * @param name satellite name (if null, a default name built from index will be used)
57       * @param clockModel clock model for this satellite
58       * @since 14.0
59       */
60      public ObservableSatellite(final int propagatorIndex, final String name, final ClockModel clockModel) {
61          super(getName(name, propagatorIndex), clockModel);
62          this.propagatorIndex = propagatorIndex;
63      }
64  
65      /**
66       * Get the name for a satellite.
67       * @param name name to use if any, or null for a default name
68       * @param propagatorIndex propagator index
69       * @return name
70       */
71      private static String getName(final String name, final int propagatorIndex) {
72          return name == null ? SAT_PREFIX + propagatorIndex : name;
73      }
74  
75      /** Get the index of the propagator related to this satellite.
76       * @return index of the propagator related to this satellite
77       */
78      public int getPropagatorIndex() {
79          return propagatorIndex;
80      }
81  
82      /** {@inheritDoc}
83       * @since 12.0
84       */
85      @Override
86      public boolean equals(final Object other) {
87          if (other instanceof ObservableSatellite satellite) {
88              return propagatorIndex == satellite.propagatorIndex;
89          } else {
90              return false;
91  
92          }
93      }
94  
95      /** {@inheritDoc}
96       * @since 12.0
97       */
98      @Override
99      public int hashCode() {
100         return propagatorIndex;
101     }
102 
103 }