1 package jp.sourceforge.stigmata;
8 * This class represents comparing two birthmarks.
9 * @author Haruaki TAMADA
10 * @version $Revision$ $Date$
12 public class ComparisonPairElement{
13 private Birthmark birthmark1;
14 private Birthmark birthmark2;
15 private BirthmarkComparator comparator;
16 private double similarity;
17 private int compareCount = -1;
19 public ComparisonPairElement(Birthmark birthmark1, Birthmark birthmark2,
20 BirthmarkComparator comparator){
21 this.birthmark1 = birthmark1;
22 this.birthmark2 = birthmark2;
23 this.comparator = comparator;
25 if(!birthmark1.getType().equals(birthmark2.getType())){
26 throw new IllegalArgumentException("birthmark type mismatch");
29 similarity = comparator.compare(birthmark1, birthmark2);
32 public synchronized int getComparisonCount(){
35 compareCount = comparator.getCompareCount(birthmark1, birthmark2);
41 * returns a type of birthmarks.
43 public String getType(){
44 return birthmark1.getType();
48 * returns similarity between two birthmarks.
50 public double getSimilarity(){