public void EnqueueTask(IGherkinProcessingTask task) { AssertRunning(); tasks.Enqueue(task); itemsAvailableEvent.Set(); }
public IGherkinProcessingTask Merge(IGherkinProcessingTask other) { if (other is PingTask) { return(this); } AnalyzingTask otherAnalyzingTask = other as AnalyzingTask; if (otherAnalyzingTask == null || languageService != otherAnalyzingTask.languageService) { return(null); } if (otherAnalyzingTask.change.EntireScopeChanged) { return(otherAnalyzingTask); } if (change.EntireScopeChanged) { return(new AnalyzingTask(languageService, GherkinFileScopeChange.CreateEntireScopeChange(otherAnalyzingTask.change.GherkinFileScope))); } return(new AnalyzingTask(languageService, Merge(change, otherAnalyzingTask.change))); }
private void ApplyTask(IEnumerable <IGherkinProcessingTask> tasks) { IGherkinProcessingTask currentTask = null; foreach (var task in tasks) { if (currentTask == null) { currentTask = task; } else { var mergedTask = currentTask.Merge(task); if (mergedTask == null) // cannot merge { ApplyTask(currentTask); currentTask = task; } else { if (!(currentTask is PingTask || task is PingTask)) { visualStudioTracer.Trace("Task merged", "GherkinProcessingScheduler"); } currentTask = mergedTask; } } } if (currentTask != null) { ApplyTask(currentTask); } }
private void ApplyTask(IGherkinProcessingTask task) { if (!(task is PingTask)) { visualStudioTracer.Trace("Applying task on thread: " + Thread.CurrentThread.ManagedThreadId, "GherkinProcessingScheduler"); } task.Apply(); }
public void EnqueueParsingRequest(IGherkinProcessingTask change) { visualStudioTracer.Trace("Change queued on thread: " + Thread.CurrentThread.ManagedThreadId, "GherkinProcessingScheduler"); parsingSubject.OnNext(change); if (analyzingSubject != null) { analyzingSubject.OnNext(PingTask.Instance); } }
public void EnqueueAnalyzingRequest(IGherkinProcessingTask task) { if (analyzingSubject == null) { return; } visualStudioTracer.Trace("Analyzing request queued on thread: " + Thread.CurrentThread.ManagedThreadId, "GherkinProcessingScheduler"); analyzingSubject.OnNext(task); }
public void EnqueueAnalyzingRequest(IGherkinProcessingTask task) { tracer.Trace("Analyzing request '{1}' queued on thread: {0}", this, Thread.CurrentThread.ManagedThreadId, task); if (analyzerQueue == null) { tracer.Trace("Unable to perform analyzing request: Analyzer queue is not initialized!", this); return; } analyzerQueue.EnqueueTask(task); }
private void DoTask(IGherkinProcessingTask task) { tracer.Trace("Applying task '{1}' on thread: {0}", this, Thread.CurrentThread.ManagedThreadId, task); try { task.Apply(); } catch (Exception exception) { tracer.Trace("Task error: {0}", this, exception); } }
public IGherkinProcessingTask Merge(IGherkinProcessingTask other) { ParsingTask otherParsingTask = other as ParsingTask; if (otherParsingTask == null || languageService != otherParsingTask.languageService) { return(null); } return(new ParsingTask( languageService, GherkinTextBufferChange.Merge(change, otherParsingTask.change))); }
public void EnqueueParsingRequest(IGherkinProcessingTask change) { //tracer.Trace("Change queued on thread: " + Thread.CurrentThread.ManagedThreadId, "GherkinProcessingScheduler"); if (parserQueue == null) { tracer.Trace("Unable to perform parsing request: Parser queue is not initialized!", this); return; } parserQueue.EnqueueTask(change); if (analyzerQueue != null) analyzerQueue.Ping(); }
public void EnqueueParsingRequest(IGherkinProcessingTask change) { //tracer.Trace("Change queued on thread: " + Thread.CurrentThread.ManagedThreadId, "GherkinProcessingScheduler"); if (parserQueue == null) { tracer.Trace("Unable to perform parsing request: Parser queue is not initialized!", this); return; } parserQueue.EnqueueTask(change); if (analyzerQueue != null) { analyzerQueue.Ping(); } }
private IGherkinProcessingTask TryMergeWithNextEvents(IGherkinProcessingTask task) { IGherkinProcessingTask nextTask; while (tasks.TryPeek(out nextTask)) { // trying to merge with the next task (=peek) var mergedTask = task.Merge(nextTask); if (mergedTask == null) { break; } // if succeeded, we "eat up" the merged task and move on tasks.Dequeue(); task = mergedTask; } return(task); }
public IGherkinProcessingTask Merge(IGherkinProcessingTask other) { return(null); }
private void ApplyTask(IGherkinProcessingTask task) { if (!(task is PingTask)) visualStudioTracer.Trace("Applying task on thread: " + Thread.CurrentThread.ManagedThreadId, "GherkinProcessingScheduler"); try { task.Apply(); } catch(Exception exception) { visualStudioTracer.Trace("Exception: " + exception, "GherkinProcessingScheduler"); } }
public IGherkinProcessingTask Merge(IGherkinProcessingTask other) { AnalyzingTask otherAnalyzingTask = other as AnalyzingTask; if (otherAnalyzingTask == null || languageService != otherAnalyzingTask.languageService) return null; if (otherAnalyzingTask.change.EntireScopeChanged) return otherAnalyzingTask; if (change.EntireScopeChanged) return new AnalyzingTask(languageService, GherkinFileScopeChange.CreateEntireScopeChange(otherAnalyzingTask.change.GherkinFileScope)); return new AnalyzingTask(languageService, Merge(change, otherAnalyzingTask.change)); }
public IGherkinProcessingTask Merge(IGherkinProcessingTask other) { ParsingTask otherParsingTask = other as ParsingTask; if (otherParsingTask == null || languageService != otherParsingTask.languageService) return null; return new ParsingTask( languageService, GherkinTextBufferChange.Merge(change, otherParsingTask.change)); }
private void ApplyTask(IGherkinProcessingTask task) { if (!(task is PingTask)) visualStudioTracer.Trace("Applying task on thread: " + Thread.CurrentThread.ManagedThreadId, "GherkinProcessingScheduler"); task.Apply(); }
public IGherkinProcessingTask Merge(IGherkinProcessingTask other) { return null; }
public void EnqueueParsingRequest(IGherkinProcessingTask change) { visualStudioTracer.Trace("Change queued on thread: " + Thread.CurrentThread.ManagedThreadId, "GherkinProcessingScheduler"); parsingSubject.OnNext(change); if (analyzingSubject != null) analyzingSubject.OnNext(PingTask.Instance); }
public void EnqueueAnalyzingRequest(IGherkinProcessingTask task) { if (analyzingSubject == null) return; visualStudioTracer.Trace("Analyzing request queued on thread: " + Thread.CurrentThread.ManagedThreadId, "GherkinProcessingScheduler"); analyzingSubject.OnNext(task); }