// ChangeSorter - a sorted linked list of change numbers, with
// a variety of handy querying methods.
#include "changenode.h"
class ChangeSorter
{
public:
ChangeSorter();
~ChangeSorter();
// Basic put/get methods.
void AddChange( StrBuf&, FileRev* ); // add a change to the list
int GetPos( StrBuf& ); // get position of a change
StrBuf GetChange( int ); // get change at a position
FileRev* GetRev( int );
// These methods support the birdseyeview feature by
// pretending that only arrow-bearing revisions matter.
void MarkArrChange( StrBuf& ); // mark this change as "arrowed"
void AlignArr(); // call this after marking all changes
int GetArrPos( StrBuf& ); // not valid until after AlignArr()
StrBuf GetArrChange( int ); // ditto
FileRev* GetArrRev( int );
int Size() { return size; } ;
int ArrSize() { return arrsize; } ;
private:
// Find the given ChangeNode.
ChangeNode* LookupChange( int n );
ChangeNode* head; // head node of the list
ChangeNode* tail; // tail node of the list
int size; // the total number of nodes in the list
int arrsize; // total number of marked changes
};