public override EvaluationResult evaluate(Security security, CalculationFunctions functions, string firstToken, IList <string> remainingTokens) { MetaBean metaBean = MetaBean.of(security.GetType()); // security Optional <string> securityPropertyName = metaBean.metaPropertyMap().Keys.Where(p => p.equalsIgnoreCase(firstToken)).First(); if (securityPropertyName.Present) { object propertyValue = metaBean.metaProperty(securityPropertyName.get()).get((Bean)security); return(propertyValue != null?EvaluationResult.success(propertyValue, remainingTokens) : EvaluationResult.failure("Property '{}' not set", firstToken)); } // security info Optional <string> securityInfoPropertyName = security.Info.propertyNames().Where(p => p.equalsIgnoreCase(firstToken)).First(); if (securityInfoPropertyName.Present) { object propertyValue = security.Info.property(securityInfoPropertyName.get()).get(); return(propertyValue != null?EvaluationResult.success(propertyValue, remainingTokens) : EvaluationResult.failure("Property '{}' not set", firstToken)); } // security price info Optional <string> securityPriceInfoPropertyName = security.Info.PriceInfo.propertyNames().Where(p => p.equalsIgnoreCase(firstToken)).First(); if (securityPriceInfoPropertyName.Present) { object propertyValue = security.Info.PriceInfo.property(securityPriceInfoPropertyName.get()).get(); return(propertyValue != null?EvaluationResult.success(propertyValue, remainingTokens) : EvaluationResult.failure("Property '{}' not set", firstToken)); } // not found return(invalidTokenFailure(security, firstToken)); }
public override EvaluationResult evaluate(Trade trade, CalculationFunctions functions, string firstToken, IList <string> remainingTokens) { MetaBean metaBean = MetaBean.of(trade.GetType()); // trade Optional <string> tradePropertyName = metaBean.metaPropertyMap().Keys.Where(p => p.equalsIgnoreCase(firstToken)).First(); if (tradePropertyName.Present) { object propertyValue = metaBean.metaProperty(tradePropertyName.get()).get((Bean)trade); if (propertyValue == null) { return(EvaluationResult.failure("Property '{}' not set", firstToken)); } return(EvaluationResult.success(propertyValue, remainingTokens)); } // trade info Optional <string> tradeInfoPropertyName = trade.Info.propertyNames().Where(p => p.equalsIgnoreCase(firstToken)).First(); if (tradeInfoPropertyName.Present) { object propertyValue = trade.Info.property(tradeInfoPropertyName.get()).get(); if (propertyValue == null) { return(EvaluationResult.failure("Property '{}' not set", firstToken)); } return(EvaluationResult.success(propertyValue, remainingTokens)); } return(invalidTokenFailure(trade, firstToken)); }
public override EvaluationResult evaluate(Position position, CalculationFunctions functions, string firstToken, IList <string> remainingTokens) { MetaBean metaBean = MetaBean.of(position.GetType()); // position Optional <string> positionPropertyName = metaBean.metaPropertyMap().Keys.Where(p => p.equalsIgnoreCase(firstToken)).First(); if (positionPropertyName.Present) { object propertyValue = metaBean.metaProperty(positionPropertyName.get()).get((Bean)position); return(propertyValue != null?EvaluationResult.success(propertyValue, remainingTokens) : EvaluationResult.failure("Property '{}' not set", firstToken)); } // position info Optional <string> positionInfoPropertyName = position.Info.propertyNames().Where(p => p.equalsIgnoreCase(firstToken)).First(); if (positionInfoPropertyName.Present) { object propertyValue = position.Info.property(positionInfoPropertyName.get()).get(); return(propertyValue != null?EvaluationResult.success(propertyValue, remainingTokens) : EvaluationResult.failure("Property '{}' not set", firstToken)); } // not found return(invalidTokenFailure(position, firstToken)); }
static HalfUpRounding() { for (int i = 0; i < 16; i++) { CACHE[i] = new HalfUpRounding(i, 0); } MetaBean.register(HalfUpRounding.Meta.INSTANCE); }
//JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET: //ORIGINAL LINE: @Override public org.joda.beans.MetaProperty<?> findMetaProperty(Class beanType, org.joda.beans.MetaBean metaBean, String propertyName) public override MetaProperty <object> findMetaProperty(Type beanType, MetaBean metaBean, string propertyName) { try { return(metaBean.metaProperty(propertyName)); } catch (NoSuchElementException ex) { if (HOLIDAYS.name().Equals(propertyName)) { return(HOLIDAYS); } if (WEEKEND_DAYS.name().Equals(propertyName)) { return(WEEKEND_DAYS); } throw ex; } }
//JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET: //ORIGINAL LINE: @Override public org.joda.beans.MetaProperty<?> findMetaProperty(Class beanType, org.joda.beans.MetaBean metaBean, String propertyName) public override MetaProperty <object> findMetaProperty(Type beanType, MetaBean metaBean, string propertyName) { try { return(metaBean.metaProperty(propertyName)); } catch (NoSuchElementException ex) { if (BASE_CURRENCY_AMOUNT.name().Equals(propertyName)) { return(BASE_CURRENCY_AMOUNT); } if (COUNTER_CURRENCY_AMOUNT.name().Equals(propertyName)) { return(COUNTER_CURRENCY_AMOUNT); } if (PAYMENT_DATE.name().Equals(propertyName)) { return(PAYMENT_DATE); } throw ex; } }
static BlackFxOptionFlatVolatilities() { MetaBean.register(BlackFxOptionFlatVolatilities.Meta.INSTANCE); }
static BlackIborCapletFloorletExpiryStrikeVolatilities() { MetaBean.register(BlackIborCapletFloorletExpiryStrikeVolatilities.Meta.INSTANCE); }
static OvernightIborSwapTemplate() { MetaBean.register(OvernightIborSwapTemplate.Meta.INSTANCE); }
static ConstantRecoveryRates() { MetaBean.register(ConstantRecoveryRates.Meta.INSTANCE); }
static SwaptionSurfaceExpiryStrikeParameterMetadata() { MetaBean.register(SwaptionSurfaceExpiryStrikeParameterMetadata.Meta.INSTANCE); }
static CompositeCalculationFunctions() { MetaBean.register(META_BEAN); }
static DefaultFxOptionScenarioMarketData() { MetaBean.register(META_BEAN); }
static MoneynessStrike() { MetaBean.register(MoneynessStrike.Meta.INSTANCE); }
static FxSwapTemplate() { MetaBean.register(FxSwapTemplate.Meta.INSTANCE); }
static SimpleRatesProvider() { MetaBean.register(META_BEAN); }
static ResolvedBulletPaymentTrade() { MetaBean.register(ResolvedBulletPaymentTrade.Meta.INSTANCE); }
static InflationEndMonthRateComputation() { MetaBean.register(InflationEndMonthRateComputation.Meta.INSTANCE); }
static DummyPointSensitivity() { MetaBean.register(META_BEAN); }
static SeasonalityDefinition() { MetaBean.register(SeasonalityDefinition.Meta.INSTANCE); }
static ObjIntPair() { MetaBean.register(ObjIntPair.Meta.INSTANCE); }
static ConstantCurve() { MetaBean.register(ConstantCurve.Meta.INSTANCE); }
static ResolvedIborCapFloor() { MetaBean.register(ResolvedIborCapFloor.Meta.INSTANCE); }
static YearMonthDateParameterMetadata() { MetaBean.register(YearMonthDateParameterMetadata.Meta.INSTANCE); }
static FxRate() { MetaBean.register(FxRate.Meta.INSTANCE); }
static MockSerBean() { MetaBean.register(META_BEAN); }
static IndexQuoteId() { MetaBean.register(META_BEAN); }
static NotionalExchange() { MetaBean.register(NotionalExchange.Meta.INSTANCE); }
static IborCapletFloorletVolatilitiesId() { MetaBean.register(META_BEAN); }
static KnownAmountBondPaymentPeriod() { MetaBean.register(KnownAmountBondPaymentPeriod.Meta.INSTANCE); }