JSON acabado

parent dceba239
...@@ -71,7 +71,7 @@ public class UjapackApplication { ...@@ -71,7 +71,7 @@ public class UjapackApplication {
PuntodeControl pc=new PuntodeControl(nombre, localizacion,CentroLogistico); PuntodeControl pc=new PuntodeControl(nombre, localizacion,CentroLogistico);
pc.setConexiones(conexiones); pc.setConexiones(conexiones);
pc.setProvincias(provincias); pc.setProvincias(provincias);
puntosdecontrol.add(id,pc); /**Aqui es id y no idPr porque aqui se añaden especificamente los centros logisticos, no oficinas 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. */ por lo que se toma dicho id. */
//System.out.println(pc.toString()); //System.out.println(pc.toString());
} }
......
...@@ -7,6 +7,7 @@ package es.ujaen.dae.entidades; ...@@ -7,6 +7,7 @@ package es.ujaen.dae.entidades;
import java.time.LocalDate; import java.time.LocalDate;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap;
import es.ujaen.dae.Ujapack.UjapackApplication; import es.ujaen.dae.Ujapack.UjapackApplication;
/** /**
...@@ -50,9 +51,9 @@ public class Envio { ...@@ -50,9 +51,9 @@ public class Envio {
//Hecho solamente el caso donde envias y recibes dentro de la misma provincia //Hecho solamente el caso donde envias y recibes dentro de la misma provincia
public ArrayList<PuntodeControl> calcularRuta(ArrayList<PuntodeControl> cl, Envio e){ public ArrayList<PuntodeControl> calcularRuta(HashMap<Integer,PuntodeControl> cl, Envio e){
if(e.getDireccionOrigen().equals(e.getDireccionDestino())){ if(e.getDireccionOrigen().equals(e.getDireccionDestino())){
for(int i=0; i<cl.size(); i++){ for(int i=1; i<cl.size(); i++){
if(cl.get(i).getProvincia().equals(e.getDireccionDestino())){ if(cl.get(i).getProvincia().equals(e.getDireccionDestino())){
listadoPuntos.add(cl.get(i)); listadoPuntos.add(cl.get(i));
break; break;
......
...@@ -21,13 +21,13 @@ public class PuntodeControl { ...@@ -21,13 +21,13 @@ public class PuntodeControl {
public PuntodeControl(String nombre, String provincia, int id, TipoPunto t, ArrayList<String> provincias, ArrayList<Integer> conexiones){ //AÑADIR EL ENUM AL CONSTRUCTOR DEL PUNTO DE CONTROL public PuntodeControl(String nombre, String provincia, TipoPunto t){ //AÑADIR EL ENUM AL CONSTRUCTOR DEL PUNTO DE CONTROL
this.id = id; this.id = id;
this.nombre=nombre; this.nombre=nombre;
this.provincia=provincia; this.provincia=provincia;
tipo = t; tipo = t;
this.conexiones = conexiones; this.conexiones = new ArrayList<>();
this.provincias = provincias; this.provincias = new ArrayList<>();
}; };
......
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