MCPcopy Index your code
hub / github.com/benfry/processing4 / sortCode

Method sortCode

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

Source from the content-addressed store, hash-verified

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