Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
DAE-Ujapack
/
Ujapack
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
9f67a165
authored
Nov 05, 2020
by
Rafael Ortega Chica
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Cambios menores
parent
1ef5f661
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
32 additions
and
10 deletions
src/main/java/es/ujaen/dae/Ujapack/UjapackApplication.java
src/main/java/es/ujaen/dae/entidades/Envio.java
src/main/java/es/ujaen/dae/entidades/PuntodeControl.java
src/test/java/es/ujaen/dae/Ujapack/entidades/EnvioTest.java
src/main/java/es/ujaen/dae/Ujapack/UjapackApplication.java
View file @
9f67a165
...
...
@@ -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
();
...
...
src/main/java/es/ujaen/dae/entidades/Envio.java
View file @
9f67a165
...
...
@@ -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
;
}
...
...
src/main/java/es/ujaen/dae/entidades/PuntodeControl.java
View file @
9f67a165
...
...
@@ -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
;
...
...
src/test/java/es/ujaen/dae/Ujapack/entidades/EnvioTest.java
View file @
9f67a165
...
...
@@ -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
);
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment