@Override public DistinctMarketDataSelector findMatchingSelector( ValueSpecification valueSpecification, String calculationConfigurationName, SelectorResolver resolver) { if (_calcConfigNames != null && !_calcConfigNames.contains(calculationConfigurationName)) { return null; } if (!s_compatibleVRNames.contains(valueSpecification.getValueName())) { return null; } VolatilitySurfaceKey key = createKey(valueSpecification); if (!contains(_names, key.getName())) { return null; } if (_nameMatchPattern != null && !_nameMatchPattern.getPattern().matcher(key.getName()).matches()) { return null; } if (_nameLikePattern != null && !_nameLikePattern.getPattern().matcher(key.getName()).matches()) { return null; } if (!contains(_instrumentTypes, key.getInstrumentType())) { return null; } if (!contains(_quoteTypes, key.getQuoteType())) { return null; } if (!contains(_quoteUnits, key.getQuoteUnits())) { return null; } return this; }
/* package */ VolatilitySurfaceSelector( Set<String> calcConfigNames, Set<String> names, Pattern nameMatchPattern, Pattern nameLikePattern, Set<String> instrumentTypes, Set<String> quoteTypes, Set<String> quoteUnits) { _calcConfigNames = calcConfigNames; _names = names; _nameMatchPattern = PatternWrapper.wrap(nameMatchPattern); _nameLikePattern = PatternWrapper.wrap(nameLikePattern); _instrumentTypes = instrumentTypes; _quoteTypes = quoteTypes; _quoteUnits = quoteUnits; }
/* package */ Pattern getNameLikePattern() { return _nameLikePattern == null ? null : _nameLikePattern.getPattern(); }