Skip to content

Commit 03496b4

Browse files
authored
Merge pull request #31 from bomrafinha/bomrafinha
Versão 1.4.4.118
2 parents 97643f5 + 8536bda commit 03496b4

File tree

12 files changed

+677
-107
lines changed

12 files changed

+677
-107
lines changed

README.md

Lines changed: 32 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<br />
66

77
![Maintenance](https://img.shields.io/maintenance/yes/2020)
8-
![Build](https://img.shields.io/badge/Build-1.0.0.0-brightgreen)
8+
![Build](https://img.shields.io/badge/Build-1.4.4.118-brightgreen)
99
![GitHub release (latest by date)](https://img.shields.io/github/v/release/bomrafinha/SortingAlgorithms)
1010
![GitHub Release Date](https://img.shields.io/github/release-date/bomrafinha/SortingAlgorithms)
1111
![Github repo age](https://img.shields.io/github/issues/detail/age/bomrafinha/SortingAlgorithms/1.svg?style=flat-square)
@@ -154,10 +154,10 @@ Os *releases* do repositório serão feitos a cada vez que um módulo estiver 10
154154
<br />
155155

156156
### Padrões adotados no projeto
157-
Para um melhor entendimento do projeto foi-se adotado alguns padrões que facilitam a identificação de cada estrutura usada. São, basicamente, o uso de *camelcase*, com variações nas iniciais;
157+
Para um melhor entendimento do projeto foi-se adotado alguns padrões que facilitam a identificação de cada estrutura usada. São, basicamente, o uso de *camelCase*, e *PascalCase*;
158158

159159
#### Variáveis de método
160-
Variáveis locais devem ser *camelcase* iniciando em minúsculo.
160+
Variáveis locais devem ser *camelCase*.
161161

162162
Observar o espaçamento entre a declaração de variáveis e o inicio do método.
163163

@@ -166,12 +166,12 @@ Observar o espaçamento entre a declaração de variáveis e o inicio do método
166166
#### Variáveis privadas
167167
A declaração de váriaveis privadas deve ocorrer sempre dentro dos modificadores de acesso.
168168

169-
Devem começar sempre com "f" minúsculo, seguido por seu nome em *camelcase* com a inicial em maiúsculo.
169+
Devem ser *camelCase* começando sempre com "f" seguido por seu nome.
170170

171171
![Variáveis privadas](documentation/images/padrao_variaveis_privadas.png)
172172

173173
#### Propriedades
174-
Propriedades devem usar *camelcase* começando sempre com a inicial em maiúsculo.
174+
Propriedades devem usar *PascalCase*.
175175

176176
Devem ter exatamente o nome de sua variável privada e/ou metodo de acesso, eliminando apenas o prefixo (f, get, set).
177177

@@ -180,21 +180,23 @@ Devem ter exatamente o nome de sua variável privada e/ou metodo de acesso, elim
180180
#### Métodos
181181
A declaração de métodos deve ocorrer sempre dentro dos modificadores de acesso.
182182

183-
Métodos devem ser *camelcase* iniciando em minúsculo.
183+
Métodos devem ser *camelCase*.
184184

185-
Os parâmetros do método devem ser *camelcase* iniciando em minúsculo.
185+
Os parâmetros do método devem ser *camelCase* iniciando com "a".
186186

187187
Procurar, quando possível, usar prefixos *get*, *set*, *eh*, etc de acordo com a função do método e/ou seu retorno.
188188

189+
Ao serem chamados usar sempre parentesis em sua chamada, mesmo quando sem parâmetros. Ex: meuMetodo();
190+
189191
![Métodos](documentation/images/padrao_metodos.png)
190192

191193
#### Interfaces
192-
Interfaces devem começar sempre com a letra "I" (maiúsculo), seguido por seu nome em *camelcase* com a inicial em maiúsculo também.
194+
Interfaces devem começar sempre com a letra "I" (maiúsculo), seguido por seu nome em *PascalCase*.
193195

194196
![Interfaces](documentation/images/padrao_interfaces.png)
195197

196198
#### Classes
197-
Classes devem começar sempre com a letra "T" (maiúsculo), seguido por seu nome em *camelcase* com a inicial em maiúsculo também.
199+
Classes devem começar sempre com a letra "T" (maiúsculo), seguido por seu nome em *PascalCase*.
198200

199201
Classes que não extendem nenhuma outra classes em específico devem extender *TInterfacedObject*.
200202

@@ -223,6 +225,15 @@ Separar declações de variáveis, métodos, construtores, destrutores e proprie
223225

224226
![Identação](documentation/images/padrao_identacao_01.png)
225227

228+
#### Chamada de métodos e variaveis internas da classe
229+
230+
Devem ser precedidas da palavra reservada *Self*, para facilitar a leitura do código.
231+
232+
![Self](documentation/images/padrao_self_01.png)
233+
234+
#### Palavras Reservadas
235+
Dá-se preferência ao uso de iniciais minúsculas para palavras reservadas. Porém isso não é uma regra para o projeto tendo em vista que por serem reservadas a IDE às sinaliza, não atrapalhando, assim, a leitura do código.
236+
226237
#### Um código bem padronizado é muito mais fácil de ler, mesmo por programadores que utilizam outras linguagens.
227238

228239
<br />
@@ -235,10 +246,17 @@ Separar declações de variáveis, métodos, construtores, destrutores e proprie
235246
+ Estrutura básica do código
236247

237248
+ Algoritmos
238-
- Bubble Sort
239-
- Insertion Sort
240-
- Selection Sort
241-
- Comb Sort
249+
- Bogo Sort
250+
- Merge Sort
251+
- Heap Sort
252+
- Shell Sort
253+
- Radix Sort
254+
- Gnome Sort
255+
- Counting Sort
256+
- Bucket Sort
257+
- Cocktail Sort
258+
- Tim Sort
259+
- Quick Sort
242260

243261
<br />
244262

@@ -259,6 +277,7 @@ SortingAlgorithms
259277
│ ├── padrao_interfaces.png
260278
│ ├── padrao_metodos.png
261279
│ ├── padrao_propriedades.png
280+
│ ├── padrao_self_01.png
262281
│ ├── padrao_variaveis_locais.png
263282
│ ├── padrao_variaveis_privadas.png
264283
│ ├── project_issue.png
116 Bytes
Loading
1.29 KB
Loading

modules/BubbleSort/U_Sort.Bubble.pas

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,31 +5,22 @@ interface
55
uses U_SortClass, U_SortInterface, FMX.Layouts, System.SysUtils;
66

77
type
8-
TSortBubble = class(TSortClass, ISortInterface<TLayout>)
8+
TSortBubble = class(TSortClass, ISortInterface)
99
private
10-
procedure sort(layout01 : TLayout);
10+
function algoritmo() : Boolean; Override;
1111

12-
public
13-
constructor Create(layout01 : TLayout);
1412
end;
1513

1614
implementation
1715

1816
{ TSortBubble }
1917

20-
constructor TSortBubble.Create(layout01: TLayout);
21-
begin
22-
inherited Create(layout01);
23-
sleep(2000);
24-
sort(layout01);
25-
26-
end;
27-
28-
procedure TSortBubble.sort(layout01: TLayout);
18+
function TSortBubble.algoritmo() : Boolean;
2919
var
3020
i, j : Integer;
3121

3222
begin
23+
Result := False;
3324
for i := 48 downto 0 do
3425
begin
3526
for j := 0 to i do
@@ -41,6 +32,8 @@ procedure TSortBubble.sort(layout01: TLayout);
4132
end;
4233
end;
4334

35+
Result := True;
36+
4437
end;
4538

4639
end.

modules/CombSort/U_Sort.Comb.pas

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,31 +5,22 @@ interface
55
uses U_SortClass, U_SortInterface, FMX.Layouts, System.SysUtils;
66

77
type
8-
TSortComb = class(TSortClass, ISortInterface<TLayout>)
8+
TSortComb = class(TSortClass, ISortInterface)
99
private
10-
procedure sort(layout01 : TLayout);
10+
function algoritmo() : Boolean; Override;
1111

12-
public
13-
constructor Create(layout01 : TLayout);
1412
end;
1513

1614
implementation
1715

1816
{ TSortComb }
1917

20-
constructor TSortComb.Create(layout01: TLayout);
21-
begin
22-
inherited Create(layout01);
23-
sleep(2000);
24-
sort(layout01);
25-
26-
end;
27-
28-
procedure TSortComb.sort(layout01: TLayout);
18+
function TSortComb.algoritmo() : Boolean;
2919
var
3020
i, gap, tamanho : Integer;
3121

3222
begin
23+
Result := False;
3324
tamanho := 50;
3425
gap := trunc(tamanho / 1.3);
3526
while ((gap > 0) and (i <> tamanho - 1)) do
@@ -45,6 +36,7 @@ procedure TSortComb.sort(layout01: TLayout);
4536
end;
4637
gap := Trunc(gap / 1.3);
4738
end;
39+
Result := True;
4840

4941
end;
5042

modules/InsertionSort/U_Sort.Insertion.pas

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,32 +5,23 @@ interface
55
uses U_SortClass, U_SortInterface, FMX.Layouts, System.SysUtils;
66

77
type
8-
TSortInsertion = class(TSortClass, ISortInterface<TLayout>)
8+
TSortInsertion = class(TSortClass, ISortInterface)
99
private
10-
procedure sort(layout01 : TLayout);
10+
function algoritmo() : Boolean; Override;
1111

12-
public
13-
constructor Create(layout01 : TLayout);
1412
end;
1513

1614
implementation
1715

1816
{ TSortInsertion }
1917

20-
constructor TSortInsertion.Create(layout01: TLayout);
21-
begin
22-
inherited Create(layout01);
23-
sleep(2000);
24-
sort(layout01);
25-
26-
end;
27-
28-
procedure TSortInsertion.sort(layout01: TLayout);
18+
function TSortInsertion.algoritmo() : Boolean;
2919
var
3020
i, j : Integer;
3121
key : Single;
3222

3323
begin
24+
Result := False;
3425
for j := 1 to 49 do
3526
begin
3627
key := findRectangle(j).Height;
@@ -44,6 +35,7 @@ procedure TSortInsertion.sort(layout01: TLayout);
4435

4536
end;
4637
end;
38+
Result := True;
4739
end;
4840

4941
end.

modules/SelectionSort/U_Sort.Selection.pas

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,31 +5,22 @@ interface
55
uses U_SortClass, U_SortInterface, FMX.Layouts, System.SysUtils;
66

77
type
8-
TSortSelection = class(TSortClass, ISortInterface<TLayout>)
8+
TSortSelection = class(TSortClass, ISortInterface)
99
private
10-
procedure sort(layout01 : TLayout);
10+
function algoritmo() : Boolean; Override;
1111

12-
public
13-
constructor Create(layout01 : TLayout);
1412
end;
1513

1614
implementation
1715

1816
{ TSortSelection }
1917

20-
constructor TSortSelection.Create(layout01: TLayout);
21-
begin
22-
inherited Create(layout01);
23-
sleep(2000);
24-
sort(layout01);
25-
26-
end;
27-
28-
procedure TSortSelection.sort(layout01: TLayout);
18+
function TSortSelection.algoritmo() : Boolean;
2919
var
3020
i, j, min : Integer;
3121

3222
begin
23+
Result := False;
3324
for i := 0 to 48 do
3425
begin
3526
min := i;
@@ -42,6 +33,7 @@ procedure TSortSelection.sort(layout01: TLayout);
4233
end;
4334
troca(findRectangle(min), findRectangle(i));
4435
end;
36+
Result := True;
4537
end;
4638

4739
end.

project/Sorting.dproj

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -298,11 +298,13 @@
298298
<DCC_DcuOutput>../output</DCC_DcuOutput>
299299
<VerInfo_IncludeVerInfo>true</VerInfo_IncludeVerInfo>
300300
<VerInfo_Locale>1046</VerInfo_Locale>
301-
<VerInfo_Build>21</VerInfo_Build>
301+
<VerInfo_Build>105</VerInfo_Build>
302302
<VerInfo_Debug>true</VerInfo_Debug>
303303
<VerInfo_AutoIncVersion>true</VerInfo_AutoIncVersion>
304-
<VerInfo_Keys>CompanyName=Bomrafinha;FileDescription=$(MSBuildProjectName);FileVersion=1.0.0.21;InternalName=SortingAlgorithms;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProgramID=com.embarcadero.$(MSBuildProjectName);ProductName=$(MSBuildProjectName);ProductVersion=1.0.0.0;Comments=</VerInfo_Keys>
304+
<VerInfo_Keys>CompanyName=Bomrafinha;FileDescription=$(MSBuildProjectName);FileVersion=1.4.4.105;InternalName=SortingAlgorithms;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProgramID=com.embarcadero.$(MSBuildProjectName);ProductName=$(MSBuildProjectName);ProductVersion=1.0.0.0;Comments=</VerInfo_Keys>
305305
<DCC_UnitSearchPath>../app;../output;$(DCC_UnitSearchPath)</DCC_UnitSearchPath>
306+
<VerInfo_MinorVer>4</VerInfo_MinorVer>
307+
<VerInfo_Release>4</VerInfo_Release>
306308
</PropertyGroup>
307309
<PropertyGroup Condition="'$(Cfg_1_Win64)'!=''">
308310
<AppEnableRuntimeThemes>true</AppEnableRuntimeThemes>

0 commit comments

Comments
 (0)