MCPcopy Create free account
hub / github.com/M66B/FairEmail / compare

Method compare

app/src/main/java/eu/faircode/email/EntityFolder.java:618–633  ·  view source on GitHub ↗
(FolderScore fs1, FolderScore fs2)

Source from the content-addressed store, hash-verified

616 if (!types.contains(type)) {
617 Collections.sort(candidates, new Comparator<FolderScore>() {
618 @Override
619 public int compare(FolderScore fs1, FolderScore fs2) {
620 int r = Boolean.compare(fs1.folder.read_only, fs2.folder.read_only);
621 if (r != 0)
622 return r;
623
624 int s = Integer.compare(fs1.score, fs2.score);
625 if (s == 0) {
626 int len1 = (fs1.folder.separator == null ? 1
627 : fs1.folder.name.split(Pattern.quote(String.valueOf(fs1.folder.separator))).length);
628 int len2 = (fs2.folder.separator == null ? 1
629 : fs2.folder.name.split(Pattern.quote(String.valueOf(fs2.folder.separator))).length);
630 return Integer.compare(len1, len2);
631 } else
632 return s;
633 }
634 });
635
636 candidates.get(0).folder.type = type;

Callers

nothing calls this directly

Calls 5

getDisplayNameMethod · 0.95
indexOfMethod · 0.80
normalizeMethod · 0.80
quoteMethod · 0.45
compareToMethod · 0.45

Tested by

no test coverage detected