public static ExpressionDefinition TakeWhile() { Expression <Func <IObservable <string>, IObservable <string> > > expression = (a) => a.TakeWhile(i => i.Length < 3); return(ExpressionDefinition.Create(expression)); }
public static ExpressionDefinition GroupBy() { string code = @" from s in a group s by s.Length into gr from ss in gr select ""Key: "" + gr.Key + "" Value: "" + ss; "; Expression <Func <IObservable <string>, IObservable <string> > > expression = a => from s in a group s by s.Length into gr from ss in gr select "Key: " + gr.Key + " Value: " + ss; var @operator = ReflectionHelper.GetMethod( () => Observable.GroupBy <string, string>(null, _ => _)); return(ExpressionDefinition.Create(expression, new ExpressionSettings { Operator = @operator, CodeSample = code })); }
public static ExpressionDefinition SelectMany() { Expression <Func <IObservable <long>, IObservable <long> > > expression = a => a.SelectMany(v => Observable.Interval(TimeSpan.FromMilliseconds(1000)).Select(_ => v).Take((int)v)); return(ExpressionDefinition.Create(expression)); }
public static ExpressionDefinition Skip() { Expression <Func <IObservable <string>, IObservable <string> > > expression = (a) => a.Skip(4); return(ExpressionDefinition.Create(expression)); }
public static ExpressionDefinition Scan() { Expression <Func <IObservable <string>, IObservable <int> > > expression = (a) => a.Scan(0, (acc, v) => acc + v.Length); return(ExpressionDefinition.Create(expression)); }
public static ExpressionDefinition DistinctUntilChanged() { Expression <Func <IObservable <string>, IObservable <string> > > expression = (a) => a.DistinctUntilChanged(); return(ExpressionDefinition.Create(expression)); }
public static ExpressionDefinition Sample() { Expression <Func <IObservable <string>, IObservable <string> > > expression = (a) => a.Sample(TimeSpan.FromSeconds(2)); return(ExpressionDefinition.Create(expression)); }
public static ExpressionDefinition Where() { Expression <Func <IObservable <string>, IObservable <string> > > expression = (a) => a.Where(i => i.Length % 2 == 0); return(ExpressionDefinition.Create(expression)); }
public static ExpressionDefinition OnErrorResumeNext() { Expression <Func <IObservable <string>, IObservable <string>, IObservable <string> > > expression = (a, b) => a.OnErrorResumeNext(b); return(ExpressionDefinition.Create(expression)); }
public static ExpressionDefinition Any() { Expression <Func <IObservable <string>, IObservable <bool> > > expression = a => a.Any(i => i.Length < 3); return(ExpressionDefinition.Create(expression)); }
public static ExpressionDefinition Average() { Expression <Func <IObservable <double>, IObservable <double> > > expression = a => a.Average(); return(ExpressionDefinition.Create(expression)); }
public static ExpressionDefinition Min() { Expression <Func <IObservable <int>, IObservable <int> > > expression = a => a.Min(); return(ExpressionDefinition.Create(expression)); }
public static ExpressionDefinition Count() { Expression <Func <IObservable <string>, IObservable <int> > > expression = a => a.Count(); return(ExpressionDefinition.Create(expression)); }
public static ExpressionDefinition Merge() { Expression <Func <IObservable <string>, IObservable <string>, IObservable <string>, IObservable <string> > > expression = (a, b, c) => Observable.Merge(a, b, c); return(ExpressionDefinition.Create(expression)); }
public static ExpressionDefinition Select() { Expression <Func <IObservable <string>, IObservable <int> > > expression = (a) => a.Select(i => i.Length); return(ExpressionDefinition.Create(expression)); }
public static ExpressionDefinition CombineLatest() { Expression <Func <IObservable <string>, IObservable <string>, IObservable <string> > > expression = (a, b) => a.CombineLatest(b, (x, y) => x + " - " + y); return(ExpressionDefinition.Create(expression)); }
public static ExpressionDefinition TakeUntil() { Expression <Func <IObservable <string>, IObservable <string>, IObservable <string> > > expression = (a, b) => a.TakeUntil(b); return(ExpressionDefinition.Create(expression)); }
public static ExpressionDefinition Repeat() { Expression <Func <IObservable <string>, IObservable <string> > > expression = a => a .SelectMany(v => string.IsNullOrEmpty(v) ? Observable.Throw <string>(new Exception()) : Observable.Return(v)) .Retry(); return(ExpressionDefinition.Create(expression)); }
public static ExpressionDefinition Merge() { Expression <Action> temp = () => Observable.Merge(new IObservable <string> [0]); var @operator = (temp.Body as MethodCallExpression).Method; Func <IObservable <string>, IObservable <string>, IObservable <string>, IObservable <string> > expression = (a, b, c) => Observable.Merge(a, b, c); return(ExpressionDefinition.Create(expression, new ExpressionSettings { Operator = @operator })); }
public static ExpressionDefinition BufferWithCount() { Expression <Func <IObservable <string>, IObservable <string> > > expression = a => a.Buffer(3). Select(i => string.Join(",", i.ToArray())); var @operator = ReflectionHelper.GetMethod( () => Observable.Buffer <string>(null, 3)); return(ExpressionDefinition.Create(expression, new ExpressionSettings { Operator = @operator, Name = "BufferWithCount" })); }
public static ExpressionDefinition WindowWithTime() { Expression <Func <IObservable <string>, IObservable <string> > > expression = a => a.Window(TimeSpan.FromSeconds(3)). Select(i => string.Join(",", i.ToArray())); var @operator = ReflectionHelper.GetMethod( () => Observable.Window <string>(null, TimeSpan.FromSeconds(3))); return(ExpressionDefinition.Create(expression, new ExpressionSettings { Operator = @operator })); }
public static ExpressionDefinition IncrementalSearch() { Func <IObservable <string>, IObservable <Person>, IObservable <Person> > expression = (codeChanged, webServiceCall) => { var q = from code in codeChanged from x in Observable.Return(new Unit()).Delay(TimeSpan.FromSeconds(4)).TakeUntil(codeChanged) from result in webServiceCall.TakeUntil(codeChanged) select result; return(q); }; return(ExpressionDefinition.Create(expression, new ExpressionSettings { Name = "Incremental find", Description = @"Send the code of the person you are looking for, " + "after four seconds (if you don't send new code again) web service " + "will be called. The result won't be returned if new code is provided " + "in the meantime.", })); }