コード例 #1
0
        public virtual void Test1()
        {
            var    size = 100000;
            IBTree tree = new InMemoryBTreeMultipleValuesPerKey(50);

            for (var i = 0; i < size; i++)
            {
                if (i % 10000 == 0)
                {
                    Println(i);
                }
                tree.Insert(i + 1, "value " + (i + 1));
            }
            AssertEquals(size, tree.GetSize());
            IEnumerator iterator = new BTreeIteratorMultipleValuesPerKey <object>(tree, OrderByConstants.OrderByAsc);
            var         j        = 0;

            while (iterator.MoveNext())
            {
                var o = iterator.Current;
                // println(o);
                j++;
                if (j == size)
                {
                    AssertEquals("value " + size, o);
                }
            }
        }
コード例 #2
0
ファイル: TestLazyBTree.cs プロジェクト: Sinoprise/NDatabase
        public virtual void Test3()
        {
            var    size = 100000;
            IBTree tree = new InMemoryBTreeMultipleValuesPerKey(2);

            for (var i = 0; i < size; i++)
            {
                // println(i);
                tree.Insert((i + 1).ToString(), "value " + (i + 1));
            }
            AssertEquals(size, tree.GetSize());
            var iterator = tree.Iterator <object>(OrderByConstants.OrderByAsc);
            var j        = 0;

            while (iterator.MoveNext())
            {
                var o = iterator.Current;
                // println(o);
                j++;
                if (j == size)
                {
                    AssertEquals("value " + (size - 1), o);
                }
            }
        }
コード例 #3
0
        public virtual void TestNonUniqueKey()
        {
            var degree = 3;
            IBTreeMultipleValuesPerKey tree1 = new InMemoryBTreeMultipleValuesPerKey(degree);

            tree1.Insert(1, "A");
            tree1.Insert(1, "AA");
            tree1.Insert(1, "AAA");
            AssertEquals(3, tree1.Search(1).Count);
            AssertEquals("A", tree1.Search(1)[0].ToString());
            AssertEquals("AA", tree1.Search(1)[1].ToString());
            AssertEquals("AAA", tree1.Search(1)[2].ToString());
            AssertEquals(3, tree1.GetSize());
        }
コード例 #4
0
ファイル: MultipleKeyBTree.cs プロジェクト: danfma/NDB
 public virtual void Test2SameKey()
 {
     var size = 1000;
     var size2 = 100;
     IBTree tree = new InMemoryBTreeMultipleValuesPerKey(50);
     for (var i = 0; i < size; i++)
     {
         if (i % 10000 == 0)
             Println(i);
         tree.Insert(i + 1, "value " + (i + 1));
     }
     for (var i = 0; i < size2; i++)
         tree.Insert(100, "value " + (i + 1));
     AssertEquals(size + size2, tree.GetSize());
 }
コード例 #5
0
ファイル: TestNativeBTree.cs プロジェクト: danfma/NDB
 public virtual void Test2()
 {
     var size = 100000;
     IBTree tree = new InMemoryBTreeMultipleValuesPerKey(2);
     for (var i = 0; i < size; i++)
         tree.Insert(i + 1, "value " + (i + 1));
     AssertEquals(size, tree.GetSize());
     var iterator = tree.Iterator<object>(OrderByConstants.OrderByDesc);
     var j = 0;
     while (iterator.MoveNext())
     {
         var o = iterator.Current;
         // println(o);
         j++;
         if (j == size)
             AssertEquals("value " + 1, o);
     }
 }
コード例 #6
0
        public virtual void Test2SameKey()
        {
            var    size  = 1000;
            var    size2 = 100;
            IBTree tree  = new InMemoryBTreeMultipleValuesPerKey(50);

            for (var i = 0; i < size; i++)
            {
                if (i % 10000 == 0)
                {
                    Println(i);
                }
                tree.Insert(i + 1, "value " + (i + 1));
            }
            for (var i = 0; i < size2; i++)
            {
                tree.Insert(100, "value " + (i + 1));
            }
            AssertEquals(size + size2, tree.GetSize());
        }
