1 package jp.sourceforge.stigmata;
4 * This class represents comparing two birthmarks.
5 * @author Haruaki TAMADA
7 public class ComparisonPairElement{
8 private Birthmark birthmark1;
9 private Birthmark birthmark2;
10 private BirthmarkComparator comparator;
11 private double similarity;
12 private int compareCount = -1;
14 public ComparisonPairElement(Birthmark birthmark1, Birthmark birthmark2,
15 BirthmarkComparator comparator, BirthmarkContext context){
16 this.birthmark1 = birthmark1;
17 this.birthmark2 = birthmark2;
18 this.comparator = comparator;
20 if(!birthmark1.getType().equals(birthmark2.getType())){
21 throw new IllegalArgumentException("birthmark type mismatch");
24 similarity = comparator.compare(birthmark1, birthmark2, context);
27 public synchronized int getComparisonCount(){
30 compareCount = comparator.getCompareCount(birthmark1, birthmark2);
36 * returns a type of birthmarks.
38 public String getType(){
39 return birthmark1.getType();
43 * returns similarity between two birthmarks.
45 public double getSimilarity(){