blob: 6799109be42af262867790922875e56a4794f96b [file] [log] [blame]
Jan Tattermuscha7608b02015-02-03 17:54:38 -08001using System;
2using System.Threading;
3using System.Threading.Tasks;
4using System.Collections.Generic;
5using System.Reactive.Linq;
6
7namespace math
8{
9// /// <summary>
10// /// Dummy local implementation of math service.
11// /// </summary>
12// public class DummyMathServiceClient : IMathServiceClient
13// {
14// public DivReply Div(DivArgs args, CancellationToken token = default(CancellationToken))
15// {
16// // TODO: cancellation...
17// return DivInternal(args);
18// }
19//
20// public Task<DivReply> DivAsync(DivArgs args, CancellationToken token = default(CancellationToken))
21// {
22// return Task.Factory.StartNew(() => DivInternal(args), token);
23// }
24//
25// public IObservable<Num> Fib(FibArgs args, CancellationToken token = default(CancellationToken))
26// {
27// if (args.Limit > 0)
28// {
29// // TODO: cancellation
30// return FibInternal(args.Limit).ToObservable();
31// }
32//
33// throw new NotImplementedException("Not implemented yet");
34// }
35//
36// public Task<Num> Sum(IObservable<Num> inputs, CancellationToken token = default(CancellationToken))
37// {
38// // TODO: implement
39// inputs = null;
40// return Task.Factory.StartNew(() => Num.CreateBuilder().Build(), token);
41// }
42//
43// public IObservable<DivReply> DivMany(IObservable<DivArgs> inputs, CancellationToken token = default(CancellationToken))
44// {
45// // TODO: implement
46// inputs = null;
47// return new List<DivReply> { }.ToObservable ();
48// }
49//
50//
51// DivReply DivInternal(DivArgs args)
52// {
53// long quotient = args.Dividend / args.Divisor;
54// long remainder = args.Dividend % args.Divisor;
55// return new DivReply.Builder{ Quotient = quotient, Remainder = remainder }.Build();
56// }
57//
58// IEnumerable<Num> FibInternal(long n)
59// {
60// long a = 0;
61// yield return new Num.Builder{Num_=a}.Build();
62//
63// long b = 1;
64// for (long i = 0; i < n - 1; i++)
65// {
66// long temp = a;
67// a = b;
68// b = temp + b;
69// yield return new Num.Builder{Num_=a}.Build();
70// }
71// }
72// }
73}
74