public override void Build(IReactionBuilder reactionBuilder, OSPSuiteTracker buildTracker)
        {
            var listToReport = new List <object>();

            listToReport.AddRange(this.ReportDescription(reactionBuilder, buildTracker));

            listToReport.Add(String.Format(Constants.PROPERTY_PROMPT_FORMAT, Constants.MODE, reactionBuilder.Mode));

            listToReport.Add(new Paragraph(Constants.STOICHIOMETRY));
            listToReport.Add(_stoichiometricStringCreator.CreateFrom(reactionBuilder.Educts,
                                                                     reactionBuilder.Products));
            if (reactionBuilder.ModifierNames.Any())
            {
                listToReport.Add(new Paragraph(Constants.MODIFIERS));
                foreach (var modifier in reactionBuilder.ModifierNames)
                {
                    listToReport.Add(modifier);
                }
            }

            listToReport.Add(new Paragraph(Constants.KINETIC));
            listToReport.Add(reactionBuilder.Formula);

            if (reactionBuilder.Parameters.Any())
            {
                listToReport.Add(new Paragraph(Constants.PARAMETERS));
                listToReport.Add(reactionBuilder.Parameters.OrderBy(x => x.Name));
            }

            _builderRepository.Report(listToReport, buildTracker);
        }
Ejemplo n.º 2
0
        public ReactionDTO MapFrom(IReaction reaction)
        {
            var dto = Map <ReactionDTO>(reaction);

            dto.Icon           = ApplicationIcons.Reaction.IconName;
            dto.Kinetic        = reaction.Formula.ToString();
            dto.Stoichiometric = _stoichiometricStringCreator.CreateFrom(reaction.Educts, reaction.Products);
            return(dto);
        }
        public ReactionInfoDTO MapFrom(IReactionBuilder reactionBuilder)
        {
            var dto = Map <ReactionInfoDTO>(reactionBuilder);

            dto.StoichiometricFormula = _stoichiometricStringCreator.CreateFrom(reactionBuilder.Educts, reactionBuilder.Products);
            if (reactionBuilder.Formula != null)
            {
                dto.Kinetic = reactionBuilder.Formula.ToString();
                reactionBuilder.Formula.PropertyChanged += dto.FormulaChangedHandler;
            }
            return(dto);
        }
Ejemplo n.º 4
0
        public ObjectBaseSummaryDTO MapFrom(IReactionBuilder reactionBuilder)
        {
            var dto = new ObjectBaseSummaryDTO
            {
                ApplicationIcon = ApplicationIcons.Reaction,
                EntityName      = reactionBuilder.Name
            };

            dto.AddToDictionary(AppConstants.Captions.Type, _objectTypeResolver.TypeFor(reactionBuilder));
            dto.AddToDictionary(AppConstants.Captions.NumberOfParameters, reactionBuilder.Parameters.Count().ToString(CultureInfo.InvariantCulture));
            dto.AddToDictionary(AppConstants.Captions.Stoichiometry, _stoichiometricStringCreator.CreateFrom(reactionBuilder.Educts, reactionBuilder.Products));
            dto.AddToDictionary(AppConstants.Captions.Kinetic, reactionBuilder.Formula != null ? reactionBuilder.Formula.ToString() : string.Empty);

            return(dto);
        }
        public ReactionBuilderDTO MapFrom(IReactionBuilder reactionBuilder)
        {
            var dto = new ReactionBuilderDTO(reactionBuilder);

            MapProperties(reactionBuilder, dto);
            dto.StoichiometricFormula = _stoichiometricStringCreator.CreateFrom(reactionBuilder.Educts, reactionBuilder.Products);
            dto.Educts = reactionBuilder.Educts.MapAllUsing(_reactionPartnerBuilderToDTOReactionBuilderPartnerMapper).ToBindingList();
            dto.Educts.Each(item => item.IsEduct = true);
            dto.Products = reactionBuilder.Products.MapAllUsing(_reactionPartnerBuilderToDTOReactionBuilderPartnerMapper).ToBindingList();
            dto.Products.Each(item => item.IsEduct = false);

            if (reactionBuilder.Formula != null)
            {
                dto.Kinetic = reactionBuilder.Formula.ToString();
            }
            return(dto);
        }
Ejemplo n.º 6
0
        private Table tableFor(IMoBiReactionBuildingBlock buildingBlock)
        {
            var table = new DataTable(getTableCaption());

            table.Columns.Add(Constants.NAME, typeof(string));
            table.Columns.Add(Constants.STOICHIOMETRY, typeof(string)).SetAlignment(TableWriter.ColumnAlignments.l);
            table.Columns.Add(Constants.KINETIC, typeof(string)).SetAlignment(TableWriter.ColumnAlignments.l);

            table.BeginLoadData();
            foreach (var reaction in buildingBlock.OrderBy(b => b.Name))
            {
                var row = table.NewRow();
                row[Constants.NAME]          = DefaultConverter.Instance.StringToTeX(reaction.Name);
                row[Constants.STOICHIOMETRY] = FormulaConverter.Instance.StringToTeX(_stoichiometricStringCreator.CreateFrom(reaction.Educts, reaction.Products));
                row[Constants.KINETIC]       = FormulaConverter.Instance.StringToTeX(reaction.Formula.ToString());
                table.Rows.Add(row);
            }
            table.EndLoadData();

            return(new Table(table.DefaultView, table.TableName)
            {
                Converter = NoConverter.Instance
            });
        }
Ejemplo n.º 7
0
 private string getStoichiometricStringFromReactionBuilder(IReactionBuilder reactionBuilder)
 {
     return(_stoichiometricStringCreator.CreateFrom(reactionBuilder.Educts, reactionBuilder.Products));
 }