Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
        public static PineNA operator /(double?number, PineNA pine)
        {
            PineNA ret = new PineNA();

            foreach (double?num in pine)
            {
                ret.Add(number / num);
            }
            return(ret);
        }
Exemplo n.º 3
0
        public static PineNA operator -(PineNA pine, double?number)
        {
            PineNA ret = new PineNA();

            foreach (double?num in pine)
            {
                ret.Add(num - number);
            }
            return(ret);
        }
Exemplo n.º 4
0
        public static PineNA ToPineNA(this IEnumerable <decimal?> source)
        {
            PineNA ret = new PineNA();

            foreach (decimal?num in source)
            {
                ret.Add((double?)num);
            }
            return(ret);
        }