[ZODB-Dev] OOBTree: Persistent Objects as keys

Jim Fulton jim@zope.com
Thu, 07 Feb 2002 06:54:04 -0500


Thomas Guettler wrote:
> 
> Jim Fulton wrote:
> 
> >
> >Thomas Guettler wrote:
> >
> >>Toby Dickenson wrote:
> >>
> >...
> >
> >>If the tree of BTree would use type(obj) at the first level it should work:
> >>
> >>BTree
> >>|-strings ["foo", "foo2", ...]
> >>|-FooObjects
> >>|-Integers
> >>
> >
> >I don't know what this means.
> >
> I attached a gif that should make this more clear.
> A tree is a hierarchical datastructure with one root.
> What I mean with "first level" are the knots which can be accessed directly
> from the root. One solution would be to have at the first level one knot
> for
> each type of key. Then you only compare objects of the same type in the
> sub-trees.
> 
> When a new item is added you check if the type ("integer") of the key
> has already a corresponding
> sub-tree. If not create one, then add the item to the other objects of
> type "integer".
> 
> If you want to get an item, you check the type of the key. If the key is
> an integer you
> search in the integers sub-tree, if it is a string you search in the
> "strings" subtree.
> 
> In XML this would look like this:
> 
> <knot>
>   <knot value="integers">
>       <knot value="1"/>
>       <knot value="2"/>
>   </knot>
>   <knot value="strings">
>     <knot value="a">
>     <knot value="b">
>   </knot>
> </knot>
> 
> Tell me if it is unclear. English is not my native language.

OK, now I understand what you're saying. :)

This might be an interesting data structure. It's not a BTree.

I'd be happy of BTrees simply checked to make sure that it's
keys were truly ordered.

Jim

--
Jim Fulton           mailto:jim@zope.com       Python Powered!        
CTO                  (888) 344-4332            http://www.python.org  
Zope Corporation     http://www.zope.com       http://www.zope.org