home *** CD-ROM | disk | FTP | other *** search
/ DOS/V Power Report 1997 May / VPR9705A.ISO / VPR_DATA / PROGRAM / CBTRIAL / SETUP / DATA.Z / SORTTHD.H < prev    next >
C/C++ Source or Header  |  1997-02-14  |  2KB  |  68 lines

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