예제 #1
0
        private static Pair <T, Pair <Rational, Rational> > FindInterval <T>(Dictionary <T, Pair <Rational, Rational> > intervals, Rational q) where T : IEquatable <T>
        {
            foreach (var pair in intervals)
            {
                if (q >= pair.Value.First && q < pair.Value.Second)
                {
                    return(new Pair <T, Pair <Rational, Rational> >(pair.Key, pair.Value));
                }
            }

            throw new ArgumentException();
        }