Cambios menores

parent 1ef5f661
......@@ -27,7 +27,7 @@ public class UjapackApplication {
public static void main(String[] args){
SpringApplication.run(UjapackApplication.class, args);
HashMap<Integer,PuntodeControl> puntosdecontrol= new HashMap<>();
/* HashMap<Integer,PuntodeControl> puntosdecontrol= new HashMap<>();
int idPr=11; //Id para las provincias, se usa para darle un identificador a cada una de las oficinas.
String fichero="";
try(BufferedReader br=new BufferedReader(new FileReader("redujapackPr.json"))){
......@@ -72,10 +72,10 @@ public class UjapackApplication {
PuntodeControl pc=new PuntodeControl(nombre, localizacion,CentroLogistico,nombre);
pc.setConexiones(conexiones);
pc.setProvincias(provincias);
puntosdecontrol.put(id,pc); /**Aqui es id y no idPr porque aqui se añaden especificamente los centros logisticos, no oficinas
por lo que se toma dicho id. */
puntosdecontrol.put(id,pc); //Aqui es id y no idPr porque aqui se añaden especificamente los centros logisticos, no oficinas
// por lo que se toma dicho id.
}
}*/
ServicioUjaPackImpl servi = new ServicioUjaPackImpl();
......
......@@ -80,8 +80,8 @@ public class Envio {
break;
}
}
}else{
for(int i=1; i<cl.size(); i++){
}else if(!(e.direccionDestino.equals(e.direccionOrigen)) && cl.get(e.direccionDestino).getCentro()==cl.get(e.direccionOrigen).getCentro()){ //MODIFICAR hay que buscarlo con el id
for(int i=1; i<cl.size(); i++){
if(cl.get(i).getProvincia().equals(e.getDireccionOrigen()) && a == false){
listadoPuntos.add(cl.get(i));
a=true;
......@@ -97,8 +97,9 @@ public class Envio {
listadoPuntos.add(cl.get(i));
b=true;
}
}
}
}
return listadoPuntos;
}
......
......@@ -13,7 +13,7 @@ import java.util.ArrayList;
public class PuntodeControl {
private String nombre,provincia,centro; //Provincia es la localización donde está
private String nombre,provincia,centro;
private int id;
private TipoPunto tipo;
private ArrayList<String> provincias;
......
......@@ -5,12 +5,15 @@
*/
package es.ujaen.dae.Ujapack.entidades;
import es.ujaen.dae.beans.ServicioUjaPackImpl;
import es.ujaen.dae.entidades.Envio;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.Assertions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import java.util.ArrayList;
import es.ujaen.dae.entidades.PuntodeControl;
import java.util.HashMap;
/**
*
......@@ -26,6 +29,24 @@ public class EnvioTest {
Assertions.assertNotNull(e.calcularImporte(e));
}
@Test
public void testCalcularRuta(){
ServicioUjaPackImpl servicio = new ServicioUjaPackImpl();
Envio e=servicio.crearEnvio("Jose","Maria","Castellon","Islas Baleares",0.5f,20.4f,20.4f,20.4f);
//Envio e = new Envio("Jose","Maria","Castellon","Islas Baleares",0.5f,20.4f,20.4f,20.4f);
HashMap<Integer,PuntodeControl> puntosdecontrol= new HashMap<>();
ArrayList<PuntodeControl> j = new ArrayList<>();
j = e.calcularRuta(puntosdecontrol,e);
System.out.println(j.size());
/**
for(int i=0; i<j.size(); i++){
System.out.println(j.get(i));
}
float v = 0;
v = e.calcularImporte(e);
System.out.println(v);*/
Assertions.assertNotNull(j);
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment