View Javadoc

1   package org.catacomb.act;
2   
3   import java.util.Comparator;
4   
5   public class SignatureComparator implements Comparator<BlockSignature> {
6   
7   
8   
9       public SignatureComparator() {
10  
11      }
12  
13      public int compare(BlockSignature fs1, BlockSignature fs2) {
14  
15          int ret = 0;
16          if (fs1.getTypeCode() < fs2.getTypeCode()) {
17              ret = -1;
18  
19          } else if (fs1.getTypeCode() > fs2.getTypeCode()) {
20              ret = 1;
21  
22          } else {
23  
24              ret = fs1.getName().compareToIgnoreCase(fs2.getName());
25          }
26          return ret;
27      }
28  
29  }