add method
void
add(
- Series series
Adds a cash flow series item to the series array.
Please note the order of addition is important for undated series items, as the internal computation of cash flow dates is inferred from the natural order of the series array. Hence a more recent undated series addition is deemed to follow on from another added previously.
Dated series are unaffected and will use the series start-date provided.
Implementation
void add(Series series) {
if (_isBespokeProfile) {
throw Exception('The add(series) option cannot be used with a '
'user-defined profile.');
}
// Coerce series monetary value to specified precision
if (series.value != null) {
final value = gaussRound(series.value!, _precision);
if (series is SeriesAdvance) {
series = series.copyWith(value: value);
} else if (series is SeriesPayment) {
series = series.copyWith(value: value);
} else if (series is SeriesCharge) {
series = series.copyWith(value: value);
}
}
_series.add(series);
}