Skip to content
Snippets Groups Projects
Commit 4ac631b3 authored by Alfa-J's avatar Alfa-J
Browse files

modificado el main para testeo, el resto andava

parent deaa5298
No related branches found
No related tags found
No related merge requests found
...@@ -5,6 +5,7 @@ import java.sql.Date; ...@@ -5,6 +5,7 @@ import java.sql.Date;
import java.util.ArrayList; import java.util.ArrayList;
public class Comentario { public class Comentario {
private static int contadorComentarios = 1; private static int contadorComentarios = 1;
private int id; private int id;
...@@ -77,7 +78,6 @@ public class Comentario { ...@@ -77,7 +78,6 @@ public class Comentario {
return "Comentario{" + "id=" + id + ", fecha=" + fecha + ", texto=" + texto + ", nivelSubComentario=" + nivelSubComentario + '}'; return "Comentario{" + "id=" + id + ", fecha=" + fecha + ", texto=" + texto + ", nivelSubComentario=" + nivelSubComentario + '}';
} }
public boolean agregarSubComentario(int idComPadre, DtComentario dtC, Usuario usr) { public boolean agregarSubComentario(int idComPadre, DtComentario dtC, Usuario usr) {
if (this.id == idComPadre) { if (this.id == idComPadre) {
Comentario com = new Comentario(Comentario.getNuevoID(), Comentario com = new Comentario(Comentario.getNuevoID(),
...@@ -87,8 +87,7 @@ public class Comentario { ...@@ -87,8 +87,7 @@ public class Comentario {
usr); usr);
this.misComentario.add(com); this.misComentario.add(com);
return true; return true;
} } else {
else{
for (int i = 0; i < misComentario.size(); i++) { for (int i = 0; i < misComentario.size(); i++) {
if (this.misComentario.get(i).agregarSubComentario(idComPadre, dtC, usr)) { if (this.misComentario.get(i).agregarSubComentario(idComPadre, dtC, usr)) {
......
...@@ -9,32 +9,28 @@ import java.util.ArrayList; ...@@ -9,32 +9,28 @@ import java.util.ArrayList;
public class main { public class main {
public static void main(String[] args) { public static void main(String[] args) {
System.out.println("Hola mundo"); System.out.println("Hola mundo");
/*Usuario u1 = new Usuario("nicku1", "email1", new Date(2019-1900,7,15), "c/imagenes/algo1.jpg", "1234", "carlos1", "perez1", null); Usuario u1 = new Usuario("nicku1", "email1", new Date(2019-1900,7,15), "c/imagenes/algo1.jpg", "1234", "carlos1", "perez1", null);
Usuario u2 = new Usuario("nicku2", "email2", new Date(2019-1900,7,15), "c/imagenes/algo2.jpg", "1234", "carlos2", "perez2", null); Usuario u2 = new Usuario("nicku2", "email2", new Date(2019-1900,7,15), "c/imagenes/algo2.jpg", "1234", "carlos2", "perez2", null);
Usuario u3 = new Usuario("nicku3", "email3", new Date(2019-1900,7,15), "c/imagenes/algo3.jpg", "1234", "carlos3", "perez3", null); Usuario u3 = new Usuario("nicku3", "email3", new Date(2019-1900,7,15), "c/imagenes/algo3.jpg", "1234", "carlos3", "perez3", null);
Usuario u4 = new Usuario("nicku4", "email4", new Date(2019-1900,7,15), "c/imagenes/algo4.jpg", "1234", "carlos4", "perez4", null); Usuario u4 = new Usuario("nicku4", "email4", new Date(2019-1900,7,15), "c/imagenes/algo4.jpg", "1234", "carlos4", "perez4", null);
Usuario u5 = new Usuario("nicku5", "email5", new Date(2019-1900,7,15), "c/imagenes/algo5.jpg", "1234", "carlos5", "perez5", null); Usuario u5 = new Usuario("nicku5", "email5", new Date(2019-1900,7,15), "c/imagenes/algo5.jpg", "1234", "carlos5", "perez5", null);
Comentario c1 = new Comentario(Comentario.getNuevoID(), new Date(2019-1900,7,15), "1: exelente video", 0, u1); Comentario c1 = new Comentario(Comentario.getNuevoID(), new Date(2019-1900,7,15), "1", 0, u1);
c1.agregarSubComentario(c1.getId(), new DtComentario(1, null,new Date(2019-1900,7,15), "sub_1_1: mas o menos", 1), u2); c1.agregarSubComentario(c1.getId(), new DtComentario(1, null,new Date(2019-1900,7,15), "1.2", 1), u2);
c1.agregarSubComentario(c1.getId(), new DtComentario(1, null,new Date(2019-1900,7,15), "sub_1_2: mas o menos", 1), u3); c1.agregarSubComentario(c1.getId(), new DtComentario(1, null,new Date(2019-1900,7,15), "1.3", 1), u3);
c1.agregarSubComentario(c1.getId(), new DtComentario(1, null,new Date(2019-1900,7,15), "sub_1_3: mas o menos", 1), u4); c1.agregarSubComentario(c1.getId(), new DtComentario(1, null,new Date(2019-1900,7,15), "1.4", 1), u4);
c1.agregarSubComentario(c1.getId(), new DtComentario(1, null,new Date(2019-1900,7,15), "sub_1_sub_1_1: mas o menos", 2), u3); c1.agregarSubComentario(4, new DtComentario(1, null,new Date(2019-1900,7,15), "1.4.5", 2), u3);
c1.agregarSubComentario(2, new DtComentario(1, null,new Date(2019-1900,7,15), "1.2.6", 2), u3);
c1.agregarSubComentario(6, new DtComentario(1, null,new Date(2019-1900,7,15), "1.2.6.7", 2), u3);
c1.agregarSubComentario(4, new DtComentario(1, null,new Date(2019-1900,7,15), "1.4.8", 2), u3);
c1.agregarSubComentario(5, new DtComentario(1, null,new Date(2019-1900,7,15), "1.4.5.9", 2), u3);
ArrayList l = c1.listarSubComentarios(); ArrayList l = c1.listarSubComentarios();
for(int i=0;i<l.size();i++){ for(int i=0;i<l.size();i++){
System.out.println(l.get(i).toString()); System.out.println(l.get(i).toString());
}*/
ArrayList<Integer> l = new ArrayList();
l.add(2);
l.add(8);
l.add(15);
l.add(22);
l.add(7);
for(int i=0;i<l.size();i++){
System.out.println(l.get(i));
} }
} }
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment