home *** CD-ROM | disk | FTP | other *** search
- //----------------------------------------------------------------------------
- #ifndef SortThdH
- #define SortThdH
- //----------------------------------------------------------------------------
- #include <ExtCtrls.hpp>
- #include <Graphics.hpp>
- #include <Classes.hpp>
- #include <System.hpp>
- //----------------------------------------------------------------------------
- extern void __fastcall PaintLine(TCanvas *Canvas, int i, int len);
- //----------------------------------------------------------------------------
- class TSortThread : public TThread
- {
- private:
- TPaintBox *FBox;
- Integer *FSortArray;
- Integer FSize;
- Integer FA;
- Integer FB;
- Integer FI;
- Integer FJ;
- void __fastcall DoVisualSwap(void);
-
- protected:
- virtual void __fastcall Execute(void);
- void __fastcall VisualSwap(Integer A, Integer B, Integer I, Integer J);
- virtual void __fastcall Sort(Integer *A, const Integer A_Size) = 0;
-
- public:
- __fastcall TSortThread(TPaintBox *Box, Integer *SortArray,
- const Integer SortArray_Size);
- };
- //----------------------------------------------------------------------------
- class TBubbleSort : public TSortThread
- {
- protected:
- virtual void __fastcall Sort(Integer *A, const Integer A_Size);
- public:
- __fastcall TBubbleSort(TPaintBox *Box, Integer *SortArray,
- const Integer SortArray_Size);
- };
- //----------------------------------------------------------------------------
- class TSelectionSort : public TSortThread
- {
- protected:
- virtual void __fastcall Sort(Integer *A, const Integer A_Size);
- public:
- __fastcall TSelectionSort(TPaintBox *Box, Integer *SortArray,
- const Integer SortArray_Size);
- };
- //----------------------------------------------------------------------------
- class TQuickSort : public TSortThread
- {
- protected:
- void __fastcall QuickSort(Integer *A, const Integer A_Size, Integer iLo,
- Integer iHi);
- virtual void __fastcall Sort(Integer *A, const Integer A_Size);
- public:
- __fastcall TQuickSort(TPaintBox *Box, Integer *SortArray,
- const Integer SortArray_Size);
- };
- //----------------------------------------------------------------------------
- #endif
-