I realize that the `?` operator is logically equivalent of an `if`, I would still find this more readable:

    if (prefix.length() <= contextLength) {
      return prefix;
    }
    return ELLIPSIS + prefix.substring(prefix.length() - contextLength);

(I do agree that `computeCommonPrefix()` is really hard to read)