package dataBase.search.comparator;

import java.util.Comparator;

import dataBase.subPicture.SubPicture;


public class ComperatorSubPic implements Comparator<SubPicture>{

//	private AbstractDistance distanceFkt;
//	private SubPicture searchPic;
//	
//	public ComperatorDistance(AbstractDistance distanceFkt){
//		this.distanceFkt = distanceFkt;
//	}
//	
//	public void setSearchPic(SubPicture searchPic){
//		this.searchPic = searchPic;
//	}
	
	private int threadID;
	
	public ComperatorDistance(int threadID){
		this.threadID = threadID;
	}
	
	@Override
	public int compare(SubPicture p1, SubPicture p2) {
		
		//assert p1.distanceToSearchPic>=0 && p2.distanceToSearchPic>=0;
		
		float val1 = p1.distance_ToSearchPic[threadID];
		float val2 = p2.distance_ToSearchPic[threadID];
		
		if(val1 > val2)
			return 1;
		else if(val1 < val2)
			return -1;
		else
			return 0;
	}
	
}
