Exemplo n.º 1
0
        public FeedbackLevel SetInput(FeedbackName key, int input, out FeedbackLevel level)
        {
            level = this.Output;

            // Controllers are optional, we don't need to configure them all.
            FeedbackController controller;

            if (this.values.TryGetValue(key, out controller))
            {
                if (controller.SetInput(input))
                {
                    level = controller.Output;
                    if (controller.Output > this.Output)
                    {
                        return(this.Output = controller.Output);
                    }

                    if (controller.Output < this.Output)
                    {
                        return(this.CalculateOutput());
                    }
                }

                level = controller.Output;
            }

            return(this.Output);
        }
Exemplo n.º 2
0
 public FeedbackController(
     FeedbackName feedbackName, Dictionary <FeedbackLevel, int> thresholdValues, int initialInput, FeedbackLevel initalFeedbackLevel)
 {
     this.thresholdValues      = thresholdValues;
     this.feedbackName         = feedbackName;
     this.currentFeedbackLevel = initalFeedbackLevel;
     this.currentInput         = initialInput;
 }
 public FeedbackController(
     FeedbackName feedbackName, Dictionary<FeedbackLevel, int> thresholdValues, int initialInput, FeedbackLevel initalFeedbackLevel)
 {
     this.thresholdValues = thresholdValues;
     this.feedbackName = feedbackName;
     this.currentFeedbackLevel = initalFeedbackLevel;
     this.currentInput = initialInput;
 }
Exemplo n.º 4
0
        internal void UpdateFeedbackController(FeedbackName name, SortedDictionary <FeedbackLevel, FeedbackLevelData> dict)
        {
            FeedbackController controller;

            if (this.values.TryGetValue(name, out controller))
            {
                controller.UpdateThresholds(dict);
                this.CalculateOutput();
            }
        }
        public FeedbackLevel SetInput(FeedbackName key, int input)
        {
            // Controllers are optional, we don't need to configure them all. 
            FeedbackController controller;
            if (this.values.TryGetValue(key, out controller))
            {
                if (controller.SetInput(input))
                {
                    if (controller.Output > this.Output)
                    {
                        return this.Output = controller.Output;
                    }

                    if (controller.Output < this.Output)
                    {
                        return this.CalculateOutput();
                    }
                }
            }

            return this.Output;
        }
Exemplo n.º 6
0
        public FeedbackLevel SetInput(FeedbackName key, int input)
        {
            FeedbackLevel level;

            return(SetInput(key, input, out level));
        }