This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # | |
| # This class represents a sequence of numbers characterized by the three | |
| # parameters from, to, and by. The numbers x in the sequence obey the | |
| # following two constraints: | |
| # | |
| # from <= x <= to | |
| # x = from + n*by, where n is an integer | |
| # | |
| class Sequence | |
| # This is an enumerable class; it defines an each iterator below. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public TablaGeneroTemperamento3(){ | |
| tabla=new Hashtable<String, PorcentajeTemperamento[]>(); | |
| meteGenero(Generos.Accion,0.1878,0.0743,0.0540,0.0202); | |
| meteGenero(Generos.Animacion,0.1266,0.0411,0.1028,0.1012); | |
| meteGenero(Generos.Aventuras,0.2086,0.0583,0.0831,0.0488); | |
| meteGenero(Generos.Comedia,0.0826,0.09,0.1184,0.0707); | |
| meteGenero(Generos.Documental,0.0203,0.1509,0.0717,0.1710); | |
| meteGenero(Generos.Drama,0.0191,0.1520,0.1309,0.099); | |
| meteGenero(Generos.Fantasia,0.12,0.0816,0.0982,0.0668); | |
| meteGenero(Generos.Romantica,0.0348,0.0972,0.1870,0.0636); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public double getPuntuacion(PeliGeneros p){ | |
| double artesano=u.getPorcentajeArtesano(); | |
| double idealista=u.getPorcentajeIdealista(); | |
| double guardian=u.getPorcentajeGuardian(); | |
| double racional=u.getPorcentajeRacional(); | |
| int total=p.getCantidadGeneros(); | |
| double porcentaje=0; | |
| double aux=0; | |
| double acum=0; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| private void iniciaUsuario(Usuario u){ | |
| valorGenero= new Hashtable<Generos, Double>(); | |
| double artesano=u.getPorcentajeArtesano(); | |
| double guardian=u.getPorcentajeGuardian(); | |
| double idealista=u.getPorcentajeIdealista(); | |
| double racional=u.getPorcentajeRacional(); | |
| Generos[] arrGeneros=Generos.values(); | |
| for (int i=0; i<arrGeneros.length; i++){ | |
| double resul=artesano*tabla.getValorTabla(arrGeneros[i], Temperamento.Artesano)+ | |
| guardian*tabla.getValorTabla(arrGeneros[i], Temperamento.Guardian)+ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //Método con todos los géneros | |
| @Override | |
| public double getPuntuacion(PeliGeneros p){ | |
| double punt=1; | |
| Generos[] arrGeneros=Generos.values(); | |
| int numGeneros=arrGeneros.length; | |
| double cantidadGenero=0; | |
| for (int i=0; i<numGeneros; i++){ | |
| cantidadGenero=cantidadGenero+(valorGenero.get(Generos.getGenero(i))); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| PeliGeneros p; | |
| int numGen=p.getCantidadGeneros(); | |
| Generos g; | |
| for (int i=0; i<numGen; i++){ | |
| g=p.getGenero(i); | |
| art=art+p.getCantidadGenero(g)*tabla.getValorTabla(g, Temperamento.Artesano); | |
| ide=ide+p.getCantidadGenero(g)*tabla.getValorTabla(g, Temperamento.Idealista); | |
| gua=gua+p.getCantidadGenero(g)*tabla.getValorTabla(g, Temperamento.Guardian); | |
| rac=rac+p.getCantidadGenero(g)*tabla.getValorTabla(g, Temperamento.Racional); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| private double calculoTT(Usuario u, double art, double ide, double gua, | |
| double rac) { | |
| double puntuacion=0; | |
| puntuacion=puntuacion+Math.abs(u.getPorcentajeArtesano()/100-art); | |
| puntuacion=puntuacion+Math.abs(u.getPorcentajeIdealista()/100-ide); | |
| puntuacion=puntuacion+Math.abs(u.getPorcentajeGuardian()/100-gua); | |
| puntuacion=puntuacion+Math.abs(u.getPorcentajeRacional()/100-rac); | |
| puntuacion=puntuacion/4; | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| min=Double.MAX_VALUE; | |
| max=Double.MIN_VALUE; | |
| private void setMaxMinUser(){ | |
| double artesano=u.getPorcentajeArtesano(); | |
| double idealista=u.getPorcentajeIdealista(); | |
| double guardian=u.getPorcentajeGuardian(); | |
| double racional=u.getPorcentajeRacional(); | |
| double aux=0; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| double[] arrayPunt; // Contendrá los resultados devueltos por el recomendador | |
| // si no hay pelis en esa comunudad, evitamos que falle metiendo valores nulos | |
| if (i==0){ | |
| if ((arrayPunt==null)||(arrayPunt.length<1)){ | |
| arrayPunt = new PeliPuntuacion[1]; | |
| } | |
| arrayPunt[0]=new PeliPuntuacion("nada",0.0); | |
| } | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public RepartoRecomendadores(){ | |
| repartoArtesano= new PesoRecomendadores(0.35,0.31,0.34); | |
| repartoGuardian= new PesoRecomendadores(0.32,0.39,0.29); | |
| repartoIdealista= new PesoRecomendadores(0.36,0.28,0.36); | |
| repartoRacional= new PesoRecomendadores(0.38,0.34,0.28); | |
| } |
OlderNewer