OSDN Git Service

オーバーライドしているメソッド全てに @Override アノテーションを追加した.
[stigmata/stigmata.git] / src / main / java / jp / sourceforge / stigmata / BirthmarkSpiComparator.java
1 package jp.sourceforge.stigmata;
2
3 /*
4  * $Id$
5  */
6
7 import java.util.Comparator;
8
9 import jp.sourceforge.stigmata.spi.BirthmarkSpi;
10
11 /**
12  * @author Haruaki TAMADA
13  * @version $Revision$ 
14  */
15 class BirthmarkSpiComparator implements Comparator<BirthmarkSpi>{
16     /**
17      * default constructor
18      */
19     public BirthmarkSpiComparator(){
20     }
21
22     @Override
23     public int hashCode(){
24         return System.identityHashCode(this);
25     }
26
27     @Override
28     public int compare(BirthmarkSpi s1, BirthmarkSpi s2){
29         if(s1.isExperimental() && !s2.isExperimental()){
30             return 1;
31         }
32         else if(!s1.isExperimental() && s2.isExperimental()){
33             return -1;
34         }
35         else{
36             return s1.getType().compareTo(s2.getType());
37         }
38     }
39
40     @Override
41     public boolean equals(Object o){
42         String className = null;
43         if(o != null){
44             className = o.getClass().getName();
45         }
46         return o != null && className.equals(getClass().getName());
47     }
48 }