Пример #1
0
        /// <summary>
        /// Create a new instance of <see cref="PipelineExecutor"/>.
        /// </summary>
        /// <param name="settings">The settings to read data from.</param>
        /// <param name="builder">The builder.</param>
        public PipelineExecutor(ReadOnlySettings settings, IBuilder builder)
        {
            rootBuilder = builder;

            var pipelineBuilder = new PipelineBuilder(settings.Get <PipelineModifications>());

            Incoming = pipelineBuilder.Incoming.AsReadOnly();
            Outgoing = pipelineBuilder.Outgoing.AsReadOnly();

            incomingBehaviors = Incoming.Select(r => r.BehaviorType);
            outgoingBehaviors = Outgoing.Select(r => r.BehaviorType);
        }
        /// <summary>
        /// Validates this vertex.
        /// YesNoChoice only accepts trigger YES or NO.
        /// </summary>
        public override bool Validate()
        {
            var invalid = Outgoing.Select(t => t.Trigger).Where(t => t != YES && t != NO).ToList();

            if (invalid.Count != 0)
            {
                Debug.WriteLine("Yes/no choice has invalid transition(s) with trigger: {0}", string.Join(",", invalid));
                return(false);
            }

            return(base.Validate());
        }