public static PineNA ValueWhen(PineNA condition, Pine source, uint occurrence = 0) { PineNA ret = new PineNA(); Queue <double> Queue = new Queue <double>(); foreach ((double?cond, double sour)tuple in ZipEnd(condition, source, (cond, sour) => (cond, sour))) { if (tuple.cond == null) { ret.Add(null); } else { Queue.Enqueue(tuple.sour); if (occurrence == 0) { ret.Add(Queue.Dequeue()); } else { ret.Add(null); occurrence--; } } } return(ret); }
public static PineNA operator /(double?number, PineNA pine) { PineNA ret = new PineNA(); foreach (double?num in pine) { ret.Add(number / num); } return(ret); }
public static PineNA operator -(PineNA pine, double?number) { PineNA ret = new PineNA(); foreach (double?num in pine) { ret.Add(num - number); } return(ret); }
public static PineNA ToPineNA(this IEnumerable <decimal?> source) { PineNA ret = new PineNA(); foreach (decimal?num in source) { ret.Add((double?)num); } return(ret); }