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.common;
18  
19  /** Enumerate for GLONASS User Range Accuracy.
20   * @see "ICD L1, L2 GLONASS, Edition 5.1, Table 4.4, 2008"
21   * @author Bryan Cazabonne
22   */
23  public class GlonassUserRangeAccuracy implements AccuracyProvider {
24  
25      /** User Range Accuracy indicator (word F<sub>T</sub>). */
26      private final int glonassUraIndex;
27  
28      /**
29       * Simple constructor.
30       * @param index integer value of the Glonass user range accuracy
31       */
32      public GlonassUserRangeAccuracy(final int index) {
33          this.glonassUraIndex = index;
34      }
35  
36      /** {@inheritDoc} */
37      @Override
38      public double getAccuracy() {
39          switch (glonassUraIndex) {
40              case 0  : return 1.0;
41              case 1  : return 2.0;
42              case 2  : return 2.5;
43              case 3  : return 4.0;
44              case 4  : return 5.0;
45              case 5  : return 7.0;
46              case 6  : return 10.0;
47              case 7  : return 12.0;
48              case 8  : return 14.0;
49              case 9  : return 16.0;
50              case 10 : return 32.0;
51              case 11 : return 64.0;
52              case 12 : return 128.0;
53              case 13 : return 256.0;
54              case 14 : return 512.0;
55              default : return 1024.0; // Data shall not be used
56          }
57      }
58  
59  }