Пример #1
0
        protected virtual IParsedLambda CreateParsedLambda()
        {
            //PERF: This ugly processing of nodes for boht transformers in one loop is for performance. Perhaps move bach to older cleaner solution
            var nullableNodeTransformer = new NullableNodeTransformer();
            var boolNodeTransformer = new BoolNodeTransformer();

            var newNodes = new NodesCollection();
            var maxIndex = Nodes.Count;
            for (var i = 0; i < Nodes.Count; i++)
            {
                var nullableNodes = nullableNodeTransformer.Transform(maxIndex, ref i, Nodes[i], Nodes);
                var merged = nullableNodes.MergeWith(Nodes.Skip(i + 1)).ToArray();
                var maxIndexInner = nullableNodes.Length;
                for (var iInner = 0; iInner < maxIndexInner; iInner++)
                {
                    var boolNodes = boolNodeTransformer.Transform(maxIndexInner, ref iInner, merged[iInner], new NodesCollection(merged));
                    newNodes.AddNodes(boolNodes);
                }
            }

            return new ParsedLambda(newNodes.ToArray());
        }
Пример #2
0
        protected virtual IParsedLambda CreateParsedLambda()
        {
            //PERF: This ugly processing of nodes for both transformers in one loop is for performance. Perhaps move bach to older cleaner solution
            var nullableNodeTransformer = new NullableNodeTransformer();
            var boolNodeTransformer     = new BoolNodeTransformer();

            var newNodes = new NodesCollection();
            var maxIndex = Nodes.Count;

            for (var i = 0; i < Nodes.Count; i++)
            {
                var nullableNodes = nullableNodeTransformer.Transform(maxIndex, ref i, Nodes[i], Nodes);
                var merged        = nullableNodes.MergeWith(Nodes.Skip(i + 1)).ToArray();
                var maxIndexInner = nullableNodes.Length;
                for (var iInner = 0; iInner < maxIndexInner; iInner++)
                {
                    var boolNodes = boolNodeTransformer.Transform(maxIndexInner, ref iInner, merged[iInner], new NodesCollection(merged));
                    newNodes.AddNodes(boolNodes);
                }
            }

            return(new ParsedLambda(newNodes.ToArray()));
        }