コード例 #1
0
 public StringEvaluators(IDataReader dataReader)
 {
     Palindrome = new PalindromeEvaluator(dataReader);
     Consonants = new ConsonantsEvaluator(dataReader);
     Evaluators.Add(Palindrome);
     Evaluators.Add(Consonants);
 }
コード例 #2
0
        public void Submit(IEvaluatorRequest request)
        {
            LOGGER.Log(Level.Info, "Submitting request for {0} evaluators and {1} MB memory and  {2} core to rack {3} and runtime {4}.", request.Number, request.MemoryMegaBytes, request.VirtualCore, request.Rack, request.RuntimeName);
            lock (Evaluators)
            {
                for (var i = 0; i < request.Number; i++)
                {
                    if (!string.IsNullOrWhiteSpace(request.RuntimeName))
                    {
                        if (runtimes.runtimeNames != null && !runtimes.runtimeNames.Contains(request.RuntimeName))
                        {
                            throw new ArgumentException(string.Format("Requested runtime {0} is not in the defined runtimes list {1}", request.RuntimeName, string.Join(",", runtimes.runtimeNames)));
                        }
                    }

                    var descriptor = new EvaluatorDescriptorImpl(new NodeDescriptorImpl(), EvaluatorType.CLR, request.MemoryMegaBytes, request.VirtualCore, request.RuntimeName, request.Rack);
                    var key        = string.Format(CultureInfo.InvariantCulture, "{0}{1}{2}", request.EvaluatorBatchId, BatchIdxSeparator, i);
                    try
                    {
                        Evaluators.Add(key, descriptor);
                    }
                    catch (ArgumentException e)
                    {
                        Exceptions.Caught(e, Level.Error, string.Format(CultureInfo.InvariantCulture, "EvaluatorBatchId [{0}] already exists.", key), LOGGER);
                        Exceptions.Throw(new InvalidOperationException("Cannot use evaluator id " + key, e), LOGGER);
                    }
                }
            }

            Clr2Java.Submit(request);
        }
コード例 #3
0
        /// <summary>
        ///   Adds the specified <see cref="T:Crystal.IEvaluator"/> to this <see cref="T:Crystal.CompositeEvaluator"/>
        ///   if the new evaluator has a domain that does not overlap the domains of definition of the
        ///   <see cref="T:Crystal.IEvaluator"/> already added to this <see cref="T:Crystal.CompositeEvaluator"/>.
        /// </summary>
        /// <param name="ev">Ev.</param>
        public void Add(IEvaluator ev)
        {
            if (DoesNotOverlapWithAnyEvaluator(ev))
            {
                Evaluators.Add(ev);
            }

            Evaluators.Sort((e1, e2) => e1.XInterval.CompareTo(e2.XInterval));
            UpdateXyPoints();
        }
コード例 #4
0
ファイル: EvaluatorRequestor.cs プロジェクト: TaeHunKim/reef
        public void Submit(IEvaluatorRequest request)
        {
            LOGGER.Log(Level.Info, "Submitting request for {0} evaluators and {1} MB memory and  {2} core to rack {3}.", request.Number, request.MemoryMegaBytes, request.VirtualCore, request.Rack);

            lock (Evaluators)
            {
                for (var i = 0; i < request.Number; i++)
                {
                    var descriptor = new EvaluatorDescriptorImpl(new NodeDescriptorImpl(), EvaluatorType.CLR, request.MemoryMegaBytes, request.VirtualCore, request.Rack);
                    var key        = string.Format(CultureInfo.InvariantCulture, "{0}{1}{2}", request.EvaluatorBatchId, BatchIdxSeparator, i);
                    try
                    {
                        Evaluators.Add(key, descriptor);
                    }
                    catch (ArgumentException e)
                    {
                        Exceptions.Caught(e, Level.Error, string.Format(CultureInfo.InvariantCulture, "EvaluatorBatchId [{0}] already exists.", key), LOGGER);
                        Exceptions.Throw(new InvalidOperationException("Cannot use evaluator id " + key, e), LOGGER);
                    }
                }
            }

            Clr2Java.Submit(request);
        }
コード例 #5
0
 public void Add(Func <X, bool> predicate, Func <X, Y> whenTrue)
 {
     Evaluators.Add(predicate, whenTrue);
     Predicates[Next++] = predicate;
 }
コード例 #6
0
ファイル: EvaluationContext.cs プロジェクト: jgera/WrapRec
 public void AddEvaluator(Evaluator evaluator)
 {
     Evaluators.Add(evaluator);
 }
コード例 #7
0
 public void RegisterEvaluator(IExecutableHandler handler)
 {
     Evaluators.Add(handler);
 }