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   * 13-character signed component of a velocity vector.
23   * <p>
24   * Units: m/s
25   * <p>
26   * Assumed decimal places is three places from the right
27   * <p>
28   * Valid values:
29   * <ul>
30   * <li> Character 1: ' ' or '-'
31   * <li> Character 2-12: Any integer 0-9
32   * </ul>
33   *
34   * @author Nick LaFarge
35   * @since 13.0
36   */
37  public class VelocityVectorComponentTerm extends DoubleValuedIIRVTerm {
38  
39      /** The length of the IIRV term within the message. */
40      public static final int VELOCITY_VECTOR_COMPONENT_TERM_LENGTH = 13;
41  
42      /** Regular expression that ensures the validity of string values for this term. */
43      public static final String VELOCITY_VECTOR_COMPONENT_TERM_PATTERN = "( |-)\\d{12}";
44  
45      /** Number of characters before the end of the string the decimal place occurs. */
46      public static final int N_CHARS_AFTER_DECIMAL_PLACE = 3;
47  
48      /**
49       * Constructor.
50       * <p>
51       * See {@link DoubleValuedIIRVTerm#DoubleValuedIIRVTerm(String, String, int, int, boolean)}
52       *
53       * @param value value of component of the velocity vector [m/s]
54       */
55      public VelocityVectorComponentTerm(final String value) {
56          super(VELOCITY_VECTOR_COMPONENT_TERM_PATTERN,
57              value,
58              VELOCITY_VECTOR_COMPONENT_TERM_LENGTH,
59              N_CHARS_AFTER_DECIMAL_PLACE,
60              true);
61      }
62  
63      /**
64       * Constructor.
65       * <p>
66       * See {@link DoubleValuedIIRVTerm#DoubleValuedIIRVTerm(String, double, int, int, boolean)}
67       *
68       * @param value value of component of the velocity vector [m/s]
69       */
70      public VelocityVectorComponentTerm(final double value) {
71          super(VELOCITY_VECTOR_COMPONENT_TERM_PATTERN,
72              value,
73              VELOCITY_VECTOR_COMPONENT_TERM_LENGTH,
74              N_CHARS_AFTER_DECIMAL_PLACE,
75              true);
76      }
77  
78  }