Exemplo n.º 1
0
        public void TestObjectArrayCompare()
        {
            MEFUtilities.Compose(new TypeHandlerCache());
            Expression <Func <SourceType2, int, int, bool> > lambaExpr = (s, a1, a2) => s.jets[a1] == s.jets[a2];
            GeneratedCode gc     = new GeneratedCode();
            CodeContext   cc     = new CodeContext();
            var           result = ExpressionResolver.Resolve(lambaExpr.Body, gc, cc, MEFUtilities.MEFContainer);

            Assert.IsInstanceOfType(result, typeof(BinaryExpression), "Expression type");
            Assert.AreEqual(ExpressionType.Equal, result.NodeType, "Expected an equal");

            var b = result as BinaryExpression;

            Assert.IsInstanceOfType(b.Left, typeof(ParameterExpression), "Left expr");
            Assert.IsInstanceOfType(b.Right, typeof(ParameterExpression), "Right expr");

            var r = b.Right as ParameterExpression;
            var l = b.Left as ParameterExpression;

            Assert.AreEqual("a1", l.Name, "Left paramter name");
            Assert.AreEqual("a2", r.Name, "Right paramter name");
        }
Exemplo n.º 2
0
        public void TestObjectArrayCompareNENull()
        {
            MEFUtilities.Compose(new TypeHandlerCache());
            Expression <Func <SourceType2, int, int, bool> > lambaExpr = (s, a1, a2) => s.jets[a1] != null;
            GeneratedCode gc     = new GeneratedCode();
            CodeContext   cc     = new CodeContext();
            var           result = ExpressionResolver.Resolve(lambaExpr.Body, gc, cc, MEFUtilities.MEFContainer);

            Assert.IsInstanceOfType(result, typeof(BinaryExpression), "Expression type");
            Assert.AreEqual(ExpressionType.NotEqual, result.NodeType, "Expected an not equal");

            var b = result as BinaryExpression;

            Assert.IsInstanceOfType(b.Left, typeof(ParameterExpression), "Left expr");
            Assert.IsInstanceOfType(b.Right, typeof(ConstantExpression), "Right expr");

            var r = b.Right as ParameterExpression;
            var l = b.Left as ConstantExpression;

            //Assert.Inconclusive("Do we want to allow the user to write this - what does it mean??");
            // The way this get coded up is pretty harmless. So I guess we let it go...
        }
 public void Cleanup()
 {
     MEFUtilities.MyClassDone();
 }
 public void Setup()
 {
     MEFUtilities.MyClassInit();
 }
Exemplo n.º 5
0
 public void TestDone()
 {
     MEFUtilities.MyClassDone();
 }
Exemplo n.º 6
0
        private void CommonExecute(QueryModel queryModel)
        {
            LastQueryModel = queryModel;

            Result = new GeneratedCode();
            if (DoQMFunctions)
            {
                foreach (var f in LINQToTTreeLib.QMFunctions.QMFuncFinder.FindQMFunctions(queryModel))
                {
                    if (!f.Arguments.Any())
                    {
                        Result.Add(new QMFuncSource(f));
                    }
                }
            }

            if (!_doExecution)
            {
                return;
            }

            if (!GlobalInitalized)
            {
                GlobalInitalized = true;
                MEFUtilities.AddPart(new QVResultOperators());
                MEFUtilities.AddPart(new ROCount());
                MEFUtilities.AddPart(new ROTakeSkipOperators());
                MEFUtilities.AddPart(new ROAggregate());
                MEFUtilities.AddPart(new ROMinMax());
                MEFUtilities.AddPart(new ROAnyAll());
                MEFUtilities.AddPart(new ROUniqueCombinations());
                MEFUtilities.AddPart(new ROAsCSV());
                MEFUtilities.AddPart(new ROAsTTree());
                MEFUtilities.AddPart(new ROPairWiseAll());
                MEFUtilities.AddPart(new ROAsQueriable());
                MEFUtilities.AddPart(new ROSum());
                MEFUtilities.AddPart(new ROFirstLast());
                MEFUtilities.AddPart(new ROGroup());

                MEFUtilities.AddPart(new TypeHandlerROOT());
                MEFUtilities.AddPart(new TypeHandlerHelpers());
                MEFUtilities.AddPart(new TypeHandlerReplacementCall());
                MEFUtilities.AddPart(new TypeHandlerCache());
                MEFUtilities.AddPart(new TypeHandlerCPPCode());
                MEFUtilities.AddPart(new TypeHandlerOnTheFlyCPP());
                MEFUtilities.AddPart(new TypeHandlerTranslationClass());
                MEFUtilities.AddPart(new TypeHandlerConvert());
                MEFUtilities.AddPart(new GroupByArrayFactory());
                MEFUtilities.AddPart(new GroupByFactory());

                MEFUtilities.AddPart(new ArrayArrayInfoFactory());
                MEFUtilities.AddPart(new EnumerableRangeArrayTypeFactory());
                MEFUtilities.AddPart(new SubQueryArrayTypeFactory());
                MEFUtilities.AddPart(new TranslatedArrayInfoFactory());
                MEFUtilities.AddPart(new MemberAccessArrayTypeFactory());
                MEFUtilities.AddPart(new HandleGroupType());
                MEFUtilities.AddPart(new SubQueryExpressionArrayInfoFactory());

                //var b = new CompositionBatch();
                //b.AddPart(new DataSchemeHandlerFile());
                //b.AddPart(new DataSchemeHandlerRemoteBash());
                //b.AddPart(new DataSchemeHandlerLocalBash());
                //b.AddPart(new DataSchemeHandlerLocalWin());
                //b.AddPart(new DataSchemeHandlerProof());
                //b.AddPart(new CommandLineExecutorFactory());
                //b.AddPart(new LocalBashExecutorFactory());
                //b.AddPart(new RemoteBashExecutorFactory());
                //TTreeQueryExecutor.CContainer.Compose(b);

                MEFUtilities.AddPart(new AdderInt());
            }

            var cc = new CodeContext()
            {
                BaseNtupleObjectType = _baseType
            };

            cc.SetTopLevelQuery(queryModel);
            var qv = new QueryVisitor(Result, cc, MEFUtilities.MEFContainer);

            MEFUtilities.Compose(qv);

            MEFInitialPartCount = MEFUtilities.CountParts();

            qv.VisitQueryModel(queryModel);

            FinalResult = Result;
        }