Skip to content

Commit f0a9a84

Browse files
committed
Fix export for Insertionsort, Improve formatting for exports
1 parent 2a57139 commit f0a9a84

File tree

6 files changed

+34
-26
lines changed

6 files changed

+34
-26
lines changed

src/main/java/de/moritzf/sorting/logic/sorting/BubbleSort.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ public int getProtocolSize() {
182182
public String protocol2LaTeX() {
183183
String retString = "";
184184
for (int i = 0; i < protocol.size(); i++) {
185-
retString += " " + this.step2LaTeX(i) + "\n\\newline \n\\newline \n";
185+
retString += this.step2LaTeX(i) + "\n\n";
186186
}
187187

188188
return retString;

src/main/java/de/moritzf/sorting/logic/sorting/HeapSort.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,7 @@ public String step2LaTeX(int chosenStepNumber) {
344344
if (chosenStepNumber == 0) {
345345
retString += "\\underline{\\textbf{Heap Creation}}\n\n original binary tree \n\n";
346346
} else if (chosenStepNumber == 1) {
347-
retString += "$\\boxed{Zahl}$ := element that is to be heapified \n\n";
347+
retString += "$\\boxed{number}$ := element that is to be heapified \n\n";
348348
}
349349

350350
/*

src/main/java/de/moritzf/sorting/logic/sorting/InsertionSort.java

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,17 @@ public void reset() {
114114
*
115115
* @return the string
116116
*/
117+
/**
118+
* This produces a LaTeX-Expression representing the entire protocol.
119+
*
120+
* @return the string
121+
*/
117122
public String protocol2LaTeX() {
118-
return step2LaTeX(0);
123+
String retString = "";
124+
for (int i = 0; i < protocol.size(); i++) {
125+
retString += this.step2LaTeX(i) + "\n \n";
126+
}
127+
return retString;
119128
}
120129

121130
/**

src/main/java/de/moritzf/sorting/logic/sorting/QuickSort.java

Lines changed: 20 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,23 @@
44

55
/**
66
* @author Moritz Floeter
7-
* <p>
8-
* The class QuickSort.
9-
* This class represents the implementation of the algorithm quicksort.
10-
* <p>
11-
* --------------------------------------------------------------------
12-
* This program is free software: you can redistribute it and/or modify
13-
* it under the terms of the GNU General Public License as published by
14-
* the Free Software Foundation, either version 3 of the License, or
15-
* (at your option) any later version.
16-
* <p>
17-
* This program is distributed in the hope that it will be useful,
18-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
19-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20-
* GNU General Public License for more details.
21-
* <p>
22-
* You should have received a copy of the GNU General Public License
23-
* along with this program. If not, see <http://www.gnu.org/licenses/>.
7+
* <p>
8+
* The class QuickSort.
9+
* This class represents the implementation of the algorithm quicksort.
10+
* <p>
11+
* --------------------------------------------------------------------
12+
* This program is free software: you can redistribute it and/or modify
13+
* it under the terms of the GNU General Public License as published by
14+
* the Free Software Foundation, either version 3 of the License, or
15+
* (at your option) any later version.
16+
* <p>
17+
* This program is distributed in the hope that it will be useful,
18+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
19+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20+
* GNU General Public License for more details.
21+
* <p>
22+
* You should have received a copy of the GNU General Public License
23+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
2424
*/
2525
public class QuickSort extends SortingAlgorithm {
2626

@@ -144,7 +144,7 @@ public boolean doStep() {
144144
int temp = oldArrayClone[leftEnd];
145145
oldArrayClone[leftEnd] = oldArrayClone[rightEnd];
146146
oldArrayClone[rightEnd] = temp;
147-
/*
147+
/*
148148
* When the rightEnd and the leftEnd have "traded sides"
149149
* this means that all elements are on the according
150150
* side. The only thing left to do here is to swap the
@@ -281,8 +281,8 @@ private static int[] subArray(int[] original, int begin, int end) {
281281
public String protocol2LaTeX() {
282282
String retString = "";
283283
for (int i = 0; i < protocol.size(); i++) {
284-
retString += " " + this.step2LaTeX(i)
285-
+ "\n\\newline \n\\newline \n\\newline \n";
284+
retString += this.step2LaTeX(i)
285+
+ "\n\n";
286286
}
287287
return retString;
288288
}
@@ -422,5 +422,4 @@ public int getStepLimit() {
422422
}
423423

424424

425-
426425
}

src/main/java/de/moritzf/sorting/logic/sorting/RadixSort.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ public String step2LaTeX(int stepNumber) {
205205
public String protocol2LaTeX() {
206206
String retString = "";
207207
for (int i = 0; i < protocol.size(); i++) {
208-
retString += " " + this.step2LaTeX(i) + " \n\\newline \n";
208+
retString += " " + this.step2LaTeX(i) + " \n \n";
209209
}
210210

211211
return retString;

src/main/java/de/moritzf/sorting/logic/sorting/SelectionSort.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ public void doAllSteps() {
217217
public String protocol2LaTeX() {
218218
String retString = "";
219219
for (int i = 0; i < protocol.size(); i++) {
220-
retString += " " + this.step2LaTeX(i) + "\n\\newline \n\\newline \n";
220+
retString += this.step2LaTeX(i) + "\n \n";
221221
}
222222

223223
return retString;

0 commit comments

Comments
 (0)