예제 #1
0
파일: Operators.cs 프로젝트: TzarIvan/ratel
 public BivariateOperator(Spud <T> a, Spud <T> b, BivariateOperatorFunction <T> op) : base(a.manager)
 {
     this.a  = dependsOn(a);
     this.b  = dependsOn(b);
     this.op = op;
     Bomb.unless(a.manager == b.manager, () => "a and b must have same manager");
 }
예제 #2
0
            public MakesLoop(SpudManager manager, int size) : base(manager)
            {
                Spud <double> last = this;

                zeroTo(size, i => {
                    Spud <double> next = new RootSpud <double>(manager);
                    next.dependsOn(last);
                    last = next;
                });
                dependsOn(last);
            }
예제 #3
0
 // USE WITH CARE!  This tremendously useful spud has one drawback.  An IntervalSpud creates a new "time" definition, based on the BarSpud it is wrapped around.
 // So, 2 IntervalSpuds wrapped around different BarSpuds are not necessarily time-synchronized
 // (if one of the spuds has gotten a data point in the new interval, and the other hasn't, spud[0] will be different for each of them).
 // If you don't understand, go through your use case with Jeric and make sure it works. or pray. or sacrifice a chicken.
 public IntervalSpud(Spud <Bar> values, Interval interval) : base(new SpudManager())
 {
     values.valueSet += newBar => {
         var newRange = interval.range(jDate(newBar.time));
         if (currentRange == null || !currentRange.equals(newRange))
         {
             manager.newBar();
             currentRange = newRange;
             current      = new ProtoBar(newBar.java());
         }
         else
         {
             current.update(newBar.java());
         }
         set(new Bar(current.asBar()));
     };
 }
예제 #4
0
파일: Operators.cs 프로젝트: TzarIvan/ratel
 public Plus(Spud <double> a, Spud <double> b) : base(a, b, (x, y) => x + y)
 {
 }
예제 #5
0
 public LogSpud(Spud <double> values) : base(values.manager)
 {
     this.values = dependsOn(values);
 }
예제 #6
0
 public DiffSpud(Spud <double> values, int lag) : base(values.manager)
 {
     this.lag    = lag;
     this.values = dependsOn(values);
     Bomb.unless(lag >= 1, () => "lag should be >= 1");
 }
예제 #7
0
 public LaggedSpud(Spud <T> values, int lag) : base(values.manager)
 {
     this.lag    = lag;
     this.values = dependsOn(values);
 }
예제 #8
0
 public CrossOverSpud(Spud <T> spud1, Spud <T> spud2) : base(spud1.manager)
 {
     this.spud1 = dependsOn(spud1);
     this.spud2 = dependsOn(spud2);
 }
예제 #9
0
파일: Operators.cs 프로젝트: TzarIvan/ratel
 public Divide(Spud <double> a, Spud <double> b) : base(a, b, (x, y) => y == 0 ? 0 : x / y)
 {
 }
예제 #10
0
 public static ComparableSpud <T> comparable <T>(Spud <T> spud) where T : IComparable <T>
 {
     return(new ComparableSpudWrapper <T>(spud));
 }
예제 #11
0
 public ComparableSpudWrapper(Spud <T> spud) : base(spud.manager)
 {
     this.spud = dependsOn(spud);
 }
예제 #12
0
 public DependsOnDependent(Spud <double> root) : base(root.manager)
 {
     parent = dependsOn(new DependentSpud(root));
 }
예제 #13
0
 public DependentSpud(Spud <double> parent) : base(parent.manager)
 {
     this.parent = dependsOn(parent);
 }
예제 #14
0
파일: Operators.cs 프로젝트: TzarIvan/ratel
 public Minus(Spud <double> a, Spud <double> b) : base(a, b, (x, y) => x - y)
 {
 }
예제 #15
0
 public SpudTransformer(Spud <SOURCE> spud, Converter <SOURCE, TARGET> transform) : base(spud.manager)
 {
     this.spud   = dependsOn(spud);
     transformer = transform;
 }
예제 #16
0
파일: Operators.cs 프로젝트: TzarIvan/ratel
 public Times(Spud <double> a, Spud <double> b) : base(a, b, (x, y) => x * y)
 {
 }
예제 #17
0
 public WindowSpud(Spud <T> values, int window) : base(values.manager)
 {
     this.window = window;
     this.values = dependsOn(values);
 }
예제 #18
0
 public MinMax(Spud <T> spud, int period, int direction) : base(spud.manager)
 {
     this.spud      = dependsOn(spud);
     this.period    = period;
     this.direction = direction;
 }
예제 #19
0
 public CrossOverSpud(Spud <T> spud1, T t) : this(spud1, spud1.constant(t))
 {
 }