private List <BoundNode> GetBounds(IInterpreterSet parent, List <int> minValues, List <int> maxValues)
        {
            List <BoundNode> bounds = new List <BoundNode>();

            for (int i = 0; i < minValues.Count; i++)
            {
                IntegerLiteralExpression min = new IntegerLiteralExpression(minValues[i], 0, 0);
                IntegerLiteralExpression max = new IntegerLiteralExpression(maxValues[i], 0, 0);
                bounds.Add(new BoundNode(null, min, max, 0, 0));

                parent.DispatchInt(min, Arg.Any <List <object> >()).Returns(minValues[i]);
                parent.DispatchInt(max, Arg.Any <List <object> >()).Returns(maxValues[i]);
            }

            return(bounds);
        }
Пример #2
0
        public Set SetExpression(SetExpression node, List <Object> parameters)
        {
            if (!node.IsSetBuilder)
            {
                return(GetManualSet(node, parameters));
            }

            Set        set       = new Set();
            List <int> minValues = new List <int>();
            List <int> maxValues = new List <int>();
            List <int> indices   = new List <int>();

            for (int i = 0; i < node.Bounds.Count; i++)
            {
                minValues.Add(_interpreter.DispatchInt(node.Bounds[i].MinValue, parameters));
                maxValues.Add(_interpreter.DispatchInt(node.Bounds[i].MaxValue, parameters));
                indices.Add(0);
            }

            EvaluateSet(minValues, maxValues, indices, node.Predicate, 0, set, parameters);

            return(set);
        }