コード例 #7
0
ファイル: BigBTree.cs プロジェクト: spolnik/ndatabase
        public virtual void Test3()
        {
            var size = 10;
            IBTree tree = new InMemoryBTreeMultipleValuesPerKey(5);
            for (var i = 0; i < size; i++)
            {
                Println(i);
                tree.Insert(i + 1, "value " + (i + 1));
            }
            AssertEquals(size, tree.GetSize());
            IEnumerator iterator = new BTreeIteratorMultipleValuesPerKey<object>(tree, OrderByConstants.OrderByAsc);

            var j = 0;
            while (iterator.MoveNext())
            {
                var o = iterator.Current;
                Console.WriteLine(o);
                j++;
                if (j == size)
                    AssertEquals("value " + size, o);
            }
        }
コード例 #8
0
ファイル: TestNativeBTree.cs プロジェクト: mrdotnet/NDatabase
        public virtual void Test1()
        {
            var    size = 100;
            IBTree tree = new InMemoryBTreeMultipleValuesPerKey(2);

            for (var i = 0; i < size; i++)
            {
                tree.Insert(i + 1, "value " + (i + 1));
            }
            AssertEquals(size, tree.GetSize());
            var iterator = tree.Iterator <object>(OrderByConstants.OrderByAsc);
            var j        = 0;

            while (iterator.MoveNext())
            {
                var o = iterator.Current;
                j++;
                AssertEquals("value " + j, o);
                if (j == size)
                {
                    AssertEquals("value " + size, o);
                }
            }
        }
コード例 #9
0
        public virtual void TestNonUniqueKey2()
        {
            var degree = 3;
            IBTreeMultipleValuesPerKey tree1 = new InMemoryBTreeMultipleValuesPerKey(degree);

            tree1.Insert(1, "A");
            tree1.Insert(1, "AA");
            tree1.Insert(1, "AAA");
            tree1.Insert(1, "BBB");
            var c = tree1.Search(1);

            AssertEquals(4, c.Count);
            var iterator = c.GetEnumerator();

            iterator.MoveNext();
            AssertEquals("A", iterator.Current);
            iterator.MoveNext();
            AssertEquals("AA", iterator.Current);
            AssertEquals(4, tree1.GetSize());
            AssertEquals("A", c[0].ToString());
            AssertEquals("AA", c[1].ToString());
            AssertEquals("AAA", c[2].ToString());
            AssertEquals("BBB", c[3].ToString());
        }
コード例 #10
0
 public virtual void TestNonUniqueKey2()
 {
     var degree = 3;
     IBTreeMultipleValuesPerKey tree1 = new InMemoryBTreeMultipleValuesPerKey(degree);
     tree1.Insert(1, "A");
     tree1.Insert(1, "AA");
     tree1.Insert(1, "AAA");
     tree1.Insert(1, "BBB");
     var c = tree1.Search(1);
     AssertEquals(4, c.Count);
     var iterator = c.GetEnumerator();
     iterator.MoveNext();
     AssertEquals("A", iterator.Current);
     iterator.MoveNext();
     AssertEquals("AA", iterator.Current);
     AssertEquals(4, tree1.GetSize());
     AssertEquals("A", c[0].ToString());
     AssertEquals("AA", c[1].ToString());
     AssertEquals("AAA", c[2].ToString());
     AssertEquals("BBB", c[3].ToString());
 }
コード例 #11
0
 public virtual void TestNonUniqueKey()
 {
     var degree = 3;
     IBTreeMultipleValuesPerKey tree1 = new InMemoryBTreeMultipleValuesPerKey(degree);
     tree1.Insert(1, "A");
     tree1.Insert(1, "AA");
     tree1.Insert(1, "AAA");
     AssertEquals(3, tree1.Search(1).Count);
     AssertEquals("A", tree1.Search(1)[0].ToString());
     AssertEquals("AA", tree1.Search(1)[1].ToString());
     AssertEquals("AAA", tree1.Search(1)[2].ToString());
     AssertEquals(3, tree1.GetSize());
 }