public class ParameterDriversList extends Object
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.
Modifier and Type | Class and Description |
---|---|
static class |
ParameterDriversList.DelegatingDriver
Specialized driver delegating to several other managing
the same parameter name.
|
Constructor and Description |
---|
ParameterDriversList()
Creates an empty list.
|
Modifier and Type | Method and Description |
---|---|
void |
add(ParameterDriver driver)
Add a driver.
|
void |
filter(boolean selected)
Filter parameters to keep only one type of selection status.
|
ParameterDriversList.DelegatingDriver |
findByName(String name)
Find a
delegating driver by name. |
String |
findDelegatingSpanNameBySpanName(String name)
Find a
delegating driver by name. |
List<ParameterDriversList.DelegatingDriver> |
getDrivers()
Get delegating drivers for all parameters.
|
int |
getNbParams()
Get the number of parameters with different names.
|
int |
getNbValuesToEstimate()
Get the number of values to estimate for parameters with different names.
|
void |
sort()
Sort the parameters lexicographically.
|
public void add(ParameterDriver 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.
driver
- driver to addpublic ParameterDriversList.DelegatingDriver findByName(String name)
delegating driver
by name.name
- name to checkdelegating driver
managing this parameter namepublic String findDelegatingSpanNameBySpanName(String name)
delegating driver
by name.name
- name to checkdelegating driver
managing this parameter namepublic void sort()
public void filter(boolean selected)
selected
- if true, only selected
parameters will be kept, the other ones will be removedpublic int getNbParams()
public int getNbValuesToEstimate()
public List<ParameterDriversList.DelegatingDriver> getDrivers()
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.
Copyright © 2002-2023 CS GROUP. All rights reserved.