1   /* Copyright 2002-2018 CS Systèmes d'Information
2    * Licensed to CS Systèmes d'Information (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  
22  /** Enumerate for selecting which derivatives to use in {@link TimeStampedAngularCoordinates}
23   * and {@link TimeStampedFieldAngularCoordinates} interpolation.
24   * @see TimeStampedAngularCoordinates#interpolate(org.orekit.time.AbsoluteDate, AngularDerivativesFilter, java.util.Collection)
25   * @see TimeStampedFieldAngularCoordinates#interpolate(org.orekit.time.AbsoluteDate, AngularDerivativesFilter, java.util.Collection)
26   * @see CartesianDerivativesFilter
27   * @author Luc Maisonobe
28   * @since 7.0
29   */
30  public enum AngularDerivativesFilter {
31  
32      /** Use only rotations, ignoring rotation rates. */
33      USE_R(0),
34  
35      /** Use rotations and rotation rates. */
36      USE_RR(1),
37  
38      /** Use rotations, rotation rates and acceleration. */
39      USE_RRA(2);
40  
41      /** Maximum derivation order. */
42      private final int maxOrder;
43  
44      /** Simple constructor.
45       * @param maxOrder maximum derivation order
46       */
47      AngularDerivativesFilter(final int maxOrder) {
48          this.maxOrder = maxOrder;
49      }
50  
51      /** Get the maximum derivation order.
52       * @return maximum derivation order
53       */
54      public int getMaxOrder() {
55          return maxOrder;
56      }
57  
58      /** Get the filter corresponding to a maximum derivation order.
59       * @param order maximum derivation order
60       * @return the filter corresponding to derivation order
61       * @exception IllegalArgumentException if the order is out of range
62       */
63      public static AngularDerivativesFilter getFilter(final int order)
64          throws IllegalArgumentException {
65          for (final AngularDerivativesFilter filter : values()) {
66              if (filter.getMaxOrder() == order) {
67                  return filter;
68              }
69          }
70          throw new OrekitIllegalArgumentException(OrekitMessages.OUT_OF_RANGE_DERIVATION_ORDER, order);
71      }
72  
73  }