package com.curiam.client.datos;


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

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

//clase que muestra todas las filas

public class TestData {


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

    String leg = new String("");
    ArrayList<String> aux = new ArrayList<String>();
    
    int cont = rb.getProbabilities().size();
    if(rb.getLegends().size()==3 && rb.getLegends().get(2).equals("nulo"))
    	cont = 2;
    
    for(int i=0;i<cont-1;i++)
		leg += rb.getLegends().get(i) + " vs. ";
		
	leg += rb.getLegends().get(cont-1);	
	
	
	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("Nombre de clasificador:", rb.getClasificador()));
    stocks.add(new Stock("Questi&oacute;n:", leg));
    stocks.add(new Stock("Algoritmo de aprendizaje:", "KNN"));
    stocks.add(new Stock("Versi&oacute;n:", "001"));
    stocks.add(new Stock("Centro de desarrollo:", "ITACA"));
    stocks.add(new Stock("Resultado:",inf + ": " + number.format(max*100)+ "%"));
  
    return stocks;

  }
}