/// <summary> /// <para> Removes a specific <see cref='WorkItem'/> from the /// <see cref='WorkItemCollection'/> .</para> /// </summary> /// <param name='value'>The <see cref='WorkItem'/> to remove from the <see cref='WorkItemCollection'/> .</param> /// <returns><para>None.</para></returns> /// <exception cref='System.ArgumentException'><paramref name='value'/> is not found in the Collection. </exception> public void Remove(WorkItem value) { #region WorkItem Diagnostics //if (Tools.Instrumentation.Common.InstrumentationManager.Level==InstrumentationLevel.High) //{ value.AttachNote("Removed from the " + Name + " IQ"); Trace.WriteLine(value.ToString()); //} #endregion WorkItem Diagnostics List.Remove(value); }
public void AddWorkItem(WorkItem workItem) { int startIndex = _indexes[workItem.SubmissionPriority].StartIndex; int endIndex = _indexes[workItem.SubmissionPriority].EndIndex; for (int i = startIndex; i < endIndex; i++) { if (this[i].IsEmpty) { this[i].AssignWorkItem(workItem); #region WorkItem Diagnostics //if (Tools.Instrumentation.Common.InstrumentationManager.Level==InstrumentationLevel.High) //{ workItem.AttachNote("Added to the " + Name + " slot with index " + i); //} #endregion WorkItem Diagnostics _counters[workItem.SubmissionPriority].ItemsPresentCount += 1; return; } } // TODO: Handle the case when there is no space, that // should not happen by design, but anyway ... (SD) throw new ApplicationException ( "There is no space to add work item with priority " + workItem.SubmissionPriority + " . Value of slot collection lookup indeces are: StartInternal=" + startIndex + ", end=" + endIndex ); }
/// <summary> /// <para>Adds a <see cref='WorkItem'/> with the specified value to the /// <see cref='WorkItemCollection'/> .</para> /// </summary> /// <param name='value'>The <see cref='WorkItem'/> to add.</param> /// <returns> /// <para>The index at which the new element was inserted.</para> /// </returns> /// <seealso cref='WorkItemCollection.AddRange'/> public int Add(WorkItem value) { #region WorkItem Diagnostics //if (Tools.Instrumentation.Common.InstrumentationManager.Level==InstrumentationLevel.High) //{ value.AttachNote("Added to the " + Name + " IQ"); //} #endregion WorkItem Diagnostics return List.Add(value); }