Example #1
0
        public void SearchTests(double searchValue, int?foundValue)
        {
            var tree = new BalancedBoundingTree <double, int>(0, 0.1, 1);

            tree.Insert(0.1, 0.2, 2);
            tree.Insert(0.2, 0.3, 3);
            tree.Insert(0.3, 0.4, 4);

            if (!foundValue.HasValue)
            {
                Assert.AreSame(BalancedBoundingTree <double, int> .Nil, tree.Search(searchValue));
            }
            else
            {
                var actual = tree.Search(searchValue);
                Assert.AreEqual(foundValue.Value, actual.Value);
            }
        }
Example #2
0
        public int F(double x)
        {
            if (x < 0 || x > 1)
            {
                throw new ArgumentOutOfRangeException(nameof(x), $"argument must be 0<=x<=1 : {x}");
            }
            var node = _graph.Search(x);

            return(node.Value);
        }