Class FixedStepSelector

  • All Implemented Interfaces:
    DatesSelector

    public class FixedStepSelector
    extends Object
    implements DatesSelector
    Selector generating a continuous stream of dates separated by a constant step.

    The dates can be aligned to whole steps in some time scale. So for example if a step of 60s is used and the alignment time scale is set to UTC, dates will be selected at whole minutes in UTC time.

    This class stores internally the last selected dates, so it is not thread-safe. A separate selector should be used for each thread in multi-threading context.

    Since:
    9.3
    Author:
    Luc Maisonobe
    • Constructor Detail

      • FixedStepSelector

        public FixedStepSelector​(double step,
                                 TimeScale alignmentTimeScale)
        Simple constructor.
        Parameters:
        step - step between two consecutive dates (s)
        alignmentTimeScale - alignment time scale (null is alignment is not needed)
    • Method Detail

      • selectDates

        public List<AbsoluteDate> selectDates​(AbsoluteDate start,
                                              AbsoluteDate end)
        Select dates within an interval.

        The start and end date may be either in direct or reverse chronological order. The list is produced in the same order as start and end, i.e. direct chronological order if start is earlier than end or reverse chronological order if start is later than end.

        The ordering (direct or reverse chronological order) should not be changed between calls, otherwise unpredictable results may occur.

        Specified by:
        selectDates in interface DatesSelector
        Parameters:
        start - interval start
        end - interval end
        Returns:
        selected dates within this interval