Search in sources :

Example 11 with OrekitIllegalArgumentException

use of org.orekit.errors.OrekitIllegalArgumentException in project Orekit by CS-SI.

the class DateDetector method addEventDate.

/**
 * Add an event date.
 * <p>The date to add must be:</p>
 * <ul>
 *   <li>less than the smallest already registered event date minus the maxCheck</li>
 *   <li>or more than the largest already registered event date plus the maxCheck</li>
 * </ul>
 * @param target target date
 * @throws IllegalArgumentException if the date is too close from already defined interval
 * @see #DateDetector(double, double, TimeStamped...)
 */
public void addEventDate(final AbsoluteDate target) throws IllegalArgumentException {
    final boolean increasing;
    if (currentIndex < 0) {
        increasing = (gDate == null) ? true : target.durationFrom(gDate) > 0.0;
        currentIndex = 0;
        eventDateList.add(new EventDate(target, increasing));
    } else {
        final int lastIndex = eventDateList.size() - 1;
        if (eventDateList.get(0).getDate().durationFrom(target) > getMaxCheckInterval()) {
            increasing = !eventDateList.get(0).isgIncrease();
            eventDateList.add(0, new EventDate(target, increasing));
            currentIndex++;
        } else if (target.durationFrom(eventDateList.get(lastIndex).getDate()) > getMaxCheckInterval()) {
            increasing = !eventDateList.get(lastIndex).isgIncrease();
            eventDateList.add(new EventDate(target, increasing));
        } else {
            throw new OrekitIllegalArgumentException(OrekitMessages.EVENT_DATE_TOO_CLOSE, target, eventDateList.get(0).getDate(), eventDateList.get(lastIndex).getDate(), getMaxCheckInterval());
        }
    }
}
Also used : OrekitIllegalArgumentException(org.orekit.errors.OrekitIllegalArgumentException)

Aggregations

OrekitIllegalArgumentException (org.orekit.errors.OrekitIllegalArgumentException)11 Test (org.junit.Test)6 EphemerisFile (org.orekit.files.general.EphemerisFile)4 InputStream (java.io.InputStream)3 AbsoluteDate (org.orekit.time.AbsoluteDate)3 FileInputStream (java.io.FileInputStream)2 Matcher (java.util.regex.Matcher)2 Context (org.orekit.estimation.Context)2 GroundStation (org.orekit.estimation.measurements.GroundStation)2 ObservedMeasurement (org.orekit.estimation.measurements.ObservedMeasurement)2 TurnAroundRange (org.orekit.estimation.measurements.TurnAroundRange)2 TurnAroundRangeMeasurementCreator (org.orekit.estimation.measurements.TurnAroundRangeMeasurementCreator)2 TurnAroundRangeIonosphericDelayModifier (org.orekit.estimation.measurements.modifiers.TurnAroundRangeIonosphericDelayModifier)2 InterpolationMethod (org.orekit.files.ccsds.OEMWriter.InterpolationMethod)2 Propagator (org.orekit.propagation.Propagator)2 SpacecraftState (org.orekit.propagation.SpacecraftState)2 NumericalPropagatorBuilder (org.orekit.propagation.conversion.NumericalPropagatorBuilder)2 ParameterDriver (org.orekit.utils.ParameterDriver)2 LinkedHashMap (java.util.LinkedHashMap)1 Map (java.util.Map)1