InnerNode::InnerNode(InnerNode* Parent, Btree* Tree, Node* oldroot)
                : Node(0, Parent, Tree)
{
    // called only by Btree to initialize the InnerNode that is
    // about to become the root.
    item = new Item[maxIndex()+1];
    if( item == 0 )
        ClassLib_error( __ENOMEMIA );
    append( 0, oldroot );
}
Exemplo n.º 2
0
void SortedArray::add( Object& toAdd )
{
    if( toAdd.isSortable() )
        {
        if( lastElementIndex == upperbound )
            {
            reallocate( arraySize() + 1 );
            }
        int insertionPoint = lowerbound;
        while( insertionPoint <= lastElementIndex &&
               (Sortable&)objectAt( insertionPoint ) < (Sortable&)toAdd
             )
            insertionPoint++;

        insertEntry( insertionPoint );
        setData( insertionPoint, &toAdd );
        itemsInContainer++;
        lastElementIndex++;
        }
    else
        ClassLib_error( __ENOTSORT );
}
InnerNode::InnerNode(InnerNode* P, Btree* T) : Node(0,P,T)
{
    item = new Item[maxIndex()+1];
    if( item == 0 )
        ClassLib_error( __ENOMEMIA );
}