}
@Override
public Collection<Currency> visitSwapSecurity(final SwapSecurity security) {
if (security.getPayLeg().getNotional() instanceof InterestRateNotional && security.getReceiveLeg().getNotional() instanceof InterestRateNotional) {
final InterestRateNotional payLeg = (InterestRateNotional) security.getPayLeg().getNotional();
final InterestRateNotional receiveLeg = (InterestRateNotional) security.getReceiveLeg().getNotional();
if (payLeg.getCurrency().equals(receiveLeg.getCurrency())) {
return Collections.singletonList(payLeg.getCurrency());
} else {
final Collection<Currency> collection = new ArrayList<Currency>();
collection.add(payLeg.getCurrency());
collection.add(receiveLeg.getCurrency());
return collection;
}
}
return null;
}
@Override
public Collection<Currency> visitForwardSwapSecurity(final ForwardSwapSecurity security) {
if (security.getPayLeg().getNotional() instanceof InterestRateNotional && security.getReceiveLeg().getNotional() instanceof InterestRateNotional) {
final InterestRateNotional payLeg = (InterestRateNotional) security.getPayLeg().getNotional();
final InterestRateNotional receiveLeg = (InterestRateNotional) security.getReceiveLeg().getNotional();
if (payLeg.getCurrency().equals(receiveLeg.getCurrency())) {
return Collections.singletonList(payLeg.getCurrency());
} else {
final Collection<Currency> collection = new ArrayList<Currency>();
collection.add(payLeg.getCurrency());
collection.add(receiveLeg.getCurrency());
return collection;
}
}
return null;
}
@Override
public Collection<Currency> visitEquityIndexOptionSecurity(final EquityIndexOptionSecurity security) {
return Collections.singletonList(security.getCurrency());
}
@Override
public Collection<Currency> visitEquityOptionSecurity(final EquityOptionSecurity security) {
return Collections.singletonList(security.getCurrency());
}
@Override
public Collection<Currency> visitEquityBarrierOptionSecurity(final EquityBarrierOptionSecurity security) {
return Collections.singletonList(security.getCurrency());
}
@Override
public Collection<Currency> visitFXOptionSecurity(final FXOptionSecurity security) {
final Collection<Currency> currencies = new ArrayList<Currency>();
currencies.add(security.getCallCurrency());
currencies.add(security.getPutCurrency());
return currencies;
}
@Override
public Collection<Currency> visitNonDeliverableFXOptionSecurity(final NonDeliverableFXOptionSecurity security) {
final Collection<Currency> currencies = new ArrayList<Currency>();
currencies.add(security.getCallCurrency());
currencies.add(security.getPutCurrency());
//deliveryCurrency is always already covered
return currencies;
}
@Override
public Collection<Currency> visitSwaptionSecurity(final SwaptionSecurity security) {
// REVIEW: jim 1-Aug-2011 -- should we include the currencies of the underlying?
return Collections.singletonList(security.getCurrency());
}
@Override
public Collection<Currency> visitIRFutureOptionSecurity(final IRFutureOptionSecurity security) {
return Collections.singletonList(security.getCurrency());
}
@Override
public Collection<Currency> visitCommodityFutureOptionSecurity(final CommodityFutureOptionSecurity commodityFutureOptionSecurity) {
return Collections.singleton(commodityFutureOptionSecurity.getCurrency());
}
@Override
public Collection<Currency> visitFxFutureOptionSecurity(final FxFutureOptionSecurity security) {
return Collections.singleton(security.getCurrency());
}
@Override
public Collection<Currency> visitBondFutureOptionSecurity(final BondFutureOptionSecurity security) {
return Collections.singletonList(security.getCurrency());
}
@Override
public Collection<Currency> visitEquityIndexDividendFutureOptionSecurity(final EquityIndexDividendFutureOptionSecurity security) {
return Collections.singletonList(security.getCurrency());
}
@Override
public Collection<Currency> visitEquityIndexFutureOptionSecurity(final EquityIndexFutureOptionSecurity security) {
return Collections.singletonList(security.getCurrency());
}
@Override
public Collection<Currency> visitFXBarrierOptionSecurity(final FXBarrierOptionSecurity security) {
final Collection<Currency> currencies = new ArrayList<Currency>();
currencies.add(security.getCallCurrency());
currencies.add(security.getPutCurrency());
return currencies;
}
@Override
public Collection<Currency> visitFXForwardSecurity(final FXForwardSecurity security) {
final Collection<Currency> currencies = new ArrayList<Currency>();
currencies.add(security.getPayCurrency());
currencies.add(security.getReceiveCurrency());
return currencies;
}
@Override
public Collection<Currency> visitNonDeliverableFXForwardSecurity(final NonDeliverableFXForwardSecurity security) {
final Collection<Currency> currencies = new ArrayList<Currency>();
currencies.add(security.getPayCurrency());
currencies.add(security.getReceiveCurrency());
return currencies;
}
@Override
public Collection<Currency> visitCapFloorSecurity(final CapFloorSecurity security) {
return Collections.singletonList(security.getCurrency());
}
@Override
public Collection<Currency> visitCapFloorCMSSpreadSecurity(final CapFloorCMSSpreadSecurity security) {
return Collections.singletonList(security.getCurrency());
}
@Override
public Collection<Currency> visitEquityVarianceSwapSecurity(final EquityVarianceSwapSecurity security) {
return Collections.singletonList(security.getCurrency());
}
@Override
public Collection<Currency> visitFXDigitalOptionSecurity(final FXDigitalOptionSecurity security) {
final Collection<Currency> currencies = new ArrayList<Currency>();
currencies.add(security.getCallCurrency());
currencies.add(security.getPutCurrency());
return currencies;
}
@Override
public Collection<Currency> visitNonDeliverableFXDigitalOptionSecurity(final NonDeliverableFXDigitalOptionSecurity security) {
final Collection<Currency> currencies = new ArrayList<Currency>();
currencies.add(security.getCallCurrency());
currencies.add(security.getPutCurrency());
return currencies;
}
@Override
public Collection<Currency> visitSimpleZeroDepositSecurity(final SimpleZeroDepositSecurity security) {
return Collections.singletonList(security.getCurrency());
}
@Override
public Collection<Currency> visitPeriodicZeroDepositSecurity(final PeriodicZeroDepositSecurity security) {
return Collections.singletonList(security.getCurrency());
}
@Override
public Collection<Currency> visitContinuousZeroDepositSecurity(final ContinuousZeroDepositSecurity security) {
return Collections.singletonList(security.getCurrency());
}
@Override
public Collection<Currency> visitAgricultureFutureSecurity(final AgricultureFutureSecurity security) {
return Collections.singletonList(security.getCurrency());
}
@Override
public Collection<Currency> visitBondFutureSecurity(final BondFutureSecurity security) {
return Collections.singletonList(security.getCurrency());
}
@Override
public Collection<Currency> visitEnergyFutureSecurity(final EnergyFutureSecurity security) {
return Collections.singletonList(security.getCurrency());
}
@Override
public Collection<Currency> visitEquityFutureSecurity(final EquityFutureSecurity security) {
return Collections.singletonList(security.getCurrency());
}
@Override
public Collection<Currency> visitEquityIndexDividendFutureSecurity(final EquityIndexDividendFutureSecurity security) {
return Collections.singletonList(security.getCurrency());
}
@Override
public Collection<Currency> visitFXFutureSecurity(final FXFutureSecurity security) {
return Collections.singletonList(security.getCurrency());
}
@Override
public Collection<Currency> visitIndexFutureSecurity(final IndexFutureSecurity security) {
return Collections.singletonList(security.getCurrency());
}
@Override
public Collection<Currency> visitInterestRateFutureSecurity(final InterestRateFutureSecurity security) {
return Collections.singletonList(security.getCurrency());
}
@Override
public Collection<Currency> visitFederalFundsFutureSecurity(final FederalFundsFutureSecurity security) {
return Collections.singletonList(security.getCurrency());
}
@Override
public Collection<Currency> visitMetalFutureSecurity(final MetalFutureSecurity security) {
return Collections.singletonList(security.getCurrency());
}
@Override
public Collection<Currency> visitStockFutureSecurity(final StockFutureSecurity security) {
return Collections.singletonList(security.getCurrency());
}
@Override
public Collection<Currency> visitAgricultureForwardSecurity(final AgricultureForwardSecurity security) {
return Collections.singletonList(security.getCurrency());
}
@Override
public Collection<Currency> visitEnergyForwardSecurity(final EnergyForwardSecurity security) {
return Collections.singletonList(security.getCurrency());
}
@Override
public Collection<Currency> visitMetalForwardSecurity(final MetalForwardSecurity security) {
return Collections.singletonList(security.getCurrency());
}
@Override
public Collection<Currency> visitCDSSecurity(final CDSSecurity security) {
return Collections.singletonList(security.getCurrency());
}
@Override
public Collection<Currency> visitStandardVanillaCDSSecurity(final StandardVanillaCDSSecurity security) {
return Collections.singletonList(security.getNotional().getCurrency());
}
@Override
public Collection<Currency> visitStandardFixedRecoveryCDSSecurity(final StandardFixedRecoveryCDSSecurity security) {
return Collections.singletonList(security.getNotional().getCurrency());
}
@Override
public Collection<Currency> visitStandardRecoveryLockCDSSecurity(final StandardRecoveryLockCDSSecurity security) {
return Collections.singletonList(security.getNotional().getCurrency());
}
@Override
public Collection<Currency> visitLegacyVanillaCDSSecurity(final LegacyVanillaCDSSecurity security) {
return Collections.singletonList(security.getNotional().getCurrency());
}
@Override
public Collection<Currency> visitLegacyFixedRecoveryCDSSecurity(final LegacyFixedRecoveryCDSSecurity security) {
return Collections.singletonList(security.getNotional().getCurrency());
}
@Override
public Collection<Currency> visitLegacyRecoveryLockCDSSecurity(final LegacyRecoveryLockCDSSecurity security) {
return Collections.singletonList(security.getNotional().getCurrency());
}
@Override
public Collection<Currency> visitDeliverableSwapFutureSecurity(final DeliverableSwapFutureSecurity security) {
return Collections.singletonList(security.getCurrency());
}
@Override
public Collection<Currency> visitCreditDefaultSwapIndexDefinitionSecurity(final CreditDefaultSwapIndexDefinitionSecurity security) {
return Collections.singletonList(security.getCurrency());
}
@Override
public Collection<Currency> visitCreditDefaultSwapIndexSecurity(final CreditDefaultSwapIndexSecurity security) {
return Collections.singletonList(security.getNotional().getCurrency());
}
@Override
public Collection<Currency> visitCreditDefaultSwapOptionSecurity(final CreditDefaultSwapOptionSecurity security) {
return Collections.singletonList(security.getCurrency());
}
@Override
public Collection<Currency> visitZeroCouponInflationSwapSecurity(final ZeroCouponInflationSwapSecurity security) {
if (security.getPayLeg().getNotional() instanceof InterestRateNotional && security.getReceiveLeg().getNotional() instanceof InterestRateNotional) {
final InterestRateNotional payLeg = (InterestRateNotional) security.getPayLeg().getNotional();
final InterestRateNotional receiveLeg = (InterestRateNotional) security.getReceiveLeg().getNotional();
if (payLeg.getCurrency().equals(receiveLeg.getCurrency())) {
return Collections.singletonList(payLeg.getCurrency());
}
final Collection<Currency> collection = new ArrayList<Currency>();
collection.add(payLeg.getCurrency());
collection.add(receiveLeg.getCurrency());
return collection;
}
return null;
}
@Override
public Collection<Currency> visitYearOnYearInflationSwapSecurity(final YearOnYearInflationSwapSecurity security) {
if (security.getPayLeg().getNotional() instanceof InterestRateNotional && security.getReceiveLeg().getNotional() instanceof InterestRateNotional) {
final InterestRateNotional payLeg = (InterestRateNotional) security.getPayLeg().getNotional();
final InterestRateNotional receiveLeg = (InterestRateNotional) security.getReceiveLeg().getNotional();
if (payLeg.getCurrency().equals(receiveLeg.getCurrency())) {
return Collections.singletonList(payLeg.getCurrency());
}
final Collection<Currency> collection = new ArrayList<Currency>();
collection.add(payLeg.getCurrency());
collection.add(receiveLeg.getCurrency());
return collection;
}
return null;
}