package com.curiam.client;


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

import com.google.gwt.i18n.client.NumberFormat;

public class TestData {


  public static List<Stock> getStocks(String clasif, ResultBeanTPB rb) {
    List<Stock> stocks = new ArrayList<Stock>();

    String leg = new String("");
	
	for(int i=0;i<rb.getProbabilities().size();i++){
		if(i!=rb.getProbabilities().size()-1)
			leg = leg + rb.getLegends().get(i) + " vs. ";
		else
			leg = leg + rb.getLegends().get(i);
	}
	
	
	
	Double max=0.0;
	String inf="";
	for(int i=0;i<rb.getProbabilities().size();i++){
		if(max<rb.getProbabilities().get(i)){
			max=rb.getProbabilities().get(i);
			inf=rb.getLegends().get(i);
		}
	}
    
	final NumberFormat number = NumberFormat.getFormat("0.00");  
    
    stocks.add(new Stock("Classifier Name:", clasif));
    stocks.add(new Stock("Question:", leg));
    stocks.add(new Stock("Learning algorithm:", "KNN"));
    stocks.add(new Stock("Version:", "001"));
    stocks.add(new Stock("Developer Centre:", "ITACA"));
    stocks.add(new Stock("Result Class:",inf + ": " + number.format(max*100)+ "%"));
  
    return stocks;

  }
}