MCPcopy Index your code
hub / github.com/processing/processing / sortCode

Method sortCode

app/src/processing/app/Sketch.java:270–293  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

268
269
270 protected void sortCode() {
271 // cheap-ass sort of the rest of the files
272 // it's a dumb, slow sort, but there shouldn't be more than ~5 files
273 for (int i = 1; i < codeCount; i++) {
274 int who = i;
275 for (int j = i + 1; j < codeCount; j++) {
276 if (code[j].getFileName().compareTo(code[who].getFileName()) < 0) {
277 who = j; // this guy is earlier in the alphabet
278 }
279 }
280 if (who != i) { // swap with someone if changes made
281 SketchCode temp = code[who];
282 code[who] = code[i];
283 code[i] = temp;
284
285 // We also need to update the current tab
286 if (currentIndex == i) {
287 currentIndex = who;
288 } else if (currentIndex == who) {
289 currentIndex = i;
290 }
291 }
292 }
293 }
294
295
296 boolean renamingCode;

Callers 4

loadMethod · 0.95
loadNewTabMethod · 0.95
nameCodeMethod · 0.95
addFileMethod · 0.95

Calls 2

compareToMethod · 0.45
getFileNameMethod · 0.45

Tested by

no test coverage detected