All remaining references to the old name of the waitable class, 'progression' changed to 'waitable'; QueueOperation renamed to OperationQueue; SetProgression renamed to WaitableGroup; improved documentation in various places
git-svn-id: file:///srv/devel/repo-conversion/nusu@78 d2e56fa2-650e-0410-a79f-9358c0239efd
This commit is contained in:
parent
df860b8e57
commit
7bff8c5d52
12 changed files with 307 additions and 271 deletions
|
@ -33,11 +33,11 @@ namespace Nuclex.Support.Scheduling {
|
|||
|
||||
/// <summary>Unit Test for the queue operation class</summary>
|
||||
[TestFixture]
|
||||
public class QueueOperationTest {
|
||||
public class OperationQueueTest {
|
||||
|
||||
#region interface IQueueOperationSubscriber
|
||||
|
||||
/// <summary>Interface used to test the set progression.</summary>
|
||||
/// <summary>Interface used to test the set waitable.</summary>
|
||||
public interface IQueueOperationSubscriber {
|
||||
|
||||
/// <summary>Called when the queue operations's progress changes</summary>
|
||||
|
@ -95,7 +95,7 @@ namespace Nuclex.Support.Scheduling {
|
|||
|
||||
#region class TestOperation
|
||||
|
||||
/// <summary>Progression used for testing in this unit test</summary>
|
||||
/// <summary>Operation used for testing in this unit test</summary>
|
||||
private class TestOperation : Operation, IProgressReporter {
|
||||
|
||||
/// <summary>will be triggered to report when progress has been achieved</summary>
|
||||
|
@ -116,9 +116,9 @@ namespace Nuclex.Support.Scheduling {
|
|||
OnAsyncEnded();
|
||||
}
|
||||
|
||||
/// <summary>Changes the testing progression's indicated progress</summary>
|
||||
/// <summary>Changes the testing operation's indicated progress</summary>
|
||||
/// <param name="progress">
|
||||
/// New progress to be reported by the testing progression
|
||||
/// New progress to be reported by the testing operation
|
||||
/// </param>
|
||||
public void ChangeProgress(float progress) {
|
||||
OnAsyncProgressChanged(progress);
|
||||
|
@ -136,7 +136,7 @@ namespace Nuclex.Support.Scheduling {
|
|||
/// <summary>Fires the progress update event</summary>
|
||||
/// <param name="progress">Progress to report (ranging from 0.0 to 1.0)</param>
|
||||
/// <remarks>
|
||||
/// Informs the observers of this progression about the achieved progress.
|
||||
/// Informs the observers of this operation about the achieved progress.
|
||||
/// </remarks>
|
||||
protected virtual void OnAsyncProgressChanged(float progress) {
|
||||
OnAsyncProgressChanged(new ProgressReportEventArgs(progress));
|
||||
|
@ -145,10 +145,10 @@ namespace Nuclex.Support.Scheduling {
|
|||
/// <summary>Fires the progress update event</summary>
|
||||
/// <param name="eventArguments">Progress to report (ranging from 0.0 to 1.0)</param>
|
||||
/// <remarks>
|
||||
/// Informs the observers of this progression about the achieved progress.
|
||||
/// Allows for classes derived from the Progression class to easily provide
|
||||
/// Informs the observers of this operation about the achieved progress.
|
||||
/// Allows for classes derived from the Operation class to easily provide
|
||||
/// a custom event arguments class that has been derived from the
|
||||
/// Progression's ProgressUpdateEventArgs class.
|
||||
/// operation's ProgressUpdateEventArgs class.
|
||||
/// </remarks>
|
||||
protected virtual void OnAsyncProgressChanged(ProgressReportEventArgs eventArguments) {
|
||||
EventHandler<ProgressReportEventArgs> copy = AsyncProgressChanged;
|
||||
|
@ -175,8 +175,8 @@ namespace Nuclex.Support.Scheduling {
|
|||
TestOperation operation1 = new TestOperation();
|
||||
TestOperation operation2 = new TestOperation();
|
||||
|
||||
QueueOperation<TestOperation> testQueueOperation =
|
||||
new QueueOperation<TestOperation>(
|
||||
OperationQueue<TestOperation> testQueueOperation =
|
||||
new OperationQueue<TestOperation>(
|
||||
new TestOperation[] { operation1, operation2 }
|
||||
);
|
||||
|
||||
|
@ -188,7 +188,7 @@ namespace Nuclex.Support.Scheduling {
|
|||
Method("ProgressChanged").
|
||||
With(
|
||||
new Matcher[] {
|
||||
new NMock2.Matchers.TypeMatcher(typeof(QueueOperation<TestOperation>)),
|
||||
new NMock2.Matchers.TypeMatcher(typeof(OperationQueue<TestOperation>)),
|
||||
new ProgressUpdateEventArgsMatcher(new ProgressReportEventArgs(0.25f))
|
||||
}
|
||||
);
|
||||
|
@ -199,7 +199,7 @@ namespace Nuclex.Support.Scheduling {
|
|||
Method("ProgressChanged").
|
||||
With(
|
||||
new Matcher[] {
|
||||
new NMock2.Matchers.TypeMatcher(typeof(QueueOperation<TestOperation>)),
|
||||
new NMock2.Matchers.TypeMatcher(typeof(OperationQueue<TestOperation>)),
|
||||
new ProgressUpdateEventArgsMatcher(new ProgressReportEventArgs(0.5f))
|
||||
}
|
||||
);
|
|
@ -29,7 +29,7 @@ namespace Nuclex.Support.Scheduling {
|
|||
/// <typeparam name="OperationType">
|
||||
/// Type of the child operations the QueueOperation will contain
|
||||
/// </typeparam>
|
||||
public class QueueOperation<OperationType> : Operation, IProgressReporter
|
||||
public class OperationQueue<OperationType> : Operation, IProgressReporter
|
||||
where OperationType : Operation {
|
||||
|
||||
/// <summary>will be triggered to report when progress has been achieved</summary>
|
||||
|
@ -40,24 +40,24 @@ namespace Nuclex.Support.Scheduling {
|
|||
/// <remarks>
|
||||
/// All child operations will have a default weight of 1.0
|
||||
/// </remarks>
|
||||
public QueueOperation(IEnumerable<OperationType> childs) : this() {
|
||||
public OperationQueue(IEnumerable<OperationType> childs) : this() {
|
||||
|
||||
// Construct a WeightedProgression with the default weight for each
|
||||
// progression and wrap it in an ObservedProgression
|
||||
// Construct a WeightedWaitable with the default weight for each
|
||||
// waitable and wrap it in an ObservedWaitable
|
||||
foreach(OperationType operation in childs)
|
||||
this.children.Add(new WeightedWaitable<OperationType>(operation));
|
||||
|
||||
// Since all progressions have a weight of 1.0, the total weight is
|
||||
// equal to the number of progressions in our list
|
||||
// Since all waitables have a weight of 1.0, the total weight is
|
||||
// equal to the number of waitables in our list
|
||||
this.totalWeight = (float)this.children.Count;
|
||||
|
||||
}
|
||||
|
||||
/// <summary>Initializes a new queue operation with custom weights</summary>
|
||||
/// <param name="childs">Child operations to execute in this operation</param>
|
||||
public QueueOperation(IEnumerable<WeightedWaitable<OperationType>> childs) : this() {
|
||||
public OperationQueue(IEnumerable<WeightedWaitable<OperationType>> childs) : this() {
|
||||
|
||||
// Construct an ObservedProgression around each of the WeightedProgressions
|
||||
// Construct an ObservedWaitablen around each of the WeightedWaitables
|
||||
foreach(WeightedWaitable<OperationType> operation in childs) {
|
||||
this.children.Add(operation);
|
||||
|
||||
|
@ -68,7 +68,7 @@ namespace Nuclex.Support.Scheduling {
|
|||
}
|
||||
|
||||
/// <summary>Initializes a new queue operation</summary>
|
||||
private QueueOperation() {
|
||||
private OperationQueue() {
|
||||
this.asyncOperationEndedDelegate = new EventHandler(asyncOperationEnded);
|
||||
this.asyncOperationProgressChangedDelegate = new EventHandler<ProgressReportEventArgs>(
|
||||
asyncOperationProgressChanged
|
||||
|
@ -99,7 +99,7 @@ namespace Nuclex.Support.Scheduling {
|
|||
/// <summary>Fires the progress update event</summary>
|
||||
/// <param name="progress">Progress to report (ranging from 0.0 to 1.0)</param>
|
||||
/// <remarks>
|
||||
/// Informs the observers of this progression about the achieved progress.
|
||||
/// Informs the observers of this waitable about the achieved progress.
|
||||
/// </remarks>
|
||||
protected virtual void OnAsyncProgressChanged(float progress) {
|
||||
OnAsyncProgressChanged(new ProgressReportEventArgs(progress));
|
||||
|
@ -108,10 +108,10 @@ namespace Nuclex.Support.Scheduling {
|
|||
/// <summary>Fires the progress update event</summary>
|
||||
/// <param name="eventArguments">Progress to report (ranging from 0.0 to 1.0)</param>
|
||||
/// <remarks>
|
||||
/// Informs the observers of this progression about the achieved progress.
|
||||
/// Allows for classes derived from the Progression class to easily provide
|
||||
/// Informs the observers of this waitable about the achieved progress.
|
||||
/// Allows for classes derived from the Waitable class to easily provide
|
||||
/// a custom event arguments class that has been derived from the
|
||||
/// Progression's ProgressUpdateEventArgs class.
|
||||
/// waitable's ProgressUpdateEventArgs class.
|
||||
/// </remarks>
|
||||
protected virtual void OnAsyncProgressChanged(ProgressReportEventArgs eventArguments) {
|
||||
EventHandler<ProgressReportEventArgs> copy = AsyncProgressChanged;
|
Loading…
Add table
Add a link
Reference in a new issue