Example #1
0
 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");
 }
Example #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);
            }
Example #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()));
     };
 }
Example #4
0
 public Plus(Spud <double> a, Spud <double> b) : base(a, b, (x, y) => x + y)
 {
 }
Example #5
0
 public LogSpud(Spud <double> values) : base(values.manager)
 {
     this.values = dependsOn(values);
 }
Example #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");
 }
Example #7
0
 public LaggedSpud(Spud <T> values, int lag) : base(values.manager)
 {
     this.lag    = lag;
     this.values = dependsOn(values);
 }
Example #8
0
 public CrossOverSpud(Spud <T> spud1, Spud <T> spud2) : base(spud1.manager)
 {
     this.spud1 = dependsOn(spud1);
     this.spud2 = dependsOn(spud2);
 }
Example #9
0
 public Divide(Spud <double> a, Spud <double> b) : base(a, b, (x, y) => y == 0 ? 0 : x / y)
 {
 }
Example #10
0
 public static ComparableSpud <T> comparable <T>(Spud <T> spud) where T : IComparable <T>
 {
     return(new ComparableSpudWrapper <T>(spud));
 }
Example #11
0
 public ComparableSpudWrapper(Spud <T> spud) : base(spud.manager)
 {
     this.spud = dependsOn(spud);
 }
Example #12
0
 public DependsOnDependent(Spud <double> root) : base(root.manager)
 {
     parent = dependsOn(new DependentSpud(root));
 }
Example #13
0
 public DependentSpud(Spud <double> parent) : base(parent.manager)
 {
     this.parent = dependsOn(parent);
 }
Example #14
0
 public Minus(Spud <double> a, Spud <double> b) : base(a, b, (x, y) => x - y)
 {
 }
Example #15
0
 public SpudTransformer(Spud <SOURCE> spud, Converter <SOURCE, TARGET> transform) : base(spud.manager)
 {
     this.spud   = dependsOn(spud);
     transformer = transform;
 }
Example #16
0
 public Times(Spud <double> a, Spud <double> b) : base(a, b, (x, y) => x * y)
 {
 }
Example #17
0
 public WindowSpud(Spud <T> values, int window) : base(values.manager)
 {
     this.window = window;
     this.values = dependsOn(values);
 }
Example #18
0
 public MinMax(Spud <T> spud, int period, int direction) : base(spud.manager)
 {
     this.spud      = dependsOn(spud);
     this.period    = period;
     this.direction = direction;
 }
Example #19
0
 public CrossOverSpud(Spud <T> spud1, T t) : this(spud1, spud1.constant(t))
 {
 }