OSDN Git Service

必要のないクラスを削除し,クラスの整理を行った.
[stigmata/stigmata.git] / src / main / java / jp / sourceforge / stigmata / BirthmarkSpiComparator.java
1 package jp.sourceforge.stigmata;
2
3 import java.util.Comparator;
4
5 import jp.sourceforge.stigmata.spi.BirthmarkService;
6
7 /**
8  * @author Haruaki TAMADA
9  */
10 class BirthmarkSpiComparator implements Comparator<BirthmarkService>{
11     /**
12      * default constructor
13      */
14     public BirthmarkSpiComparator(){
15     }
16
17     @Override
18     public int hashCode(){
19         return System.identityHashCode(this);
20     }
21
22     @Override
23     public int compare(BirthmarkService s1, BirthmarkService s2){
24         if(s1.isExperimental() && !s2.isExperimental()){
25             return 1;
26         }
27         else if(!s1.isExperimental() && s2.isExperimental()){
28             return -1;
29         }
30         else{
31             return s1.getType().compareTo(s2.getType());
32         }
33     }
34
35     @Override
36     public boolean equals(Object o){
37         String className = null;
38         if(o != null){
39             className = o.getClass().getName();
40         }
41         return o != null && className.equals(getClass().getName());
42     }
43 }