KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > dotmarketing > comparators > WebAssetSortOrderComparator


1 package com.dotmarketing.comparators;
2
3 import java.util.Comparator JavaDoc;
4
5 import com.dotmarketing.beans.WebAsset;
6 import com.dotmarketing.util.Logger;
7
8 /**
9  * @author Maria
10  *
11  * To change this generated comment edit the template variable "typecomment":
12  * Window>Preferences>Java>Templates.
13  * To enable and disable the creation of type comments go to
14  * Window>Preferences>Java>Code Generation.
15  */

16 public class WebAssetSortOrderComparator implements Comparator JavaDoc {
17
18     public int compare(Object JavaDoc o1, Object JavaDoc o2) {
19
20         try {
21             Logger.debug(this, "Sorting assets per Sort Order!");
22                 
23             WebAsset w1 = (WebAsset) o1;
24             
25             WebAsset w2 = (WebAsset) o2;
26
27             return (w1.getSortOrder() == w2.getSortOrder()) ? 0 : (w1.getSortOrder() < w2.getSortOrder()) ? -1 : 1;
28             
29         } catch (ClassCastException JavaDoc e) {
30             
31         }
32         return 0;
33     }
34 }
35
Popular Tags