コード例 #1
0
        private void replaceWithMoleculeKeywords(IEnumerable <IKeywordReplacer> generalKeywordReplacer, IContainer container, string moleculeName)
        {
            var keywordReplacer = new KeywordReplacerCollection(generalKeywordReplacer);

            addMoleculeReplacersTo(keywordReplacer, moleculeName);
            container.GetChildren <IUsingFormula>().Each(keywordReplacer.ReplaceIn);
        }
コード例 #2
0
        public void ReplaceIn(IMoleculeAmount moleculeAmount)
        {
            var keywordReplacer = new KeywordReplacerCollection();

            addMoleculeReplacersTo(keywordReplacer, moleculeAmount.Name);
            moleculeAmount.GetAllChildren <IUsingFormula>().Each(keywordReplacer.ReplaceIn);
        }
コード例 #3
0
        private void replaceInUsingFormula(IUsingFormula usingFormula, IContainer rootContainer)
        {
            var keywordReplacer = new KeywordReplacerCollection();

            addCommonModelReplacersTo(keywordReplacer, rootContainer);
            keywordReplacer.ReplaceIn(usingFormula);
        }
コード例 #4
0
        public void Visit(IMoleculeAmount moleculeAmount)
        {
            var keywordReplacer = new KeywordReplacerCollection();

            addCommonModelReplacersTo(keywordReplacer, _rootContainer);
            addMoleculeReplacersTo(keywordReplacer, moleculeAmount.Name);
            keywordReplacer.ReplaceIn(moleculeAmount);
        }
コード例 #5
0
        public void ReplaceIn(IContainer moleculePropertiesContainer, IContainer rootContainer, string moleculeName)
        {
            var keywordReplacer = new KeywordReplacerCollection();

            addCommonModelReplacersTo(keywordReplacer, rootContainer);
            addMoleculeReplacersTo(keywordReplacer, moleculeName);
            moleculePropertiesContainer.GetAllChildren <IUsingFormula>().Each(keywordReplacer.ReplaceIn);
        }
コード例 #6
0
        public void ReplaceIn(IObserver observer, IContainer rootContainer, string moleculeName, INeighborhood neighborhood)
        {
            var keywordReplacer = new KeywordReplacerCollection();

            addCommonModelReplacersTo(keywordReplacer, rootContainer);
            addCommonNeighborhoodReplacersTo(keywordReplacer, neighborhood);
            addMoleculeReplacersTo(keywordReplacer, moleculeName);
            keywordReplacer.ReplaceIn(observer);
        }
コード例 #7
0
        public void ReplaceIn(INeighborhood neighborhood, IContainer rootContainer)
        {
            var keywordReplacer = new KeywordReplacerCollection();

            addCommonModelReplacersTo(keywordReplacer, rootContainer);
            addCommonNeighborhoodReplacersTo(keywordReplacer, neighborhood);
            neighborhood.GetChildren <IUsingFormula>().Each(keywordReplacer.ReplaceIn);
            neighborhood.GetChildren <IContainer>().Each(x => replaceWithMoleculeKeywords(keywordReplacer, x, x.Name));
        }
コード例 #8
0
        public IObjectPath CreateModelPathFor(IObjectPath objectPath, IContainer rootContainer)
        {
            var keywordReplacer = new KeywordReplacerCollection();

            addCommonModelReplacersTo(keywordReplacer, rootContainer);
            var modelPath = objectPath.Clone <IObjectPath>();

            keywordReplacer.ReplaceIn(modelPath);
            return(modelPath);
        }
コード例 #9
0
        private void replaceIn(IUsingFormula usingFormula, IContainer rootContainer, string moleculeName)
        {
            if (usingFormula == null)
            {
                return;
            }
            var keywordReplacer = new KeywordReplacerCollection();

            addCommonModelReplacersTo(keywordReplacer, rootContainer);
            addMoleculeReplacersTo(keywordReplacer, moleculeName);
            keywordReplacer.ReplaceIn(usingFormula);
        }
