1 package net.sourceforge.phpdt.internal.ui.text.java;
3 import java.util.Comparator;
5 public class PHPCompletionProposalComparator implements Comparator {
7 private boolean fOrderAlphabetically;
10 * Constructor for CompletionProposalComparator.
12 // public PHPCompletionProposalComparator() {
13 // fOrderAlphabetically= false;
15 public void setOrderAlphabetically(boolean orderAlphabetically) {
16 fOrderAlphabetically = orderAlphabetically;
22 * @see Comparator#compare(Object, Object)
24 public int compare(Object o1, Object o2) {
25 IPHPCompletionProposal c1 = (IPHPCompletionProposal) o1;
26 IPHPCompletionProposal c2 = (IPHPCompletionProposal) o2;
27 if (!fOrderAlphabetically) {
28 int relevanceDif = c2.getRelevance() - c1.getRelevance();
29 if (relevanceDif != 0) {
33 return c1.getDisplayString().compareToIgnoreCase(c2.getDisplayString());