Skip to content

Commit d53dea4

Browse files
committed
Fixed #15 + Fixed #16 + Fixed #17
1 parent 41ef9fc commit d53dea4

5 files changed

Lines changed: 82 additions & 13 deletions

File tree

modules/CombSort/U_Sort.Comb.pas

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,13 @@ interface
66

77
type
88
TSortComb = class(TSortClass, ISortInterface)
9+
private
10+
procedure algoritmo(); Override;
11+
912
public
1013
constructor Create(layout01 : TLayout);
1114

12-
procedure sort(); Override;
15+
procedure sort();
1316

1417
end;
1518

@@ -23,7 +26,13 @@ constructor TSortComb.Create(layout01: TLayout);
2326

2427
end;
2528

26-
procedure TSortComb.sort();
29+
procedure TSortComb.sort;
30+
begin
31+
inherited sort();
32+
33+
end;
34+
35+
procedure TSortComb.algoritmo();
2736
var
2837
i, gap, tamanho : Integer;
2938

modules/InsertionSort/U_Sort.Insertion.pas

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,13 @@ interface
66

77
type
88
TSortInsertion = class(TSortClass, ISortInterface)
9+
private
10+
procedure algoritmo(); Override;
11+
912
public
1013
constructor Create(layout01 : TLayout);
1114

12-
procedure sort(); Override;
15+
procedure sort();
1316

1417
end;
1518

@@ -23,7 +26,13 @@ constructor TSortInsertion.Create(layout01: TLayout);
2326

2427
end;
2528

26-
procedure TSortInsertion.sort();
29+
procedure TSortInsertion.sort;
30+
begin
31+
inherited sort();
32+
33+
end;
34+
35+
procedure TSortInsertion.algoritmo();
2736
var
2837
i, j : Integer;
2938
key : Single;

modules/SelectionSort/U_Sort.Selection.pas

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,13 @@ interface
66

77
type
88
TSortSelection = class(TSortClass, ISortInterface)
9+
private
10+
procedure algoritmo(); Override;
11+
912
public
1013
constructor Create(layout01 : TLayout);
1114

12-
procedure sort(); Override;
15+
procedure sort();
1316

1417
end;
1518

@@ -23,7 +26,13 @@ constructor TSortSelection.Create(layout01: TLayout);
2326

2427
end;
2528

26-
procedure TSortSelection.sort();
29+
procedure TSortSelection.sort;
30+
begin
31+
inherited sort();
32+
33+
end;
34+
35+
procedure TSortSelection.algoritmo();
2736
var
2837
i, j, min : Integer;
2938

src/Sorting/U_Sorting.Viewer.fmx

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ object SortingViewer: TSortingViewer
209209
TextSettings.Font.Size = 14.000000000000000000
210210
TextSettings.Font.StyleExt = {00070000000000000004000000}
211211
end
212-
object Button10: TButton
212+
object bInsertionSort: TButton
213213
Align = Top
214214
StyledSettings = [FontColor]
215215
Margins.Left = 5.000000000000000000
@@ -222,11 +222,13 @@ object SortingViewer: TSortingViewer
222222
Size.Height = 22.000000000000000000
223223
Size.PlatformDefault = False
224224
TabOrder = 5
225+
Text = 'InsertionSort'
225226
TextSettings.Font.Family = 'Calibri'
226227
TextSettings.Font.Size = 14.000000000000000000
227228
TextSettings.Font.StyleExt = {00070000000000000004000000}
229+
OnClick = bInsertionSortClick
228230
end
229-
object Button11: TButton
231+
object bSelectionSort: TButton
230232
Align = Top
231233
StyledSettings = [FontColor]
232234
Margins.Left = 5.000000000000000000
@@ -239,11 +241,13 @@ object SortingViewer: TSortingViewer
239241
Size.Height = 22.000000000000000000
240242
Size.PlatformDefault = False
241243
TabOrder = 4
244+
Text = 'SelectionSort'
242245
TextSettings.Font.Family = 'Calibri'
243246
TextSettings.Font.Size = 14.000000000000000000
244247
TextSettings.Font.StyleExt = {00070000000000000004000000}
248+
OnClick = bSelectionSortClick
245249
end
246-
object Button12: TButton
250+
object bCombSort: TButton
247251
Align = Top
248252
StyledSettings = [FontColor]
249253
Margins.Left = 5.000000000000000000
@@ -256,9 +260,11 @@ object SortingViewer: TSortingViewer
256260
Size.Height = 22.000000000000000000
257261
Size.PlatformDefault = False
258262
TabOrder = 3
263+
Text = 'CombSort'
259264
TextSettings.Font.Family = 'Calibri'
260265
TextSettings.Font.Size = 14.000000000000000000
261266
TextSettings.Font.StyleExt = {00070000000000000004000000}
267+
OnClick = bCombSortClick
262268
end
263269
object Button13: TButton
264270
Align = Top

