public StringEvaluators(IDataReader dataReader) { Palindrome = new PalindromeEvaluator(dataReader); Consonants = new ConsonantsEvaluator(dataReader); Evaluators.Add(Palindrome); Evaluators.Add(Consonants); }
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); }
/// <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(); }
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); }
public void Add(Func <X, bool> predicate, Func <X, Y> whenTrue) { Evaluators.Add(predicate, whenTrue); Predicates[Next++] = predicate; }
public void AddEvaluator(Evaluator evaluator) { Evaluators.Add(evaluator); }
public void RegisterEvaluator(IExecutableHandler handler) { Evaluators.Add(handler); }