shellJobIdCloseness function
How close candidate is to requested — lower is closer. Ids sharing
the numeric part (the part memory gets right) always rank ahead of ids
that don't; within one numeric part the edit distance of the tail
decides.
Implementation
int shellJobIdCloseness(String requested, String candidate) {
final a = parseShellJobIdParts(requested);
final b = parseShellJobIdParts(candidate);
if (a == null || b == null || a.n != b.n) {
return _differentNumericPenalty + _editDistance(requested, candidate);
}
return _editDistance(a.tail, b.tail);
}