public int compare(Object o1, Object o2) {
int relevance = 0;
if ((o1 instanceof IRelevanceCompletionProposal) && (o2 instanceof IRelevanceCompletionProposal)) {
// sort based on relevance
IRelevanceCompletionProposal cp1 = (IRelevanceCompletionProposal) o1;
IRelevanceCompletionProposal cp2 = (IRelevanceCompletionProposal) o2;
relevance = cp2.getRelevance() - cp1.getRelevance();
// if same relevance, secondary sort (lexigraphically)
if ((relevance == 0) && (o1 instanceof ICompletionProposal) && (o2 instanceof ICompletionProposal)) {
String displayString1 = ((ICompletionProposal) o1).getDisplayString();
String displayString2 = ((ICompletionProposal) o2).getDisplayString();