/** * Adds market data values for each scenario. * <p> * Each value in the map is a market data box. * Any existing value with the same identifier will be replaced. * * @param values the items of market data, keyed by identifier * @return this builder */ public ImmutableScenarioMarketDataBuilder addBoxMap( Map<? extends MarketDataId<?>, ? extends MarketDataBox<?>> values) { ArgChecker.notNull(values, "values"); for (Entry<? extends MarketDataId<?>, ? extends MarketDataBox<?>> entry : values.entrySet()) { MarketDataId<?> id = entry.getKey(); MarketDataBox<?> box = entry.getValue(); checkBoxType(id, box); checkAndUpdateScenarioCount(box); this.values.put(id, box); } return this; }
/** * Adds market data wrapped in a box. * <p> * Any existing value with the same identifier will be replaced. * * @param id the identifier * @param value the market data value * @param <T> the type of the market data value * @return this builder */ public <T> ImmutableScenarioMarketDataBuilder addBox(MarketDataId<T> id, MarketDataBox<? extends T> value) { ArgChecker.notNull(id, "id"); ArgChecker.notNull(value, "value"); checkAndUpdateScenarioCount(value); values.put(id, value); return this; }
/** * Adds market data values that are valid for all scenarios. * <p> * Each value in the map is a single item of market data used in all scenarios. * Any existing value with the same identifier will be replaced. * * @param values the items of market data, keyed by identifier * @return this builder */ public ImmutableScenarioMarketDataBuilder addValueMap(Map<? extends MarketDataId<?>, ?> values) { ArgChecker.notNull(values, "values"); for (Entry<? extends MarketDataId<?>, ?> entry : values.entrySet()) { MarketDataId<?> id = entry.getKey(); Object value = entry.getValue(); MarketDataBox<?> box = MarketDataBox.ofSingleValue(value); checkBoxType(id, box); checkAndUpdateScenarioCount(box); this.values.put(id, box); } return this; }
/** * Adds market data values for each scenario. * <p> * Each value in the map contains multiple market data items, one for each scenario. * Any existing value with the same identifier will be replaced. * * @param values the items of market data, keyed by identifier * @return this builder */ public ImmutableScenarioMarketDataBuilder addScenarioValueMap( Map<? extends MarketDataId<?>, ? extends ScenarioArray<?>> values) { ArgChecker.notNull(values, "values"); for (Entry<? extends MarketDataId<?>, ? extends ScenarioArray<?>> entry : values.entrySet()) { MarketDataId<?> id = entry.getKey(); ScenarioArray<?> value = entry.getValue(); MarketDataBox<?> box = MarketDataBox.ofScenarioValue(value); checkBoxType(id, box); checkAndUpdateScenarioCount(box); this.values.put(id, box); } return this; }
/** * Adds market data for each scenario. * <p> * Any existing value with the same identifier will be replaced. * * @param id the identifier * @param values the market data values, one for each scenario * @param <T> the type of the market data values * @return this builder */ public <T> ImmutableScenarioMarketDataBuilder addScenarioValue(MarketDataId<T> id, List<? extends T> values) { ArgChecker.notNull(id, "id"); ArgChecker.notNull(values, "values"); MarketDataBox<? extends T> box = MarketDataBox.ofScenarioValues(values); checkAndUpdateScenarioCount(box); this.values.put(id, box); return this; }
/** * Adds market data for each scenario. * <p> * Any existing value with the same identifier will be replaced. * * @param id the identifier * @param value the market data values, one for each scenario * @param <T> the type of the market data values * @return this builder */ public <T> ImmutableScenarioMarketDataBuilder addScenarioValue(MarketDataId<T> id, ScenarioArray<? extends T> value) { ArgChecker.notNull(id, "id"); ArgChecker.notNull(value, "values"); MarketDataBox<? extends T> box = MarketDataBox.ofScenarioValue(value); checkAndUpdateScenarioCount(box); this.values.put(id, box); return this; }