public final class TimeGenerator extends Object
Generates JulianDate
instances according to several algorithms.
Note that this will return values of JulianDate
represented in the
ArithmeticSafeStandard
(get
) TimeStandard
corresponding to the standards on the provided input values. For instance, if the values
are provided in CoordinatedUniversalTime
(get
) the output values will
be expressed in InternationalAtomicTime
(get
). This is done to account for the
performance impact of having to convert each time to the arithmetically safe standard rather than
simply converting the start and stop times.
Modifier and Type | Method and Description |
---|---|
static List<JulianDate> |
fromInterval(JulianDate start,
JulianDate stop,
Duration step)
Generates times at a specified frequency within an interval as well as the stop time.
|
static List<JulianDate> |
fromInterval(TimeInterval interval,
Duration step)
Generates times at a specified frequency within an interval as well as the end of the interval.
|
static List<JulianDate> |
regularSamplingFromInterval(TimeInterval interval,
Duration step)
Generates times at regular steps within an interval (not including the end time).
|
static List<JulianDate> |
regularSamplingFromInterval(TimeInterval interval,
JulianDate startOfSampling,
Duration step)
Generates times at regular steps within an interval (not including the end time).
|
static List<JulianDate> |
regularSamplingFromIntervals(TimeIntervalCollection intervals,
Duration step)
Generates times at regular steps within a set of intervals (not including the edges of the intervals).
|
static List<JulianDate> |
regularSamplingFromIntervals(TimeIntervalCollection intervals,
JulianDate startOfSampling,
Duration step)
Generates times at regular steps within an interval (not including the end time).
|
@Nonnull public static List<JulianDate> fromInterval(@Nonnull TimeInterval interval, @Nonnull Duration step)
Times in the collection are generated as they are requested, so the returned collection uses a negligible amount of memory even when representing times over a large interval with a small step.
If the start date of the interval is included in the interval
(IsStartIncluded
(get
)), the first date in the collection will be
the start date of the interval. If it is not included, the first date in the collection
will be step
seconds later. If the stop date of the interval is
included in the interval (IsStopIncluded
(get
)), the last date in the
collection will be the stop date of the interval. If it is not included, the last date
in the collection will be up to step
seconds before the stop date.
If neither the start nor stop date are included, and the interval is shorter than
step
, the returned collection is empty.
interval
- The interval in which to generate times.step
- The step between times.@Nonnull public static List<JulianDate> fromInterval(@Nonnull JulianDate start, @Nonnull JulianDate stop, @Nonnull Duration step)
Times in the collection are generated as they are requested, so the returned collection uses a negligible amount of memory even when representing times over a large interval with a small step.
The first date in the collection will be start
. The last date
in the collection will be stop
, so the difference between the
second-to-last date and the last date may be less than step
.
Also, these dates will always be present in the returned collection even if the duration
between them is less than step
.
start
- The first date in the returned collection.stop
- The last date in the returned collection.step
- The step between times.@Nonnull public static List<JulianDate> regularSamplingFromInterval(@Nonnull TimeInterval interval, @Nonnull Duration step)
Times in the collection are generated as they are requested, so the returned collection uses a negligible amount of memory even when representing times over a large interval with a small step.
If the start date of the interval is included in the interval
(IsStartIncluded
(get
)), the first date in the collection will be
the start date of the interval. If it is not included, the first date in the collection
will be step
seconds later. If the stop date of the interval is
included in the interval (IsStopIncluded
(get
)), it will be included
as the last time in the list only if it lies exactly at a sample time. If it is not included, the last date
in the collection will be up to step
seconds before the stop date.
If neither the start nor stop date are included, and the interval is shorter than
step
, the returned collection is empty.
interval
- The interval in which to generate times.step
- The step between times.@Nonnull public static List<JulianDate> regularSamplingFromInterval(@Nonnull TimeInterval interval, @Nonnull JulianDate startOfSampling, @Nonnull Duration step)
Times in the collection are generated as they are requested, so the returned collection uses a negligible amount of memory even when representing times over a large interval with a small step.
If the start date of the interval is included in the interval
(IsStartIncluded
(get
)) and lies at a whole number of steps from the
startOfSampling
, the first date in the collection will be
the start date of the interval. If it is not included, the first date in the collection
will be sometime later. If the stop date of the interval is
included in the interval (IsStopIncluded
(get
)), it will be included
as the last time in the list only if it lies exactly at a sample time. If it is not included, the last date
in the collection will be up to step
seconds before the stop date.
If neither the start nor stop date are included, and the interval does not have any samples falling inside it,
the returned collection is empty.
interval
- The interval in which to generate times.startOfSampling
- The time at which to start sampling. If this time is prior to the
given sampling interval
, samples will begin inside the interval
.step
- The step between times.@Nonnull public static List<JulianDate> regularSamplingFromIntervals(@Nonnull TimeIntervalCollection intervals, @Nonnull Duration step)
Times in the collection are generated as they are requested, so the returned collection uses a negligible amount of memory even when representing times over a large interval with a small step.
If the start date of the interval collection is included
(IsStartIncluded
(get
)), the first date in the collection will be
the start date of the first interval. If it is not included, the first date in the collection
will be step
seconds later. Only samples which are regular steps from the
start of sampling and which are contained in intervals
are included. If
no samples fall within the intervals, the list is empty.
intervals
- The collection of intervals in which to generate times.step
- The step between times.@Nonnull public static List<JulianDate> regularSamplingFromIntervals(@Nonnull TimeIntervalCollection intervals, @Nonnull JulianDate startOfSampling, @Nonnull Duration step)
Times in the collection are generated as they are requested, so the returned collection uses a negligible amount of memory even when representing times over a large interval with a small step.
The first date in the collection will be
the first sample at or after startOfSampling
which is contained in the intervals.
Only samples which are regular steps from the
start of sampling and which are contained in intervals
are included. If
no samples fall within the intervals, the list is empty.
intervals
- The intervals in which to generate times.startOfSampling
- The time at which to start sampling. If this time is prior to the
given sampling intervals
, samples will begin inside the intervals
.step
- The step between times.