private IFormula R1Formula(IFormulaCache formulaCache) { var formula = formulaCache.FirstOrDefault(x => string.Equals(x.Name, "R1")); if (formula != null) { return(formula); } formula = _objectBaseFactory.Create <ExplicitFormula>().WithFormulaString("A+B").WithName("R1"); formula.AddObjectPath(_objectPathFactory.CreateFormulaUsablePathFrom(ObjectPath.PARENT_CONTAINER, "A", Constants.Parameters.CONCENTRATION) .WithAlias("A") .WithDimension(_concentrationDimension)); formula.AddObjectPath(_objectPathFactory.CreateFormulaUsablePathFrom(ObjectPath.PARENT_CONTAINER, "B", Constants.Parameters.CONCENTRATION) .WithAlias("B") .WithDimension(_concentrationDimension)); formula.WithDimension(_concentrationPerTimeDimension); formulaCache.Add(formula); return(formula); }
public override void Edit(IBuildingBlock objectToEdit) { _cache = objectToEdit.FormulaCache; _buildingBlock = objectToEdit; updateFormulasInView(_cache.FirstOrDefault()); }