org.orekit.utils
Interface TimeStampedGenerator<T extends TimeStamped>

Type Parameters:
T - Type of the cached data.
All Known Implementing Classes:
CIPCoordinatesGenerator, TidalCorrectionGenerator

public interface TimeStampedGenerator<T extends TimeStamped>

Generator to use for creating entries in time stamped caches.

As long as a generator is referenced by one cache only, it is guaranteed to be called in a thread-safe way, even if the cache is used in a multi-threaded environment. The cache takes care of scheduling the calls to all the methods defined in this interface so only one thread uses them at any time. There is no need for the implementing classes to handle synchronization or locks by themselves.

The generator is provided by the user of the cache and should be consistent with the way he will use the cached data.

If entries must have regular time gaps (for example one entry every 3600 seconds), then the generator must ensure by itself all generated entries are exactly located on the expected regular grid, even if they are generated in random order. The reason for that is that the cache may ask for entries in different ranges and merge these ranges afterwards. A typical example would be a cache first calling the generator for 6 points around 2012-02-19T17:48:00 and when these points are exhausted calling the generator again for 6 new points around 2012-02-19T23:20:00. If all points must be exactly 3600 seconds apart, the generator should generate the first 6 points at 2012-02-19T15:00:00, 2012-02-19T16:00:00, 2012-02-19T17:00:00, 2012-02-19T18:00:00, 2012-02-19T19:00:00 and 2012-02-19T20:00:00, and the next 6 points at 2012-02-19T21:00:00, 2012-02-19T22:00:00, 2012-02-19T23:00:00, 2012-02-20T00:00:00, 2012-02-20T01:00:00 and 2012-02-20T02:00:00. If the separation between the points is irrelevant, the first points could be generated at 17:48:00 instead of 17:00:00 or 18:00:00. The cache will merge arrays returned from different calls in the same global time slot.

Author:
Luc Maisonobe

Method Summary
 List<T> generate(T existing, AbsoluteDate date)
          Generate a chronologically sorted list of entries to be cached.
 

Method Detail

generate

List<T> generate(T existing,
                 AbsoluteDate date)
                                     throws TimeStampedCacheException
Generate a chronologically sorted list of entries to be cached.

If existing is earlier than date, the range covered by generated entries should cover at least from existing (excluded) to date (included). If existing is later than date, the range covered by generated entries should cover at least from date (included) to existing (excluded).

The generated entries may cover a range larger than the minimum specified above if the generator prefers to generate large chunks of data at once. It may generate again entries already generated by an earlier call (typically existing), these extra entries will be silently ignored by the cache.

The generated entries must be chronologically sorted.

Parameters:
existing - closest already existing entry (may be null)
date - date that must be covered by the range of the generated array (guaranteed to lie between TimeStampedCache.getEarliest() and TimeStampedCache.getLatest())
Returns:
chronologically sorted list of generated entries
Throws:
TimeStampedCacheException - if time stamped data cannot be generated


Copyright © 2016 CNES. All Rights Reserved.