예제 #1
0
        public IReaction MapFromLocal(IReactionBuilder reactionBuilder, IContainer container, IBuildConfiguration buildConfiguration)
        {
            var reaction = _objectBaseFactory.Create <IReaction>()
                           .WithName(reactionBuilder.Name)
                           .WithDescription(reactionBuilder.Description)
                           .WithIcon(reactionBuilder.Icon)
                           .WithDimension(reactionBuilder.Dimension)
                           .WithFormula(createReactionKinetic(reactionBuilder, buildConfiguration));

            reactionBuilder.Educts.Each(reactionPartnerBuilder => reaction.AddEduct(_reactionPartnerMapper.MapFromLocal(reactionPartnerBuilder, container, buildConfiguration)));
            reactionBuilder.Products.Each(reactionPartnerBuilder => reaction.AddProduct(_reactionPartnerMapper.MapFromLocal(reactionPartnerBuilder, container, buildConfiguration)));
            reactionBuilder.ModifierNames.Each(reaction.AddModifier);

            reaction.AddChildren(_parameterMapper.MapLocalFrom(reactionBuilder, buildConfiguration));

            if (reactionBuilder.CreateProcessRateParameter)
            {
                reaction.Add(processRateParameterFor(reactionBuilder, buildConfiguration));
            }

            buildConfiguration.AddBuilderReference(reaction, reactionBuilder);
            return(reaction);
        }
예제 #2
0
        public IMoleculeAmount MapFrom(IMoleculeBuilder moleculeBuilder, IBuildConfiguration buildConfiguration)
        {
            //molecule amount always in amount
            var moleculeAmount = _objectBaseFactory.Create <IMoleculeAmount>()
                                 .WithName(moleculeBuilder.Name)
                                 .WithDescription(moleculeBuilder.Description)
                                 .WithContainerType(ContainerType.Molecule)
                                 .WithIcon(moleculeBuilder.Icon)
                                 .WithQuantityType(moleculeBuilder.QuantityType)
                                 .WithDimension(_amountDimension)
                                 .WithDisplayUnit(_amountDimension.UnitOrDefault(_amountDimension.DefaultUnit.Name));

            buildConfiguration.AddBuilderReference(moleculeAmount, moleculeBuilder);

            createMoleculeAmountDefaultFormula(moleculeBuilder, buildConfiguration, moleculeAmount);

            //map parameters. Only parameters having BuildMode="Local" will
            //be added to the molecule amount. Global/Property-Parameters
            //will be filled in elsewhere (by the GlobalProperties-Mapper)
            moleculeAmount.AddChildren(_parameterMapper.MapLocalFrom(moleculeBuilder, buildConfiguration));

            _keywordReplacerTask.ReplaceIn(moleculeAmount);
            return(moleculeAmount);
        }
 private void addLocalParameters(ITransport transport, ITransportBuilder transportBuilder, IBuildConfiguration buildConfiguration)
 {
     transport.AddChildren(_parameterMapper.MapLocalFrom(transportBuilder, buildConfiguration));
 }
 private IEnumerable <IParameter> allLocalParametersFrom(IContainer container, IBuildConfiguration buildConfiguration)
 {
     return(_parameterCollectionMapper.MapLocalFrom(container, buildConfiguration));
 }