Class ParameterDriversList


  • public class ParameterDriversList
    extends Object
    Class managing several parameter drivers, taking care of duplicated names.

    Once parameter drivers sharing the same name have been added to an instance of this class, they are permanently bound together and also bound to the delegating driver that manages them. This means that if drivers d1, d2... dn are added to the list and both correspond to parameter name "P", then getDrivers() will return a list containing a delegating driver delegateD for the same name "P". Afterwards, whenever either ParameterDriver.setValue(double) or ParameterDriver.setReferenceDate(AbsoluteDate) is called on any of the n+1 instances d1, d2... dn or delegateD, the call will be automatically forwarded to the n remaining instances, hence ensuring they remain consistent with each other.

    Since:
    8.0
    Author:
    Luc Maisonobe, Mélina Vanel
    • Constructor Detail

      • ParameterDriversList

        public ParameterDriversList()
        Creates an empty list.
    • Method Detail

      • add

        public void add​(ParameterDriver driver)
        Add a driver.

        If the driver is already present, it will not be added. If another driver managing the same parameter is present, both drivers will be managed together, existing drivers being set to the value of the last driver added (i.e. each addition overrides the parameter value).

        Warning if a driver is added and a driver with the same name was already added before, they should have the same validity Period to avoid surprises. Whatever, all driver having same name will have their valueSpanMap, nameSpanMap and validity period overwritten with the last driver added attributes.

        Parameters:
        driver - driver to add
      • findDelegatingSpanNameBySpanName

        public String findDelegatingSpanNameBySpanName​(String name)
        Find a delegating driver by name.
        Parameters:
        name - name to check
        Returns:
        a delegating driver managing this parameter name
        Since:
        9.1
      • sort

        public void sort()
        Sort the parameters lexicographically.
      • filter

        public void filter​(boolean selected)
        Filter parameters to keep only one type of selection status.
        Parameters:
        selected - if true, only selected parameters will be kept, the other ones will be removed
      • getNbParams

        public int getNbParams()
        Get the number of parameters with different names.
        Returns:
        number of parameters with different names
      • getNbValuesToEstimate

        public int getNbValuesToEstimate()
        Get the number of values to estimate for parameters with different names.
        Returns:
        number of values to estimate for parameters with different names
      • getDrivers

        public List<ParameterDriversList.DelegatingDriver> getDrivers()
        Get delegating drivers for all parameters.

        The delegating drivers are not the same as the drivers added to the list, but they delegate to them.

        All delegating drivers manage parameters with different names.

        Returns:
        unmodifiable view of the list of delegating drivers