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 TimeStampedPVCoordinates} and 23 * {@link TimeStampedFieldPVCoordinates} interpolation. 24 * @see TimeStampedPVCoordinates#interpolate(org.orekit.time.AbsoluteDate, CartesianDerivativesFilter, java.util.Collection) 25 * @see TimeStampedFieldPVCoordinates#interpolate(org.orekit.time.FieldAbsoluteDate, CartesianDerivativesFilter, java.util.Collection) 26 * @see AngularDerivativesFilter 27 * @author Luc Maisonobe 28 * @since 7.0 29 */ 30 public enum CartesianDerivativesFilter { 31 32 /** Use only positions, ignoring velocities. */ 33 USE_P(0), 34 35 /** Use positions and velocities. */ 36 USE_PV(1), 37 38 /** Use positions, velocities and accelerations. */ 39 USE_PVA(2); 40 41 /** Maximum derivation order. */ 42 private final int maxOrder; 43 44 /** Simple constructor. 45 * @param maxOrder maximum derivation order 46 */ 47 CartesianDerivativesFilter(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 CartesianDerivativesFilter getFilter(final int order) 64 throws IllegalArgumentException { 65 for (final CartesianDerivativesFilter 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 }