Exemple #1
0
        /// <summary>
        /// Creates a strategy chain based on the strategies in the list. Useful for
        /// build operations.
        /// </summary>
        /// <returns>The new strategy chain.</returns>
        public IBuilderStrategyChain MakeStrategyChain()
        {
            lock (lockObject)
            {
                BuilderStrategyChain result = new BuilderStrategyChain();

                foreach (TStageEnum stage in stageValues)
                {
                    result.AddRange(stages[stage]);
                }

                return(result);
            }
        }
Exemple #2
0
        /// <summary>
        /// Creates a reverse strategy chain based on the strategies in the list. Useful
        /// for unbuild operations (which run strategies in reverse of build operations).
        /// </summary>
        /// <returns>The new strategy chain.</returns>
        public IBuilderStrategyChain MakeReverseStrategyChain()
        {
            lock (lockObject)
            {
                List <IBuilderStrategy> tempList = new List <IBuilderStrategy>();
                foreach (TStageEnum stage in stageValues)
                {
                    tempList.AddRange(stages[stage]);
                }

                tempList.Reverse();

                BuilderStrategyChain result = new BuilderStrategyChain();
                result.AddRange(tempList);
                return(result);
            }
        }