annotate Implab/IPromise.cs @ 104:5f10d54b45df v2

renamed Promise.Last -> Promise.On Promise.On doesn't changes Promise.IsExclusive property
author cin
date Sun, 09 Nov 2014 23:03:45 +0300
parents 279e226dffdd
children 2573b562e328
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
7
7ea9363fef6c inital progress handling
cin
parents:
diff changeset
1 using System;
7ea9363fef6c inital progress handling
cin
parents:
diff changeset
2 using System.Collections.Generic;
7ea9363fef6c inital progress handling
cin
parents:
diff changeset
3 using System.Linq;
7ea9363fef6c inital progress handling
cin
parents:
diff changeset
4 using System.Text;
7ea9363fef6c inital progress handling
cin
parents:
diff changeset
5
66
790e8a997d30 Refactoring
cin
parents: 33
diff changeset
6 namespace Implab {
790e8a997d30 Refactoring
cin
parents: 33
diff changeset
7 public interface IPromise: ICancellable {
790e8a997d30 Refactoring
cin
parents: 33
diff changeset
8 /// <summary>
790e8a997d30 Refactoring
cin
parents: 33
diff changeset
9 /// Check whereather the promise has no more than one dependent promise.
790e8a997d30 Refactoring
cin
parents: 33
diff changeset
10 /// </summary>
790e8a997d30 Refactoring
cin
parents: 33
diff changeset
11 bool IsExclusive {
790e8a997d30 Refactoring
cin
parents: 33
diff changeset
12 get;
790e8a997d30 Refactoring
cin
parents: 33
diff changeset
13 }
26
f0bf98e4d22c refactoring
cin
parents: 25
diff changeset
14
66
790e8a997d30 Refactoring
cin
parents: 33
diff changeset
15 /// <summary>
790e8a997d30 Refactoring
cin
parents: 33
diff changeset
16 /// Тип результата, получаемого через данное обещание.
790e8a997d30 Refactoring
cin
parents: 33
diff changeset
17 /// </summary>
790e8a997d30 Refactoring
cin
parents: 33
diff changeset
18 Type PromiseType { get; }
25
9bf5b23650c9 refactoring
cin
parents: 19
diff changeset
19
74
c4140283575c minor fixes
cin
parents: 66
diff changeset
20 /// <summary>
99
8ddf1648eca4 fixed TransientPromiseException handling
cin
parents: 96
diff changeset
21 /// Обещание является выполненым, либо успешно, либо с ошибкой, либо отменено.
74
c4140283575c minor fixes
cin
parents: 66
diff changeset
22 /// </summary>
66
790e8a997d30 Refactoring
cin
parents: 33
diff changeset
23 bool IsResolved { get; }
790e8a997d30 Refactoring
cin
parents: 33
diff changeset
24
74
c4140283575c minor fixes
cin
parents: 66
diff changeset
25 /// <summary>
c4140283575c minor fixes
cin
parents: 66
diff changeset
26 /// Обещание было отменено.
c4140283575c minor fixes
cin
parents: 66
diff changeset
27 /// </summary>
66
790e8a997d30 Refactoring
cin
parents: 33
diff changeset
28 bool IsCancelled { get; }
25
9bf5b23650c9 refactoring
cin
parents: 19
diff changeset
29
101
279e226dffdd code cleanup
cin
parents: 99
diff changeset
30 IPromise Then(Action success, Action<Exception> error, Action cancel);
279e226dffdd code cleanup
cin
parents: 99
diff changeset
31 IPromise Then(Action success, Action<Exception> error);
66
790e8a997d30 Refactoring
cin
parents: 33
diff changeset
32 IPromise Then(Action success);
75
4439140706d0 major refactoring, added tasks support
cin
parents: 74
diff changeset
33
101
279e226dffdd code cleanup
cin
parents: 99
diff changeset
34 IPromise Chain(Func<IPromise> chained, Func<Exception, IPromise> error, Action cancel);
279e226dffdd code cleanup
cin
parents: 99
diff changeset
35 IPromise Chain(Func<IPromise> chained, Func<Exception, IPromise> error);
96
daffa72a1cec Added the chaining method to the non-generic IPromise
cin
parents: 76
diff changeset
36 IPromise Chain(Func<IPromise> chained);
daffa72a1cec Added the chaining method to the non-generic IPromise
cin
parents: 76
diff changeset
37
75
4439140706d0 major refactoring, added tasks support
cin
parents: 74
diff changeset
38 /// <summary>
4439140706d0 major refactoring, added tasks support
cin
parents: 74
diff changeset
39 /// Добавляет последнй обработчик в цепочку обещаний, не создает промежуточных обещаний.
4439140706d0 major refactoring, added tasks support
cin
parents: 74
diff changeset
40 /// </summary>
4439140706d0 major refactoring, added tasks support
cin
parents: 74
diff changeset
41 /// <param name="success">Success.</param>
4439140706d0 major refactoring, added tasks support
cin
parents: 74
diff changeset
42 /// <param name="error">Error.</param>
4439140706d0 major refactoring, added tasks support
cin
parents: 74
diff changeset
43 /// <param name="cancel">Cancel.</param>
104
5f10d54b45df renamed Promise.Last -> Promise.On
cin
parents: 101
diff changeset
44 void On(Action success, Action<Exception> error, Action cancel);
5f10d54b45df renamed Promise.Last -> Promise.On
cin
parents: 101
diff changeset
45 void On(Action success, Action<Exception> error);
5f10d54b45df renamed Promise.Last -> Promise.On
cin
parents: 101
diff changeset
46 void On(Action success);
5f10d54b45df renamed Promise.Last -> Promise.On
cin
parents: 101
diff changeset
47 void On(Action success, PromiseEventType events);
75
4439140706d0 major refactoring, added tasks support
cin
parents: 74
diff changeset
48
101
279e226dffdd code cleanup
cin
parents: 99
diff changeset
49 IPromise Error(Action<Exception> error);
74
c4140283575c minor fixes
cin
parents: 66
diff changeset
50 /// <summary>
101
279e226dffdd code cleanup
cin
parents: 99
diff changeset
51 /// Обрабатывает либо ошибку, либо результат, либо отмену.
74
c4140283575c minor fixes
cin
parents: 66
diff changeset
52 /// </summary>
c4140283575c minor fixes
cin
parents: 66
diff changeset
53 /// <param name="handler">Обработчик.</param>
c4140283575c minor fixes
cin
parents: 66
diff changeset
54 /// <remarks>После обработке ошибки, она передается дальше.</remarks>
c4140283575c minor fixes
cin
parents: 66
diff changeset
55 /// <summary>
c4140283575c minor fixes
cin
parents: 66
diff changeset
56 /// Обрабатывает либо ошибку, либо результат, либо отмену обещания.
c4140283575c minor fixes
cin
parents: 66
diff changeset
57 /// </summary>
c4140283575c minor fixes
cin
parents: 66
diff changeset
58 /// <param name="handler">Обработчик.</param>
c4140283575c minor fixes
cin
parents: 66
diff changeset
59 /// <remarks>После обработке ошибки, она передается дальше.</remarks>
76
c761fc982e1d Refactoring of the IPromise<T> interface
cin
parents: 75
diff changeset
60 IPromise Anyway(Action handler);
74
c4140283575c minor fixes
cin
parents: 66
diff changeset
61 /// <summary>
101
279e226dffdd code cleanup
cin
parents: 99
diff changeset
62 /// Обработчик для регистрации отмены обещания.
74
c4140283575c minor fixes
cin
parents: 66
diff changeset
63 /// </summary>
101
279e226dffdd code cleanup
cin
parents: 99
diff changeset
64 /// <returns>Новое обещание, связанное с текущим, выполнится после указанного обработчика.</returns>
74
c4140283575c minor fixes
cin
parents: 66
diff changeset
65 /// <param name="handler">Обработчик события.</param>
c4140283575c minor fixes
cin
parents: 66
diff changeset
66 /// <remarks>Если обработчик вызывает исключение, то оно передается обработчику ошибки, результат работы
c4140283575c minor fixes
cin
parents: 66
diff changeset
67 /// которого будет передан связанному обещанию</remarks>
66
790e8a997d30 Refactoring
cin
parents: 33
diff changeset
68 IPromise Cancelled(Action handler);
7
7ea9363fef6c inital progress handling
cin
parents:
diff changeset
69
74
c4140283575c minor fixes
cin
parents: 66
diff changeset
70 /// <summary>
c4140283575c minor fixes
cin
parents: 66
diff changeset
71 /// Преобразует результат обещания к заданному типу и возвращает новое обещание.
c4140283575c minor fixes
cin
parents: 66
diff changeset
72 /// </summary>
66
790e8a997d30 Refactoring
cin
parents: 33
diff changeset
73 IPromise<T> Cast<T>();
26
f0bf98e4d22c refactoring
cin
parents: 25
diff changeset
74
74
c4140283575c minor fixes
cin
parents: 66
diff changeset
75 /// <summary>
c4140283575c minor fixes
cin
parents: 66
diff changeset
76 /// Синхронизирует текущий поток с обещанием.
c4140283575c minor fixes
cin
parents: 66
diff changeset
77 /// </summary>
66
790e8a997d30 Refactoring
cin
parents: 33
diff changeset
78 void Join();
74
c4140283575c minor fixes
cin
parents: 66
diff changeset
79 /// <summary>
c4140283575c minor fixes
cin
parents: 66
diff changeset
80 /// Синхронизирует текущий поток с обещанием.
c4140283575c minor fixes
cin
parents: 66
diff changeset
81 /// </summary>
c4140283575c minor fixes
cin
parents: 66
diff changeset
82 /// <param name="timeout">Время ожидания, по его истечению возникнет исключение.</param>
c4140283575c minor fixes
cin
parents: 66
diff changeset
83 /// <exception cref="TimeoutException">Превышено время ожидания.</exception>
66
790e8a997d30 Refactoring
cin
parents: 33
diff changeset
84 void Join(int timeout);
7
7ea9363fef6c inital progress handling
cin
parents:
diff changeset
85
7ea9363fef6c inital progress handling
cin
parents:
diff changeset
86 }
7ea9363fef6c inital progress handling
cin
parents:
diff changeset
87 }