1 /* Copyright 2022-2025 Romain Serra
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
18 package org.orekit.utils;
19
20 import org.hipparchus.geometry.euclidean.threed.Vector3D;
21 import org.orekit.frames.Frame;
22 import org.orekit.time.AbsoluteDate;
23 import org.orekit.time.TimeInterval;
24
25 /**
26 * Interface for bounded PV coordinates providers.
27 *
28 * @author Romain Serra
29 * @since 13.1
30 * @see PVCoordinatesProvider
31 */
32 public interface BoundedPVCoordinatesProvider extends PVCoordinatesProvider {
33
34 /** Get the first date of the range.
35 * @return the first date of the range
36 */
37 AbsoluteDate getMinDate();
38
39 /** Get the last date of the range.
40 * @return the last date of the range
41 */
42 AbsoluteDate getMaxDate();
43
44 /**
45 * Bound a given coordinates provider.
46 * @param interval time interval
47 * @param provider input provider
48 * @return bounded provider
49 */
50 static BoundedPVCoordinatesProvider of( final PVCoordinatesProvider provider, final TimeInterval interval) {
51 return new BoundedPVCoordinatesProvider() {
52 @Override
53 public TimeStampedPVCoordinates getPVCoordinates(final AbsoluteDate date, final Frame frame) {
54 return provider.getPVCoordinates(date, frame);
55 }
56
57 @Override
58 public Vector3D getPosition(final AbsoluteDate date, final Frame frame) {
59 return provider.getPosition(date, frame);
60 }
61
62 @Override
63 public AbsoluteDate getMinDate() {
64 return interval.getStartDate();
65 }
66
67 @Override
68 public AbsoluteDate getMaxDate() {
69 return interval.getEndDate();
70 }
71 };
72 }
73 }