Exemplo n.º 1
0
        public virtual void Test1()
        {
            int size = 100000;

            NeoDatis.Btree.IBTree tree = new NeoDatis.Btree.Impl.Multiplevalue.InMemoryBTreeMultipleValuesPerKey
                                             ("test1", 2);
            for (int i = 0; i < size; i++)
            {
                tree.Insert(i + 1, "value " + (i + 1));
            }
            AssertEquals(size, tree.GetSize());
            System.Collections.IEnumerator iterator = tree.Iterator(NeoDatis.Odb.Core.OrderByConstants
                                                                    .OrderByAsc);
            int j = 0;

            while (iterator.MoveNext())
            {
                object o = iterator.Current;
                // println(o);
                j++;
                if (j == size)
                {
                    AssertEquals("value " + size, o);
                }
            }
        }
Exemplo n.º 2
0
		public virtual void Test1()
		{
			int size = 100000;
			NeoDatis.Btree.IBTree tree = new NeoDatis.Btree.Impl.Multiplevalue.InMemoryBTreeMultipleValuesPerKey
				("test1", 50);
			for (int i = 0; i < size; i++)
			{
				if (i % 10000 == 0)
				{
					Println(i);
				}
				tree.Insert(i + 1, "value " + (i + 1));
			}
			AssertEquals(size, tree.GetSize());
			System.Collections.IEnumerator iterator = new NeoDatis.Btree.BTreeIteratorMultipleValuesPerKey
				(tree, NeoDatis.Odb.Core.OrderByConstants.OrderByAsc);
			int j = 0;
			while (iterator.MoveNext())
			{
				object o = iterator.Current;
				// println(o);
				j++;
				if (j == size)
				{
					AssertEquals("value " + size, o);
				}
			}
		}
Exemplo n.º 3
0
        public virtual void TestNonUniqueKey()
        {
            int degree = 3;

            NeoDatis.Btree.IBTreeMultipleValuesPerKey tree1 = new NeoDatis.Btree.Impl.Multiplevalue.InMemoryBTreeMultipleValuesPerKey
                                                                  ("7", degree);
            tree1.Insert(1, "A");
            tree1.Insert(1, "AA");
            tree1.Insert(1, "AAA");
            AssertEquals(3, tree1.Search(1).Count);
            AssertEquals("[A, AA, AAA]", tree1.Search(1).ToString());
            AssertEquals(3, tree1.GetSize());
        }
Exemplo n.º 4
0
        public virtual void TestNonUniqueKey2()
        {
            int degree = 3;

            NeoDatis.Btree.IBTreeMultipleValuesPerKey tree1 = new NeoDatis.Btree.Impl.Multiplevalue.InMemoryBTreeMultipleValuesPerKey
                                                                  ("7", degree);
            tree1.Insert(1, "A");
            tree1.Insert(1, "AA");
            tree1.Insert(1, "AAA");
            tree1.Insert(1, "BBB");
            System.Collections.ICollection c = tree1.Search(1);
            AssertEquals(4, c.Count);
            System.Collections.IEnumerator iterator = c.GetEnumerator();
            AssertEquals("A", iterator.Current);
            AssertEquals("AA", iterator.Current);
            AssertEquals(4, tree1.GetSize());
            AssertEquals("[A, AA, AAA, BBB]", c.ToString());
        }
Exemplo n.º 5
0
		public virtual void Test2SameKey()
		{
			int size = 1000;
			int size2 = 100;
			NeoDatis.Btree.IBTree tree = new NeoDatis.Btree.Impl.Multiplevalue.InMemoryBTreeMultipleValuesPerKey
				("test1", 50);
			for (int i = 0; i < size; i++)
			{
				if (i % 10000 == 0)
				{
					Println(i);
				}
				tree.Insert(i + 1, "value " + (i + 1));
			}
			for (int i = 0; i < size2; i++)
			{
				tree.Insert(100, "value " + (i + 1));
			}
			AssertEquals(size + size2, tree.GetSize());
		}
Exemplo n.º 6
0
        public virtual void Test2SameKey()
        {
            int size  = 1000;
            int size2 = 100;

            NeoDatis.Btree.IBTree tree = new NeoDatis.Btree.Impl.Multiplevalue.InMemoryBTreeMultipleValuesPerKey
                                             ("test1", 50);
            for (int i = 0; i < size; i++)
            {
                if (i % 10000 == 0)
                {
                    Println(i);
                }
                tree.Insert(i + 1, "value " + (i + 1));
            }
            for (int i = 0; i < size2; i++)
            {
                tree.Insert(100, "value " + (i + 1));
            }
            AssertEquals(size + size2, tree.GetSize());
        }
Exemplo n.º 7
0
        public virtual void TestNonUniqueKey2()
		{
			int degree = 3;
			NeoDatis.Btree.IBTreeMultipleValuesPerKey tree1 = new NeoDatis.Btree.Impl.Multiplevalue.InMemoryBTreeMultipleValuesPerKey
				("7", degree);
			tree1.Insert(1, "A");
			tree1.Insert(1, "AA");
			tree1.Insert(1, "AAA");
			tree1.Insert(1, "BBB");
			System.Collections.ICollection c = tree1.Search(1);
			AssertEquals(4, c.Count);
			System.Collections.IEnumerator iterator = c.GetEnumerator();
			AssertEquals("A", iterator.Current);
			AssertEquals("AA", iterator.Current);
			AssertEquals(4, tree1.GetSize());
			AssertEquals("[A, AA, AAA, BBB]", c.ToString());
		}
Exemplo n.º 8
0
        public virtual void TestNonUniqueKey()
		{
			int degree = 3;
			NeoDatis.Btree.IBTreeMultipleValuesPerKey tree1 = new NeoDatis.Btree.Impl.Multiplevalue.InMemoryBTreeMultipleValuesPerKey
				("7", degree);
			tree1.Insert(1, "A");
			tree1.Insert(1, "AA");
			tree1.Insert(1, "AAA");
			AssertEquals(3, tree1.Search(1).Count);
			AssertEquals("[A, AA, AAA]", tree1.Search(1).ToString());
			AssertEquals(3, tree1.GetSize());
		}