protected override void SetAddCommandDescription(TBuildingBlock newEntity, IMoBiProject parent, IMoBiCommand addCommand, MoBiMacroCommand macroCommand, IBuildingBlock buildingBlock) { addCommand.Description = AppConstants.Commands.AddToProjectDescription(addCommand.ObjectType, newEntity.Name); macroCommand.Description = addCommand.Description; }
public override IMoBiCommand GetRemoveCommand(TBuildingBlock objectToRemove, IMoBiProject parent, IBuildingBlock buildingBlock) { return(new RemoveBuildingBlockCommand <TBuildingBlock>(objectToRemove)); }
public override IMoBiCommand GetAddCommand(TBuildingBlock itemToAdd, IMoBiProject parent, IBuildingBlock buildingBlock) { return(new AddBuildingBlockCommand <TBuildingBlock>(itemToAdd)); }
private IParameter searchParamterInSpatialStructures(IObjectPath parameterPath, IParameterStartValuesBuildingBlock parent, IMoBiProject project) { IParameter parameter = searchParameterInContainers(parameterPath, project.SpatialStructureCollection.FirstOrDefault(ss => ss.Id.Equals(parent.SpatialStructureId))); if (parameter == null) { foreach (var spatialStructure in project.SpatialStructureCollection) { parameter = searchParameterInContainers(parameterPath, spatialStructure); if (parameter != null) { break; } } } return(parameter); }
/// <summary> /// Parses a SBML MathML expression into a MoBi Formula. /// </summary> /// <param name="rootNode"></param> /// <param name="rootObjectId"> The id of the parent object of the rootNode to set the name of </param> /// <param name="isRateRule"></param> /// <param name="sbmlProject"></param> /// <param name="sbmlInformation"></param> public IFormula Parse(ASTNode rootNode, string rootObjectId, bool isRateRule, IMoBiProject sbmlProject, SBMLInformation sbmlInformation) { try { _sbmlProject = sbmlProject; _sbmlInformation = sbmlInformation; _objectPaths.Clear(); _counter++; var formulaString = Eval(rootNode); if (string.IsNullOrEmpty(formulaString)) { return(null); } var formula = _objectBaseFactory.Create <ExplicitFormula>() .WithName(rootObjectId + _counter) .WithFormulaString(formulaString); if (isRateRule) { getObjectPathName(ObjectPath.PARENT_CONTAINER, rootObjectId); } foreach (var path in _objectPaths.Where(path => path != null)) { formula.AddObjectPath(path); } if (string.IsNullOrEmpty(formula?.FormulaString)) { createErrorMsg(rootNode); return(null); } else { return(formula); } } finally { _sbmlProject = null; _sbmlInformation = null; } }
private IParameter searchParameterInMolecules(IParameterStartValue psv, IParameterStartValuesBuildingBlock parent, IMoBiProject project) { var parameterName = psv.Path.Last(); var tmpPath = psv.Path.Clone <IObjectPath>(); tmpPath.Remove(tmpPath.Last()); var moleculeName = tmpPath.Last(); var parameter = searchParameterInMoleculeBuildingBlock(project.MoleculeBlockCollection.FirstOrDefault(mb => mb.Id.Equals(parent.MoleculeBuildingBlockId)), moleculeName, parameterName); foreach (var moleculeBuildingBlock in project.MoleculeBlockCollection) { parameter = searchParameterInMoleculeBuildingBlock(moleculeBuildingBlock, moleculeName, parameterName); if (parameter != null) { break; } } return(parameter); }
private IParameter searchParamterInSpatialStructures(IParameterStartValue psv, IParameterStartValuesBuildingBlock parent, IMoBiProject project) { var parameterPath = psv.Path; IParameter parameter = searchParamterInSpatialStructures(parameterPath, parent, project); if (parameter == null) { parameterPath = psv.Path.Clone <IObjectPath>(); var parameterName = parameterPath.Last(); parameterPath.Remove(parameterName); var tmp = parameterPath.Last(); parameterPath.Remove(tmp); parameterPath.Add(Constants.MOLECULE_PROPERTIES); parameterPath.Add(parameterName); parameter = searchParamterInSpatialStructures(parameterPath, parent, project); } return(parameter); }
private IParameter searchParameterInSimulations(IParameterStartValue psv, IParameterStartValuesBuildingBlock parent, IMoBiProject project) { IParameter parameter = null; var simulations = project.Simulations.Where(sim => usesParameterStartValuesBB(sim, parent)); foreach (var simulation in simulations) { parameter = psv.Path.TryResolve <IParameter>(simulation.Model.Root); if (parameter != null) { break; } } return(parameter); }
public IDimension GetDimensionFor(IParameterStartValue psv, IParameterStartValuesBuildingBlock parameterStartValuesBuildingBlock, IMoBiProject project) { if (project == null) { return(null); } var parameter = searchParameterInSimulations(psv, parameterStartValuesBuildingBlock, project) ?? searchParamterInSpatialStructures(psv, parameterStartValuesBuildingBlock, project) ?? searchParameterInMolecules(psv, parameterStartValuesBuildingBlock, project); return(parameter == null ? null : parameter.Dimension); }
public override void GlobalContext() { base.GlobalContext(); _project = LoadProject("SimpleProject_341"); _simulation = _project.Simulations.First(); }
private void addToProject(IMoBiProject project) { project.AddBuildingBlock(_buildingBlock); }
public override ISimulationSettings CreateNewEntity(IMoBiProject moleculeBuildingBlock) { return(_simulationSettingsFactory.CreateDefault()); }
public (int convertedToVersion, bool conversionHappened) ConvertXml(XElement element, IMoBiProject project) { return(_coreConverter.ConvertXml(element)); }
public (int convertedToVersion, bool conversionHappened) Convert(object objectToUpdate, IMoBiProject project) { return(_coreConverter.Convert(objectToUpdate)); }