Пример #1
0
        /// <summary>
        ///     This is for the special Species Assignment in a RateRule.
        /// </summary>
        private void DoSpeciesAssignment(Rule rule)
        {
            var formula = _astHandler.Parse(rule.getMath(), rule.getVariable(), true, _sbmlProject, _sbmlInformation);

            if (formula == null)
            {
                return;
            }
            var reactionBuilder = ObjectBaseFactory.Create <IReactionBuilder>()
                                  .WithName(SBMLConstants.RATE_RULE + rule.getMetaId())
                                  .WithFormula(formula);

            var product = CreateProduct(rule.getVariable());

            reactionBuilder.AddProduct(product);

            var rbb = GetMainReactionBuildingBlock();

            if (rbb == null)
            {
                rbb = _reactionBuildingBlockFactory.Create()
                      .WithName(SBMLConstants.SBML_REACTION_BB);
                _context.AddToHistory(new AddBuildingBlockCommand <IMoBiReactionBuildingBlock>(rbb));
            }
            rbb.FormulaCache.Add(formula);
            rbb.Add(reactionBuilder);
        }
Пример #2
0
 public ReactionImporter(IObjectPathFactory objectPathFactory, IObjectBaseFactory objectBaseFactory, IMoBiDimensionFactory moBiDimensionFactory, ASTHandler astHandler, IMoBiContext context, IReactionBuildingBlockFactory reactionBuildingBlockFactory)
     : base(objectPathFactory, objectBaseFactory, astHandler, context)
 {
     _dimensionFactory              = moBiDimensionFactory;
     ReactionBuilderList            = new List <IReactionBuilder>();
     _passiveTransportList          = new List <ITransportBuilder>();
     _reactionBuildingBlock         = reactionBuildingBlockFactory.Create().WithName(SBMLConstants.SBML_REACTION_BB);
     _passiveTransportBuildingBlock = ObjectBaseFactory.Create <IPassiveTransportBuildingBlock>()
                                      .WithName(SBMLConstants.SBML_PASSIVETRANSPORTS_BB);
 }
Пример #3
0
 private void generateDefaultsInCurrentProject()
 {
     addDefault <IMoleculeBuildingBlock>(AppConstants.DefaultNames.MoleculeBuildingBlock);
     addDefault(AppConstants.DefaultNames.ReactionBuildingBlock, () => _reactionBuildingBlockFactory.Create());
     addDefault(AppConstants.DefaultNames.SpatialStructure, () => _spatialStructureFactory.CreateDefault(AppConstants.DefaultNames.SpatialStructure));
     addDefault <IPassiveTransportBuildingBlock>(AppConstants.DefaultNames.PassiveTransportBuildingBlock);
     addDefault <IEventGroupBuildingBlock>(AppConstants.DefaultNames.EventBuildingBlock);
     addDefault <IObserverBuildingBlock>(AppConstants.DefaultNames.ObserverBuildingBlock);
     addDefault(AppConstants.DefaultNames.SimulationSettings, _simulationSettingsFactory.CreateDefault);
 }
Пример #4
0
 public override IMoBiReactionBuildingBlock CreateNewEntity(IMoBiProject parent)
 {
     return(_reactionBuildingBlockFactory.Create());
 }