Exemplo n.º 1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="GraphingWorkItem" /> struct.
 /// </summary>
 /// <param name="tree">The parse tree to graph.</param>
 /// <param name="parserRules">The parser rules.</param>
 /// <param name="grapher">The parse tree grapher to use.</param>
 /// <param name="graphWhen">The DateTime indicating when to parse.</param>
 public GraphingWorkItem(
     ITree tree,
     IList <string> parserRules,
     IParseTreeGrapher grapher,
     DateTime graphWhen)
 {
     ParseTree   = tree;
     ParserRules = parserRules;
     GraphWhen   = graphWhen;
     TreeGrapher = grapher;
 }
Exemplo n.º 2
0
 /// <inheritdoc />
 public void Graph(IParseTreeGrapher grapher, ITree tree, IList <string> parserRules)
 {
     lock (_Padlock)
     {
         var nextRun =
             CalculateNextRunTime(
                 _PreviousNodeQty,
                 _Settings.NodeThresholdCountForThrottling,
                 _Settings.MillisecondsToDelayPerNodeWhenThrottling,
                 _Settings.MaximumRenderShortDelay);
         var work = new GraphingWorkItem(tree, parserRules, grapher, nextRun);
         QueuedWork.Enqueue(work);
         _LastQueuedTime = DateTime.Now;
         if (GraphingTask.IsCompleted)
         {
             GraphingTask = new Task(GraphingWorkLoop);
         }
         if (GraphingTask.Status != TaskStatus.Running)
         {
             GraphingTask.Start();
         }
     }
 }