Пример #1
0
        public virtual void addResult(RobotResult robotResult)
        {
            double?weight = robotResult.Weight;

            if (double.IsNaN(weight))
            {
                return;
            }
            processWeight(robotResult);
        }
        public virtual IList <RobotResult> execute(IList <RobotData> robotDataList, Robot robot, RobotExecutor robotExecutor)
        {
            IList <RobotResult> robotResultList = new List <RobotResult>(robotDataList.Count);

            foreach (RobotData robotData in robotDataList)
            {
                Prediction  prediction = robotExecutor.executeRobot(robotData, robot);
                RobotResult result     = new RobotResult(prediction, robot, robotData);
                robotResultList.Add(result);
            }
            return(robotResultList);
        }
Пример #3
0
        private void processWeight(RobotResult robotResult)
        {
            if (robotResult.Weight > 0)
            {
                switch (robotResult.Prediction)
                {
                case UP:
                    recordUp(robotResult.Weight.Value);
                    break;

                case DOWN:
                    recordDown(robotResult.Weight.Value);
                    break;

                case OUT:
                    recordOut(robotResult.Weight.Value);
                    break;
                }
            }
            if (robotResult.Weight < 0)
            {
                switch (robotResult.Prediction)
                {
                case UP:
                    recordDown(-robotResult.Weight.Value);
                    break;

                case DOWN:
                    recordUp(-robotResult.Weight.Value);
                    break;

                case OUT:
                    recordOut(robotResult.Weight.Value);
                    break;
                }
            }
        }