Skip to content
Snippets Groups Projects
Commit d682a842 authored by Luc Maisonobe's avatar Luc Maisonobe
Browse files

Moved code out of loop.

parent bbf98847
No related branches found
No related tags found
No related merge requests found
...@@ -29,6 +29,11 @@ import org.hipparchus.util.FastMath; ...@@ -29,6 +29,11 @@ import org.hipparchus.util.FastMath;
* {@link org.orekit.time.TimeScalesFactory#getUTC() UTC}, the first date of * {@link org.orekit.time.TimeScalesFactory#getUTC() UTC}, the first date of
* each burst will occur at whole hours in UTC time. * each burst will occur at whole hours in UTC time.
* </p> * </p>
* <p>
* This class stores internally the last selected dates, so it is <em>not</em>
* thread-safe. A separate selector should be used for each thread in multi-threading
* context.
* </p>
* @author Luc Maisonobe * @author Luc Maisonobe
* @since 9.3 * @since 9.3
*/ */
...@@ -91,17 +96,16 @@ public class BurstSelector implements DatesSelector { ...@@ -91,17 +96,16 @@ public class BurstSelector implements DatesSelector {
final List<AbsoluteDate> selected = new ArrayList<>(); final List<AbsoluteDate> selected = new ArrayList<>();
boolean reset = first == null || start.durationFrom(first) > burstPeriod; final boolean reset = first == null || start.durationFrom(first) > burstPeriod;
if (reset) {
first = null;
lastSize = 0;
}
for (AbsoluteDate next = reset ? start : last.shiftedBy(highRateStep); for (AbsoluteDate next = reset ? start : last.shiftedBy(highRateStep);
next.compareTo(end) <= 0; next.compareTo(end) <= 0;
next = last.shiftedBy(highRateStep)) { next = last.shiftedBy(highRateStep)) {
if (reset) {
first = null;
lastSize = 0;
reset = false;
}
if (lastSize == maxBurstSize) { if (lastSize == maxBurstSize) {
// we have exceeded burst size, jump to next burst // we have exceeded burst size, jump to next burst
next = first.shiftedBy(burstPeriod); next = first.shiftedBy(burstPeriod);
......
...@@ -29,6 +29,11 @@ import org.hipparchus.util.FastMath; ...@@ -29,6 +29,11 @@ import org.hipparchus.util.FastMath;
* {@link org.orekit.time.TimeScalesFactory#getUTC() UTC}, dates will be selected * {@link org.orekit.time.TimeScalesFactory#getUTC() UTC}, dates will be selected
* at whole minutes in UTC time. * at whole minutes in UTC time.
* </p> * </p>
* <p>
* This class stores internally the last selected dates, so it is <em>not</em>
* thread-safe. A separate selector should be used for each thread in multi-threading
* context.
* </p>
* @author Luc Maisonobe * @author Luc Maisonobe
* @since 9.3 * @since 9.3
*/ */
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment