Example #1
0
        public IEntityList Evaluate(IEntityList entityList)
        {
            if (entityList.Count == 0)
            {
                return(entityList);
            }

            IEntityList evaluatedEntities;

            if (Evaluator == null)
            {
                evaluatedEntities = new EntityList(entityList.Count);
                for (int e = 0; e < entityList.Count; e++)
                {
                    var entityWithKey = new Dictionary <MultiKey, IEntity> {
                        { IslandKey, entityList[e] }
                    };
                    var decodedEntity = LocalEvaluator.Decode(IslandKey, entityWithKey);
                    evaluatedEntities.Add(decodedEntity);
                }
            }
            else
            {
                evaluatedEntities = Evaluator.Ask(entityList).GetAwaiter().GetResult() as IEntityList;
            }
            return(evaluatedEntities);
        }
Example #2
0
 public void Evaluate_Something()
 {
     var evaluator = new LocalEvaluator();
     int?id        = 1;
     int?id2       = null;
     Expression <Func <NullableEvaluatorTest, bool> > expresion = e => id.HasValue && !"test".Equals("test") || id2.HasValue && e.Property1 == id.Value;
     var expression = evaluator.Visit(expresion, typeof(NullableEvaluatorTest));
 }
Example #3
0
        private void InitEvaluator(InitEvaluator m)
        {
            Starter = Sender;
            if (Evaluator != null)
            {
                Evaluator.Tell(m);
            }
            else
            {
                LocalEvaluator.Init(m.InitData);
            }

            Engine.Init(m.InitData);
            Engine.LaunchTravelers += LaunchTravelers;
            Self.Tell(Continue.Instance);
        }
Example #4
0
        private static int ProcessArguments(ApplicationArguments appArgs)
        {
            Configuration.DebugInfo             = appArgs.DebugInfo;
            Configuration.CompileOnly           = appArgs.CompileOnly;
            Configuration.OutputTranslatedQuery = appArgs.OutputTranslatedQuery;

            EvaluatorBase evaluator;

            if (appArgs.UseService)
            {
                evaluator = new RemoteEvaluator(appArgs);
            }
            else
            {
                evaluator = new LocalEvaluator(appArgs);
            }

            ResultTable result;

            try
            {
                result = evaluator.Evaluate();
            }
            catch (CompilationException exc)
            {
                if (!string.IsNullOrEmpty(exc.InnerException?.Message))
                {
                    System.Console.WriteLine(exc.InnerException.Message);
                }
                else
                {
                    System.Console.WriteLine(exc.Message);
                }

                return(1);
            }

            if (Configuration.CompileOnly || !string.IsNullOrEmpty(Configuration.OutputTranslatedQuery))
            {
                return(0);
            }

            var dt = new DataTable(result.Name);

            dt.Columns.AddRange(result.Columns.Select(f => new DataColumn(f)).ToArray());

            foreach (var item in result.Rows)
            {
                dt.Rows.Add(item);
            }

            Printer printer;

            if (string.IsNullOrEmpty(appArgs.QueryScoreFile))
            {
                printer = new ConsolePrinter(dt, result.ComputationTime);
            }
            else
            {
                printer = new CsvPrinter(dt, appArgs.QueryScoreFile);
            }

            printer.Print();

            return(0);
        }
Example #5
0
 public static TestQactiveProvider Create <T>(LocalEvaluator localEvaluator, object argument)
 => new TestQactiveProvider(typeof(T), localEvaluator, argument);
Example #6
0
 public static TestQactiveProvider Create <T>(LocalEvaluator localEvaluator)
 => new TestQactiveProvider(typeof(T), localEvaluator);
Example #7
0
 private TestQactiveProvider(Type sourceType, LocalEvaluator localEvaluator, object argument)
     : base(sourceType, localEvaluator, argument)
 {
 }
Example #8
0
 private TestQactiveProvider(Type sourceType, LocalEvaluator localEvaluator)
     : base(sourceType, localEvaluator)
 {
 }
            public static Expression Evaluate(Expression root, HashSet <Expression> locals)
            {
                var visitor = new LocalEvaluator(locals);

                return(visitor.Visit(root));
            }
        public static Expression Evaluate(Expression expression)
        {
            var set = LocalEvaluationFinder.Search(expression);

            return(LocalEvaluator.Evaluate(expression, set));
        }