Exemplo n.º 1
0
        internal KeyValuePair <Key, double>?FirstEventWhenMore(Key from, double threshold)
        {
            if (Predicates.More(from, To))
            {
                return(null);
            }
            if (Maximum <= threshold)
            {
                return(null);
            }
            KeyValuePair <Key, double>?result = null;

            if ((null != FirstChild) && (null != SecondChild))
            {
                result = FirstChild.FirstEventWhenMore(from, threshold);
                if (null == result)
                {
                    result = SecondChild.FirstEventWhenMore(from, threshold);
                }
                return(result);
            }
            Debug.Assert(null == FirstChild);
            Debug.Assert(null == SecondChild);
            if ((Open > threshold) && (Predicates.MoreOrEqual(From, from)))
            {
                result = new KeyValuePair <Key, double>(From, Open);
            }
            else if (Close > threshold)
            {
                result = new KeyValuePair <Key, double>(To, Close);
            }
            return(result);
        }