Esempio n. 1
0
        public void SetViewParameters(ViewFactoryContext viewFactoryContext, IList <ExprNode> expressionParameters)
        {
            var validated = ViewFactorySupport.Validate(
                ViewName, viewFactoryContext.StatementContext, expressionParameters);
            var errorMessage = ViewName +
                               " view requires a numeric or time period parameter as a time interval size, and an integer parameter as a maximal number-of-events, and an optional list of control keywords as a string parameter (please see the documentation)";

            if ((validated.Length != 2) && (validated.Length != 3))
            {
                throw new ViewParameterException(errorMessage);
            }

            timeDeltaComputationFactory = ViewFactoryTimePeriodHelper.ValidateAndEvaluateTimeDeltaFactory(
                ViewName, viewFactoryContext.StatementContext, expressionParameters[0], errorMessage, 0);

            _sizeEvaluator = ViewFactorySupport.ValidateSizeParam(
                ViewName, viewFactoryContext.StatementContext, validated[1], 1);

            if (validated.Length > 2)
            {
                var keywords = ViewFactorySupport.Evaluate(
                    validated[2].ExprEvaluator, 2, ViewName, viewFactoryContext.StatementContext);
                ProcessKeywords(keywords, errorMessage);
            }
        }