Source code: jgift/search/FileNameComparator.java
1 /*
2 * This file is part of jgiFT.
3 * Copyright (c) 2003, Jason Shobe
4 *
5 * jgiFT is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * jgiFT is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with jgiFT; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 */
19 package jgift.search;
20
21 /**
22 * Compares search results based on their file name.
23 *
24 * @author Jason Shobe
25 * @version $Revision: 1.1 $
26 */
27 public class FileNameComparator extends SearchResultComparator {
28 /**
29 * Compare two search results for order.
30 *
31 * @param r1 the first result to be compared.
32 * @param r2 the second result to be compared.
33 *
34 * @return -1 if r1 is less than r2, 0 if the objects are equivelent, or
35 * 1 if r1 is greater than r2.
36 */
37 protected int compareResults(SearchResult r1, SearchResult r2) {
38 return r1.getFile().compareTo(r2.getFile());
39 }
40 }
41