/* $Id: SearchResultSet.java 125 2011-03-09 09:49:51Z ohura $ */
package smart_gs.image_search.research;

import java.util.ArrayList;
import java.util.List;

import smart_gs.image_search.logical.SearchResult;
import smart_gs.logical.Spread;

public class SearchResultSet {
	
	private List<SearchResult> results;
	private double score;
	public SearchResultSet(){
		this.results = new ArrayList<SearchResult>();
	}
	
//	public SearchResultSet(SearchResult res1,SearchResult res2) {
//		this();
//		this.results.add(res1);
//		this.results.add(res2);
//	}
//	public SearchResultSet(SearchResultSet set,SearchResult res){
//		
//	}
	public List<SearchResult> getResults(){
		return results;
	}
	public void addResult(SearchResult result){
		this.results.add(result);
		this.calculateScore();
	}
	private void calculateScore(){
		if(this.results.size() == 0){
			return;
		}
		this.score = this.results.get(0).getScore();
		for(int i=1;i<this.results.size();i++){
			this.score *= this.results.get(i).getScore();
		}
	}
	public double getScore(){
		return this.score;
	}
	public Spread getSpread(){
		return this.results.get(0).getSpread();
	}
}
