/** * Restricted copy constructor. * @param beanToCopy the bean to copy from, not null */ private Builder(ScenarioMarketDataBox<T> beanToCopy) { this.value = beanToCopy.getValue(); }
@Override protected Object propertyGet(Bean bean, String propertyName, boolean quiet) { switch (propertyName.hashCode()) { case 111972721: // value return ((ScenarioMarketDataBox<?>) bean).getValue(); } return super.propertyGet(bean, propertyName, quiet); }
@Override public <R> MarketDataBox<R> mapWithIndex(int scenarioCount, ObjIntFunction<T, R> fn) { if (scenarioCount != getScenarioCount()) { throw new IllegalArgumentException( Messages.format( "Scenario count {} does not equal the scenario count of the value {}", scenarioCount, getScenarioCount())); } List<R> perturbedValues = IntStream.range(0, scenarioCount) .mapToObj(idx -> fn.apply(getValue(idx), idx)) .collect(toImmutableList()); return MarketDataBox.ofScenarioValues(perturbedValues); }