コード例 #1
0
        private void createEventGroupStructure(IEventGroupBuilder eventGroupBuilder, IEventGroup eventGroup, IBuildConfiguration buildConfiguration)
        {
            foreach (var childBuilder in eventGroupBuilder.Children)
            {
                //nothing to do for these entities that should not be copied in the model structure
                if (doesNotBelongIntoModel(childBuilder))
                {
                    continue;
                }

                if (childBuilder.IsAnImplementationOf <IEventGroupBuilder>())
                {
                    var childEventGroup = MapFrom(childBuilder.DowncastTo <IEventGroupBuilder>(), buildConfiguration);
                    eventGroup.Add(childEventGroup);

                    if (childBuilder.IsAnImplementationOf <IApplicationBuilder>())
                    {
                        createApplication(childBuilder.DowncastTo <IApplicationBuilder>(), childEventGroup, buildConfiguration);
                    }
                }

                else if (childBuilder.IsAnImplementationOf <IEventBuilder>())
                {
                    eventGroup.Add(_eventMapper.MapFrom(childBuilder.DowncastTo <IEventBuilder>(), buildConfiguration));
                }

                else if (childBuilder.IsAnImplementationOf <IParameter>())
                {
                    eventGroup.Add(_parameterMapper.MapFrom(childBuilder.DowncastTo <IParameter>(), buildConfiguration));
                }

                else if (childBuilder.IsAnImplementationOf <IContainer>())
                {
                    eventGroup.Add(_containerMapper.MapFrom(childBuilder.DowncastTo <IContainer>(), buildConfiguration));
                }

                else
                {
                    eventGroup.Add(_cloneManagerForModel.Clone(childBuilder));
                }
            }
        }
コード例 #2
0
        private IContainer createMoleculePropertiesFor(INeighborhoodBuilder neighborhoodBuilder,
                                                       string moleculeName, IContainer rootContainer,
                                                       IBuildConfiguration buildConfiguration,
                                                       IEnumerable <string> moleculeNamesWithCopyPropertiesRequired)
        {
            //Create a new model container from the neighborhood container
            var moleculePropertiesContainer = _containerMapper.MapFrom(neighborhoodBuilder.MoleculeProperties, buildConfiguration);

            moleculePropertiesContainer.ContainerType = ContainerType.Molecule;

            //Assigment molecule properties subcontainer name from <MOLECULE_PROPERTIES>
            //to concrete molecule name
            moleculePropertiesContainer.Name = moleculeName;

            _keywordReplacerTask.ReplaceIn(moleculePropertiesContainer, rootContainer, moleculeName);

            //remove children if molecule properties should not be copied
            if (!moleculeNamesWithCopyPropertiesRequired.Contains(moleculeName))
            {
                moleculePropertiesContainer.RemoveChildren();
            }

            return(moleculePropertiesContainer);
        }