1   /* Copyright 2024-2025 The Johns Hopkins University Applied Physics Laboratory
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.files.iirv.terms;
18  
19  import org.orekit.files.iirv.terms.base.DoubleValuedIIRVTerm;
20  
21  /**
22   * 8-character mass of the satellite in kilograms with a resolution to the nearest tenth of a kilogram; assumed decimal
23   * point is one place from the right. Must contain all zeros if not used.
24   * <p>
25   * Units: kg
26   * <p>
27   * Valid values:<br>
28   * <ul>
29   * <li>0 to 999.99</li>
30   * <li>[String]: Any integer 0-9 for characters 1-8 </li>
31   * </ul>
32   *
33   * @author Nick LaFarge
34   * @since 13.0
35   */
36  public class MassTerm extends DoubleValuedIIRVTerm {
37  
38      /** MassTerm contains all zeros when not used. */
39      public static final MassTerm UNUSED = new MassTerm(0);
40  
41      /** The length of the IIRV term within the message. */
42      public static final int MASS_TERM_LENGTH = 8;
43  
44      /** Regular expression that ensures the validity of string values for this term. */
45      public static final String MASS_TERM_PATTERN = "\\d{8}";
46  
47      /**
48       * Constructor.
49       * <p>
50       * See {@link DoubleValuedIIRVTerm#DoubleValuedIIRVTerm(String, String, int, int, boolean)}
51       *
52       * @param value mass value [kg]
53       */
54      public MassTerm(final String value) {
55          super(MASS_TERM_PATTERN, value, MASS_TERM_LENGTH, 1, false);
56      }
57  
58      /**
59       * Constructor.
60       * <p>
61       * See {@link DoubleValuedIIRVTerm#DoubleValuedIIRVTerm(String, double, int, int, boolean)}
62       *
63       * @param value mass value [kg]
64       */
65      public MassTerm(final double value) {
66          super(MASS_TERM_PATTERN, value, MASS_TERM_LENGTH, 1, false);
67      }
68  }