src/Sorting/U_Sorting.Viewer.pas

Lines changed: 40 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
interface
44

55
uses
6-
U_SortClass, U_Sort.Bubble, {U_Sort.Insertion, U_Sort.Selection, U_Sort.Comb,}
6+
U_SortClass, U_Sort.Bubble, U_Sort.Insertion, U_Sort.Selection, U_Sort.Comb,
77
FMX.Controls, FMX.Layouts, System.Classes, FMX.Types, FMX.Forms, System.SysUtils,
88
FMX.Objects, FMX.Effects, FMX.Controls.Presentation, FMX.StdCtrls,
99
FMX.Filter.Effects, System.Types;
@@ -25,9 +25,9 @@ TSortingViewer = class(TForm)
2525
Button7: TButton;
2626
Button8: TButton;
2727
Button9: TButton;
28-
Button10: TButton;
29-
Button11: TButton;
30-
Button12: TButton;
28+
bInsertionSort: TButton;
29+
bSelectionSort: TButton;
30+
bCombSort: TButton;
3131
Button13: TButton;
3232
Button14: TButton;
3333
Button15: TButton;
@@ -36,6 +36,9 @@ TSortingViewer = class(TForm)
3636
Rectangle1: TRectangle;
3737
procedure bBubbleSortClick(Sender: TObject);
3838
procedure FormCreate(Sender: TObject);
39+
procedure bInsertionSortClick(Sender: TObject);
40+
procedure bSelectionSortClick(Sender: TObject);
41+
procedure bCombSortClick(Sender: TObject);
3942
private
4043
var
4144
fSort : TSortClass;
@@ -63,6 +66,39 @@ procedure TSortingViewer.bBubbleSortClick(Sender: TObject);
6366
end;
6467

6568

69+
procedure TSortingViewer.bCombSortClick(Sender: TObject);
70+
begin
71+
if Assigned(fSort) then
72+
begin
73+
fSort.Free;
74+
end;
75+
fSort := TSortComb.Create(Layout5);
76+
fSort.sort();
77+
78+
end;
79+
80+
procedure TSortingViewer.bInsertionSortClick(Sender: TObject);
81+
begin
82+
if Assigned(fSort) then
83+
begin
84+
fSort.Free;
85+
end;
86+
fSort := TSortInsertion.Create(Layout5);
87+
fSort.sort();
88+
89+
end;
90+
91+
procedure TSortingViewer.bSelectionSortClick(Sender: TObject);
92+
begin
93+
if Assigned(fSort) then
94+
begin
95+
fSort.Free;
96+
end;
97+
fSort := TSortSelection.Create(Layout5);
98+
fSort.sort();
99+
100+
end;
101+
66102
procedure TSortingViewer.FormCreate(Sender: TObject);
67103
var
68104
ScreenSize: TSize;

0 commit comments

Comments
 (0)