1   /* Copyright 2002-2026 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.time;
18  
19  import java.util.Collection;
20  import java.util.List;
21  import java.util.stream.Stream;
22  
23  /**
24   * This interface represents objects that can interpolate a time stamped value with respect to time.
25   *
26   * @param <T> type of the interpolated instance
27   *
28   * @author Vincent Cucchietti
29   * @see AbsoluteDate
30   * @see TimeStamped
31   */
32  public interface TimeInterpolator<T extends TimeStamped> {
33  
34      /**
35       * Get an interpolated instance.
36       * <p>
37       * The stream must yield elements in chronological order. Passing an unsorted stream yields undefined
38       * neighbors and may throw {@link org.orekit.errors.TimeStampedCacheException}.
39       *
40       * @param interpolationDate interpolation date
41       * @param sample time stamped sample (chronologically sorted)
42       *
43       * @return a new instance, interpolated at specified date
44       *
45       * @see TimeStamped
46       * @see AbsoluteDate
47       */
48      T interpolate(AbsoluteDate interpolationDate, Stream<T> sample);
49  
50      /**
51       * Get an interpolated instance.
52       * <p>
53       * The sample must be in chronological order. Passing an unsorted sample yields undefined neighbors and may
54       * throw {@link org.orekit.errors.TimeStampedCacheException}.
55       *
56       * @param interpolationDate interpolation date
57       * @param sample time stamped sample (chronologically sorted)
58       *
59       * @return a new instance, interpolated at specified date
60       */
61      T interpolate(AbsoluteDate interpolationDate, Collection<T> sample);
62  
63      /**
64       * Get all lowest level interpolators implemented by this instance, otherwise return a list with this instance only.
65       * <p>
66       * An example would be the spacecraft state interpolator which can use different interpolators for each of its attributes
67       * (orbit, absolute position-velocity-acceleration coordinates, mass...). In this case, it would return the list of all
68       * of these interpolators (or possibly all of their sub-interpolators if they were to use multiple interpolators
69       * themselves).
70       *
71       * @return list of interpolators
72       */
73      List<TimeInterpolator<? extends TimeStamped>> getSubInterpolators();
74  
75      /**
76       * Get the number of interpolation points. In the specific case where this interpolator contains multiple
77       * sub-interpolators, this method will return the maximum number of interpolation points required among all
78       * sub-interpolators.
79       *
80       * @return the number of interpolation points
81       *
82       * @since 12.0.1
83       */
84      int getNbInterpolationPoints();
85  
86      /** Get the extrapolation threshold.
87       * @return get the extrapolation threshold
88       */
89      double getExtrapolationThreshold();
90  }