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;
16 public void setOrderAlphabetically(boolean orderAlphabetically) {
17 fOrderAlphabetically= orderAlphabetically;
21 * @see Comparator#compare(Object, Object)
23 public int compare(Object o1, Object o2) {
24 IPHPCompletionProposal c1= (IPHPCompletionProposal) o1;
25 IPHPCompletionProposal c2= (IPHPCompletionProposal) o2;
26 if (!fOrderAlphabetically) {
27 int relevanceDif= c2.getRelevance() - c1.getRelevance();
28 if (relevanceDif != 0) {
32 return c1.getDisplayString().compareToIgnoreCase(c2.getDisplayString());