コード例 #10
0
        public void ReplaceMoleculeKeywordInNonApplicationEventGroup(IEventGroup eventGroup, IMoleculeBuildingBlock molecules)
        {
            if (!molecules.AllFloating().Any())
            {
                return;
            }

            var keywordReplacer = new KeywordReplacerCollection();

            addMoleculeReplacersTo(keywordReplacer, molecules.AllFloating().First().Name);

            replaceInEventGroup(eventGroup, keywordReplacer);
        }
コード例 #11
0
        public void ReplaceInReactionContainer(IContainer reactionContainer, IContainer rootContainer)
        {
            var keywordReplacer = new KeywordReplacerCollection();

            addCommonModelReplacersTo(keywordReplacer, rootContainer);
            var reaction = reactionContainer as IReaction;

            if (reaction != null)
            {
                keywordReplacer.ReplaceIn(reaction);
            }

            replaceInContainer(reactionContainer, rootContainer);
        }
コード例 #12
0
        public void ReplaceIn(IEventGroup eventGroup, IContainer rootContainer, IEventGroupBuilder eventGroupBuilder, IMoleculeBuildingBlock molecules)
        {
            var keywordReplacer = new KeywordReplacerCollection();

            addCommonModelReplacersTo(keywordReplacer, rootContainer);

            var applicationBuilder = eventGroupBuilder as IApplicationBuilder;

            if (applicationBuilder != null)
            {
                addMoleculeReplacersTo(keywordReplacer, applicationBuilder.MoleculeName);
            }

            replaceInEventGroup(eventGroup, keywordReplacer);
        }
コード例 #13
0
        public void ReplaceIn(ITransport realization, IContainer rootContainer, string moleculeName, INeighborhood neighborhood, string transportName, string transporterName)
        {
            var keywordReplacer = new KeywordReplacerCollection();

            addCommonModelReplacersTo(keywordReplacer, rootContainer);
            addMoleculeReplacersTo(keywordReplacer, moleculeName);
            addCommonNeighborhoodReplacersTo(keywordReplacer, neighborhood);

            keywordReplacer.AddReplacement(new KeywordWithPathReplacer(ObjectPathKeywords.SOURCE, _objectPathFactory.CreateAbsoluteObjectPath(realization.SourceAmount.ParentContainer)));
            keywordReplacer.AddReplacement(new KeywordWithPathReplacer(ObjectPathKeywords.TARGET, _objectPathFactory.CreateAbsoluteObjectPath(realization.TargetAmount.ParentContainer)));
            keywordReplacer.AddReplacement(new KeywordWithPathReplacer(ObjectPathKeywords.REALIZATION, new ObjectPath(transportName, realization.Name)));
            keywordReplacer.AddReplacement(new SimpleKeywordReplacer(ObjectPathKeywords.TRANSPORT, transportName));
            keywordReplacer.AddReplacement(new SimpleKeywordReplacer(ObjectPathKeywords.TRANSPORTER, transporterName));
            keywordReplacer.ReplaceIn(realization);
            replaceInContainer(realization, rootContainer);

            //replaceInContainer only replaces standard keywords. Transport specific keywords need to be replaced in all children explicitely
            var transportContainer = realization.ParentContainer ?? realization;

            transportContainer.GetAllChildren <IUsingFormula>().Each(keywordReplacer.ReplaceIn);
        }
コード例 #14
0
 private void replaceInEventGroup(IEventGroup eventGroup, KeywordReplacerCollection keywordReplacer)
 {
     eventGroup.GetAllChildren <IUsingFormula>().Each(keywordReplacer.ReplaceIn);
     eventGroup.GetAllChildren <IEventAssignment>().Select(x => x.ObjectPath).Each(keywordReplacer.ReplaceIn);
 }
コード例 #15
0
 protected override void Context()
 {
     sut = new KeywordReplacerCollection();
 }