home *** CD-ROM | disk | FTP | other *** search
/ CD Actual 9 / CDACTUAL9.iso / progs / CB / DATA.Z / SORTTHD.H < prev    next >
Encoding:
C/C++ Source or Header  |  1996-08-05  |  2.1 KB  |  64 lines

  1. //----------------------------------------------------------------------------
  2. #ifndef SortThdH
  3. #define SortThdH
  4. //----------------------------------------------------------------------------
  5. #include <ExtCtrls.hpp>
  6. #include <Graphics.hpp>
  7. #include <Classes.hpp>
  8. #include <System.hpp>
  9. //----------------------------------------------------------------------------
  10. extern void __fastcall PaintLine(TCanvas *Canvas, int i, int len);
  11. //----------------------------------------------------------------------------
  12. class TSortThread : public TThread
  13. {
  14. private: 
  15.     TPaintBox *FBox;
  16.     Integer *FSortArray;
  17.     Integer FSize;
  18.     Integer FA;
  19.     Integer FB;
  20.     Integer FI;
  21.     Integer FJ;
  22.     void __fastcall DoVisualSwap(void);
  23.     
  24. protected:
  25.     virtual void __fastcall Execute(void);
  26.     void __fastcall VisualSwap(Integer A, Integer B, Integer I, Integer J);
  27.     virtual void __fastcall Sort(Integer *A, const Integer A_Size) = 0;
  28.     
  29. public:
  30.     __fastcall TSortThread(TPaintBox *Box, Integer *SortArray, 
  31.         const Integer SortArray_Size);
  32. };
  33. //----------------------------------------------------------------------------
  34. class TBubbleSort : public TSortThread
  35. {
  36. protected:
  37.     virtual void __fastcall Sort(Integer *A, const Integer A_Size);
  38. public:
  39.     __fastcall TBubbleSort(TPaintBox *Box, Integer *SortArray, 
  40.         const Integer SortArray_Size);
  41. };
  42. //----------------------------------------------------------------------------
  43. class TSelectionSort : public TSortThread
  44. {
  45. protected:
  46.     virtual void __fastcall Sort(Integer *A, const Integer A_Size);
  47. public:
  48.     __fastcall TSelectionSort(TPaintBox *Box, Integer *SortArray, 
  49.         const Integer SortArray_Size);
  50. };
  51. //----------------------------------------------------------------------------
  52. class TQuickSort : public TSortThread
  53. {
  54. protected:
  55.     void __fastcall QuickSort(Integer *A, const Integer A_Size, Integer iLo, 
  56.       Integer iHi);
  57.     virtual void __fastcall Sort(Integer *A, const Integer A_Size);
  58. public:
  59.     __fastcall TQuickSort(TPaintBox *Box, Integer *SortArray, 
  60.         const Integer SortArray_Size);
  61. };
  62. //----------------------------------------------------------------------------
  63. #endif    
  64.