コード例 #1
0
        public virtual void test_empty()
        {
            ScenarioMarketData test = ScenarioMarketData.empty();

            assertThat(test.ValuationDate).isEqualTo(MarketDataBox.empty());
            assertThat(test.containsValue(ID1)).False;
            assertThat(test.containsValue(ID2)).False;
            assertThrows(() => test.getValue(ID1), typeof(MarketDataNotFoundException));
            assertThrows(() => test.getValue(ID2), typeof(MarketDataNotFoundException));
            assertThat(test.findValue(ID1)).Empty;
            assertThat(test.findValue(ID2)).Empty;
            assertThat(test.Ids).isEqualTo(ImmutableSet.of());
            assertThat(test.getTimeSeries(ID1)).isEqualTo(LocalDateDoubleTimeSeries.empty());
            assertThat(test.getTimeSeries(ID2)).isEqualTo(LocalDateDoubleTimeSeries.empty());
        }
コード例 #2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Override @SuppressWarnings("unchecked") public <R> java.util.Optional<MarketDataBox<R>> findValue(com.opengamma.strata.data.MarketDataId<R> id)
        public Optional <MarketDataBox <R> > findValue <R>(MarketDataId <R> id)
        {
            if (this.id.Equals(id))
            {
                return((MarketDataBox <R>)value);
            }
            return(underlying.findValue(id));
        }
コード例 #3
0
        public virtual void test_of_noScenarios()
        {
//JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET:
//ORIGINAL LINE: java.util.Map<com.opengamma.strata.data.MarketDataId<?>, MarketDataBox<?>> dataMap = com.google.common.collect.ImmutableMap.of(ID1, MarketDataBox.empty());
            IDictionary <MarketDataId <object>, MarketDataBox <object> > dataMap = ImmutableMap.of(ID1, MarketDataBox.empty());
            ScenarioMarketData test = ScenarioMarketData.of(0, VAL_DATE, dataMap, ImmutableMap.of());

            assertThat(test.ValuationDate).isEqualTo(MarketDataBox.ofSingleValue(VAL_DATE));
            assertThat(test.containsValue(ID1)).True;
            assertThat(test.containsValue(ID2)).False;
            assertThat(test.getValue(ID1)).isEqualTo(MarketDataBox.empty());
            assertThrows(() => test.getValue(ID2), typeof(MarketDataNotFoundException));
            assertThat(test.findValue(ID1)).hasValue(MarketDataBox.empty());
            assertThat(test.findValue(ID2)).Empty;
            assertThat(test.Ids).isEqualTo(ImmutableSet.of(ID1));
            assertThat(test.getTimeSeries(ID1)).isEqualTo(LocalDateDoubleTimeSeries.empty());
            assertThat(test.getTimeSeries(ID2)).isEqualTo(LocalDateDoubleTimeSeries.empty());
        }
コード例 #4
0
        public override MarketDataBox <T> getValue <T>(MarketDataId <T> id)
        {
            Optional <MarketDataBox <T> > value1 = underlying1.findValue(id);

            return(value1.Present ? value1.get() : underlying2.getValue(id));
        }
コード例 #5
0
        public Optional <MarketDataBox <T> > findValue <T>(MarketDataId <T> id)
        {
            Optional <MarketDataBox <T> > value1 = underlying1.findValue(id);

            return(value1.Present ? value1 : underlying2.findValue(id));
        }
コード例 #6
0
        public Optional <T> findValue <T>(MarketDataId <T> id)
        {
            Optional <MarketDataBox <T> > optionalBox = marketData.findValue(id);

            return(optionalBox.map(box => box.getValue(scenarioIndex)));
        }