private IFormula createTableFormulaWithArgument(RateKey rateKey) { var formula = _objectBaseFactory.Create <TableFormulaWithXArgument>() .WithId(rateKey) .WithName(rateKey.Rate); var tableObjectPath = _rateObjectPathsRepository.PathWithAlias(rateKey, CoreConstants.Alias.TABLE); var xArgument = _rateObjectPathsRepository.PathWithAlias(rateKey, CoreConstants.Alias.XARG); if (tableObjectPath == null || xArgument == null) { throw new ArgumentException(PKSimConstants.Error.TableFormulaWithXReferenceMissingRefs(rateKey.ToString(), CoreConstants.Alias.TABLE, CoreConstants.Alias.XARG)); } formula.AddTableObjectPath(tableObjectPath); formula.AddXArgumentObjectPath(xArgument); //Table formula with reference has the same dimension as its referenced table object formula.Dimension = tableObjectPath.Dimension; return(formula); }
private IFormula createTableFormulaWithOffset(RateKey rateKey) { var formula = _objectBaseFactory.Create <TableFormulaWithOffset>() .WithId(rateKey) .WithName(rateKey.Rate); var tableObjectPath = _rateObjectPathsRepository.PathWithAlias(rateKey, CoreConstants.Alias.TABLE); var offsetObjectPath = _rateObjectPathsRepository.PathWithAlias(rateKey, CoreConstants.Alias.OFFSET); if ((tableObjectPath == null) || (offsetObjectPath == null)) { throw new ArgumentException( PKSimConstants.Error.TableFormulaWithOffsetMissingRefs(rateKey.ToString(), CoreConstants.Alias.TABLE, CoreConstants.Alias.OFFSET)); } formula.AddTableObjectPath(tableObjectPath.Clone <IFormulaUsablePath>()); formula.AddOffsetObjectPath(offsetObjectPath.Clone <IFormulaUsablePath>()); //Table formula with offest has the same dimension as its referenced table object formula.Dimension = tableObjectPath.Dimension; return(formula); }