@Override public boolean isCompatible(MarketDataSpecification marketDataSpec) { if (!(marketDataSpec instanceof CombinedMarketDataSpecification)) { return false; } CombinedMarketDataSpecification combinedMarketDataSpec = (CombinedMarketDataSpecification) marketDataSpec; return _preferred.isCompatible(combinedMarketDataSpec.getPreferredSpecification()) && _fallBack.isCompatible(combinedMarketDataSpec.getFallbackSpecification()); }
@Override public MarketDataSnapshot snapshot(MarketDataSpecification marketDataSpec) { CombinedMarketDataSpecification combinedSpec = (CombinedMarketDataSpecification) marketDataSpec; Map<MarketDataProvider, MarketDataSnapshot> snapByProvider = new HashMap<MarketDataProvider, MarketDataSnapshot>(); snapByProvider.put(_preferred, _preferred.snapshot(combinedSpec.getPreferredSpecification())); snapByProvider.put(_fallBack, _fallBack.snapshot(combinedSpec.getFallbackSpecification())); MarketDataSnapshot preferredSnap = snapByProvider.get(_preferred); return new CombinedMarketDataSnapshot(preferredSnap, snapByProvider, this); }