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.utils;
18  
19  import org.orekit.errors.OrekitIllegalArgumentException;
20  import org.orekit.errors.OrekitMessages;
21  import org.orekit.time.AbsoluteDate;
22  import org.orekit.time.FieldAbsoluteDate;
23  
24  /** Enumerate for selecting which derivatives to use in {@link TimeStampedPVCoordinates} and
25   * {@link TimeStampedFieldPVCoordinates} interpolation.
26   * @see TimeStampedPVCoordinatesHermiteInterpolator#interpolate(AbsoluteDate, java.util.Collection)
27   * @see TimeStampedFieldPVCoordinatesHermiteInterpolator#interpolate(FieldAbsoluteDate, java.util.Collection)
28   * @see AngularDerivativesFilter
29   * @author Luc Maisonobe
30   * @since 7.0
31   */
32  public enum CartesianDerivativesFilter {
33  
34      /** Use only positions, ignoring velocities. */
35      USE_P(0),
36  
37      /** Use positions and velocities. */
38      USE_PV(1),
39  
40      /** Use positions, velocities and accelerations. */
41      USE_PVA(2);
42  
43      /** Maximum derivation order. */
44      private final int maxOrder;
45  
46      /** Simple constructor.
47       * @param maxOrder maximum derivation order
48       */
49      CartesianDerivativesFilter(final int maxOrder) {
50          this.maxOrder = maxOrder;
51      }
52  
53      /** Get the maximum derivation order.
54       * @return maximum derivation order
55       */
56      public int getMaxOrder() {
57          return maxOrder;
58      }
59  
60      /** Get the filter corresponding to a maximum derivation order.
61       * @param order maximum derivation order
62       * @return the filter corresponding to derivation order
63       * @exception IllegalArgumentException if the order is out of range
64       */
65      public static CartesianDerivativesFilter getFilter(final int order)
66          throws IllegalArgumentException {
67          for (final CartesianDerivativesFilter filter : values()) {
68              if (filter.getMaxOrder() == order) {
69                  return filter;
70              }
71          }
72          throw new OrekitIllegalArgumentException(OrekitMessages.OUT_OF_RANGE_DERIVATION_ORDER, order);
73      }
74  
75  }