KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > mmbase > applications > media > filters > PreferenceSorter


1  /*
2  
3 This software is OSI Certified Open Source Software.
4 OSI Certified is a certification mark of the Open Source Initiative.
5  
6 The license (Mozilla version 1.0) can be read at the MMBase site.
7 See http://www.MMBase.org/license
8  
9  */

10
11 package org.mmbase.applications.media.filters;
12
13 import org.mmbase.applications.media.urlcomposers.URLComposer;
14
15 /**
16  * Facilitates implementing Sorter by defining the 'preference' of one
17  * object. A preference is just an int. The higher, the better. Only
18  * for ease of implementation of descendants.
19  *
20  * @author Michiel Meeuwissen
21  */

22 abstract public class PreferenceSorter extends Sorter {
23     /**
24      * Implement a preference for this URLComposer
25      */

26
27     abstract protected int getPreference(URLComposer o);
28     
29     
30     final protected int compareURLComposer(URLComposer o1, URLComposer o2) {
31         return getPreference(o2) - getPreference(o1);
32     }
33
34 }
35
36
Popular Tags