diff Implab/IPromise.cs @ 66:790e8a997d30

Refactoring
author cin
date Thu, 14 Aug 2014 18:08:09 +0400
parents b255e4aeef17
children c4140283575c
line wrap: on
line diff
--- a/Implab/IPromise.cs	Mon Jun 30 13:55:22 2014 +0400
+++ b/Implab/IPromise.cs	Thu Aug 14 18:08:09 2014 +0400
@@ -3,29 +3,35 @@
 using System.Linq;
 using System.Text;
 
-namespace Implab
-{
-    public interface IPromise<T>: IPromiseBase
-    {
+namespace Implab {
+    public interface IPromise: ICancellable {
+        /// <summary>
+        /// Check whereather the promise has no more than one dependent promise.
+        /// </summary>
+        bool IsExclusive {
+            get;
+        }
 
-        new T Join();
-        new T Join(int timeout);
+        /// <summary>
+        /// Тип результата, получаемого через данное обещание.
+        /// </summary>
+        Type PromiseType { get; }
 
-        IPromise<T> Then(ResultHandler<T> success, ErrorHandler error);
-        IPromise<T> Then(ResultHandler<T> success, ErrorHandler<T> error);
-        IPromise<T> Then(ResultHandler<T> success);
-        new IPromise<T> Error(ErrorHandler error);
-        IPromise<T> Error(ErrorHandler<T> error);
+        bool IsResolved { get; }
+
+        bool IsCancelled { get; }
 
-        IPromise<T2> Map<T2>(ResultMapper<T,T2> mapper, ErrorHandler error);
-        IPromise<T2> Map<T2>(ResultMapper<T, T2> mapper);
+        IPromise Then(Action success,ErrorHandler error);
+        IPromise Then(Action success);
+        IPromise Error(ErrorHandler error);
+        IPromise Anyway(Action handler);
+        IPromise Finally(Action handler);
+        IPromise Cancelled(Action handler);
 
-        IPromise<T2> Chain<T2>(ChainedOperation<T, T2> chained, ErrorHandler error);
-        IPromise<T2> Chain<T2>(ChainedOperation<T, T2> chained);
+        IPromise<T> Cast<T>();
 
-        new IPromise<T> Cancelled(Action handler);
-        new IPromise<T> Finally(Action handler);
-        new IPromise<T> Anyway(Action handler);
+        void Join();
+        void Join(int timeout);
 
     }
 }