/// <summary> /// Creates a parallel matchers. /// Inits arrays of threads and matchers based on thread count. /// </summary> /// <param name="pattern"> Pattern to match. </param> /// <param name="graph"> Graph to search on.</param> /// <param name="executionHelper"> Query execution helper. </param> public DFSParallelPatternMatcherStreamed(DFSPattern pattern, Graph graph, IMatchExecutionHelper executionHelper) : base(graph, executionHelper) { this.matchers = new ISingleThreadPatternMatcherStreamed[this.helper.ThreadCount]; for (int i = 0; i < this.helper.ThreadCount; i++) { this.matchers[i] = (ISingleThreadPatternMatcherStreamed)MatchFactory .CreateMatcher(this.helper.SingleThreadPatternMatcherName, // Type of Matcher i == 0 ? pattern : pattern.Clone(), // Cloning of pattern (one was already created) graph, i); // Matcher ID } }
/// <summary> /// Creates a parallel matchers. /// Inits arrays of threads and matchers based on thread count. /// </summary> /// <param name="pattern"> A pattern to match. </param> /// <param name="graph"> A graph to search on.</param> /// <param name="results"> Where to store results. </param> /// <param name="executionHelper"> A query execution helper. </param> public DFSParallelPatternMatcher(DFSPattern pattern, Graph graph, MatchFixedResults results, IMatchExecutionHelper executionHelper) : base(graph, executionHelper) { if (pattern == null || results == null) { throw new ArgumentNullException($"{this.GetType()}, passed a null to a construtor."); } this.matchers = new ISingleThreadPatternMatcher[this.helper.ThreadCount]; this.results = results; for (int i = 0; i < this.helper.ThreadCount; i++) { this.matchers[i] = (ISingleThreadPatternMatcher)MatchFactory .CreateMatcher(this.helper.SingleThreadPatternMatcherName, // Type of Matcher i == 0 ? pattern : pattern.Clone(), // Cloning of pattern (one was already created) graph, results.GetMatcherResultsStorage(i)); // Result storage } }