// Bucket.h   (You may modify, remove and/or add members)
// This class is a simplification of the one given in the 
// textbook "File Structures" by Folk, Zoellick and Riccardi.
// Bucket class holds a bucket in main memory
#ifndef BUCKET_H
#define BUCKET_H
#include "Directory.h"

class Directory;

class Bucket
{
protected: 
// there are no public members,
// access to Bucket members is only through class Directory

Bucket ( Directory *dir, int maxKeys);

int Insert (long key, int dataRecAddr); // may use "char *key" or "string & key"

void Split(); // split the bucket and redistribute keys

int NewRange (int & newStart, int & newEnd);
    // calculate the range in directory of new (split) bucket

int Redistribute (Bucket & newBucket); 
    // redistribute keys between this and new bucket

int Depth; // depth of the bucket
// number of bits used in common by keys of this bucket

Directory *Dir; // pointer to the directory that contains the bucket

int BucketAddr; //address of this bucket in file

// include here variable to hold the various (maxKeys) index records in this bucket
friend class Directory; // Directory has access to its protected members
}; 
#endif
