CartesianDerivativesFilter.java

  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. import org.orekit.errors.OrekitIllegalArgumentException;
  19. import org.orekit.errors.OrekitMessages;

  20. /** Enumerate for selecting which derivatives to use in {@link TimeStampedPVCoordinates} and
  21.  * {@link TimeStampedFieldPVCoordinates} interpolation.
  22.  * @see TimeStampedPVCoordinates#interpolate(org.orekit.time.AbsoluteDate, CartesianDerivativesFilter, java.util.Collection)
  23.  * @see TimeStampedFieldPVCoordinates#interpolate(org.orekit.time.FieldAbsoluteDate, CartesianDerivativesFilter, java.util.Collection)
  24.  * @see AngularDerivativesFilter
  25.  * @author Luc Maisonobe
  26.  * @since 7.0
  27.  */
  28. public enum CartesianDerivativesFilter {

  29.     /** Use only positions, ignoring velocities. */
  30.     USE_P(0),

  31.     /** Use positions and velocities. */
  32.     USE_PV(1),

  33.     /** Use positions, velocities and accelerations. */
  34.     USE_PVA(2);

  35.     /** Maximum derivation order. */
  36.     private final int maxOrder;

  37.     /** Simple constructor.
  38.      * @param maxOrder maximum derivation order
  39.      */
  40.     CartesianDerivativesFilter(final int maxOrder) {
  41.         this.maxOrder = maxOrder;
  42.     }

  43.     /** Get the maximum derivation order.
  44.      * @return maximum derivation order
  45.      */
  46.     public int getMaxOrder() {
  47.         return maxOrder;
  48.     }

  49.     /** Get the filter corresponding to a maximum derivation order.
  50.      * @param order maximum derivation order
  51.      * @return the filter corresponding to derivation order
  52.      * @exception IllegalArgumentException if the order is out of range
  53.      */
  54.     public static CartesianDerivativesFilter getFilter(final int order)
  55.         throws IllegalArgumentException {
  56.         for (final CartesianDerivativesFilter filter : values()) {
  57.             if (filter.getMaxOrder() == order) {
  58.                 return filter;
  59.             }
  60.         }
  61.         throw new OrekitIllegalArgumentException(OrekitMessages.OUT_OF_RANGE_DERIVATION_ORDER, order);
  62.     }

  63. }