Пример #1
0
    public void Add(float val)
    {
        if (buffer.IsFull())
        {
            avg -= buffer.GetAt(0);
        }

        var newVal = val / size;

        buffer.Add(newVal);
        avg += newVal;
    }
    public override bool Update(T data)
    {
        buffer.Add(data);

        hasNext = buffer.IsFull();
        if (hasNext)
        {
            //dynamic temp = processor.Invoke(buffer);
            //total = (U)(total + temp);
            var temp = processor.Invoke(buffer);
            total = accumulator.Invoke(total, temp);

            totalCount++;
            next = temp;
        }

        return(hasNext);
    }