~ubuntu-branches/ubuntu/vivid/drmips/vivid-backports

« back to all changes in this revision

Viewing changes to src/pc/DrMIPS/src/org/fife/ui/autocomplete/SortByRelevanceComparator.java

  • Committer: Package Import Robot
  • Author(s): Bruno Nova
  • Date: 2014-09-27 12:24:17 UTC
  • Revision ID: package-import@ubuntu.com-20140927122417-2gadkwt9k0u7j4zu
Tags: upstream-1.2.3
Import upstream version 1.2.3

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * 12/17/2010
 
3
 *
 
4
 * SortByRelevanceComparator.java - Sorts two Completions by relevance before
 
5
 * sorting them lexicographically.
 
6
 * 
 
7
 * This library is distributed under a modified BSD license.  See the included
 
8
 * RSyntaxTextArea.License.txt file for details.
 
9
 */
 
10
package org.fife.ui.autocomplete;
 
11
 
 
12
import java.util.Comparator;
 
13
 
 
14
 
 
15
/**
 
16
 * Compares two <code>Completion</code>s by their relevance before
 
17
 * sorting them lexicographically.
 
18
 *
 
19
 * @author Robert Futrell
 
20
 * @version 1.0
 
21
 */
 
22
public class SortByRelevanceComparator implements Comparator<Completion> {
 
23
 
 
24
 
 
25
        public int compare(Completion c1, Completion c2) {
 
26
                int rel1 = c1.getRelevance();
 
27
                int rel2 = c2.getRelevance();
 
28
                int diff = rel2 - rel1;//rel1 - rel2;
 
29
                return diff==0 ? c1.compareTo(c2) : diff;
 
30
        }
 
31
 
 
32
 
 
33
}
 
 
b'\\ No newline at end of file'