Class FieldTimeSpanMap<T,​D extends CalculusFieldElement<D>>

  • Type Parameters:
    T - Type of the data.
    D - type of the field elements

    public class FieldTimeSpanMap<T,​D extends CalculusFieldElement<D>>
    extends Object
    Container for objects that apply to spans of time.
    Since:
    7.1
    Author:
    Luc Maisonobe
    • Constructor Detail

      • FieldTimeSpanMap

        public FieldTimeSpanMap​(T entry,
                                Field<D> field_n)
        Create a map containing a single object, initially valid throughout the timeline.

        The real validity of this first entry will be truncated as other entries are either added before it or added after it.

        Parameters:
        entry - entry (initially valid throughout the timeline)
        field_n - field used by default.
    • Method Detail

      • addValidBefore

        public void addValidBefore​(T entry,
                                   FieldAbsoluteDate<D> latestValidityDate)
        Add an entry valid before a limit date.

        As an entry is valid, it truncates the validity of the neighboring entries already present in the map.

        The transition dates should be entered only once, either by a call to this method or by a call to addValidAfter(Object, FieldAbsoluteDate). Repeating a transition date will lead to unexpected result and is not supported.

        Parameters:
        entry - entry to add
        latestValidityDate - date before which the entry is valid (sould be different from all dates already used for transitions)
      • addValidAfter

        public void addValidAfter​(T entry,
                                  FieldAbsoluteDate<D> earliestValidityDate)
        Add an entry valid after a limit date.

        As an entry is valid, it truncates the validity of the neighboring entries already present in the map.

        The transition dates should be entered only once, either by a call to this method or by a call to addValidBefore(Object, FieldAbsoluteDate). Repeating a transition date will lead to unexpected result and is not supported.

        Parameters:
        entry - entry to add
        earliestValidityDate - date after which the entry is valid (sould be different from all dates already used for transitions)
      • get

        public T get​(FieldAbsoluteDate<D> date)
        Get the entry valid at a specified date.
        Parameters:
        date - date at which the entry must be valid
        Returns:
        valid entry at specified date
      • getTransitions

        public SortedSet<FieldTimeSpanMap.Transition<T,​D>> getTransitions()
        Get an unmodifiable view of the sorted transitions.
        Returns:
        unmodifiable view of the sorted transitions