Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
B
BootcampWebDia5
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Cesar Giulano Gonzalez Maqueda
BootcampWebDia5
Commits
3256fd1f
Commit
3256fd1f
authored
Oct 25, 2021
by
Cesar Giulano Gonzalez Maqueda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Ver Likes y RTs propios
parent
ed839fa5
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
37 additions
and
2 deletions
+37
-2
twitter/src/twitter/BaseDeDatos.java
+5
-0
twitter/src/twitter/Reaccion.java
+18
-0
twitter/src/twitter/TestTwitter.java
+8
-0
twitter/src/twitter/Tweet.java
+6
-2
No files found.
twitter/src/twitter/BaseDeDatos.java
View file @
3256fd1f
...
...
@@ -5,6 +5,7 @@ import java.util.ArrayList;
public
class
BaseDeDatos
{
private
static
final
ArrayList
<
Usuario
>
usuarios
=
new
ArrayList
<
Usuario
>();
private
static
final
ArrayList
<
Tweet
>
tweets
=
new
ArrayList
<
Tweet
>();
private
static
final
ArrayList
<
Reaccion
>
reacciones
=
new
ArrayList
<
Reaccion
>();
public
static
void
addUsuario
(
Usuario
usuario
){
/*
...
...
@@ -50,4 +51,8 @@ public class BaseDeDatos {
public
static
Tweet
getTweetById
(
int
id
){
return
tweets
.
get
(
id
);
}
public
static
void
addReaccion
(
Reaccion
reaccion
){
reacciones
.
add
(
reaccion
);
}
public
static
ArrayList
<
Reaccion
>
getReacciones
(){
return
reacciones
;
}
}
twitter/src/twitter/Reaccion.java
View file @
3256fd1f
...
...
@@ -22,4 +22,22 @@ public class Reaccion {
public
String
getTipoDeReaccion
()
{
return
tipoDeReaccion
;
}
public
static
void
verReaccionUsuario
(
Usuario
usuario
,
String
tipoDeReaccion
){
System
.
out
.
print
(
"\nTweets likeados por usuario: "
+
usuario
.
getNombreUsuario
());
for
(
Reaccion
reaccion:
BaseDeDatos
.
getReacciones
()){
if
(
reaccion
.
getTipoDeReaccion
().
equals
(
tipoDeReaccion
)
&&
reaccion
.
getUsuario
()==
usuario
){
System
.
out
.
print
(
"\n---------------------"
);
System
.
out
.
print
(
"\n\tAutor: "
+
reaccion
.
getTweet
().
getUsuario
().
getNombreUsuario
()+
"\n\tTexto: "
+
reaccion
.
getTweet
().
getText
());
System
.
out
.
print
(
"\n\tLikes: "
+
reaccion
.
getTweet
().
getNumeroFav
()+
"\tRts: "
+
reaccion
.
getTweet
().
getNumeroRt
());
if
(
reaccion
.
getTweet
().
getImageUrl
()!=
null
){
System
.
out
.
print
(
"\n\tImage: "
+
reaccion
.
getTweet
().
getImageUrl
());
}
if
(
reaccion
.
getTweet
().
getLinkUrl
()!=
null
){
System
.
out
.
print
(
"\n\tLink: "
+
reaccion
.
getTweet
().
getLinkUrl
());
}
}
}
}
}
twitter/src/twitter/TestTwitter.java
View file @
3256fd1f
...
...
@@ -48,6 +48,8 @@ public class TestTwitter {
"2 - Twittear\n"
+
"3 - Seguimiento\n"
+
"4 - Bloqueados\n"
+
"5 - Ver Mis Likes\n"
+
"6 - Ver mis RTs\n"
+
"0 - Cerrar Sesion\n"
+
"Entrada: "
);
int
choice3
=
0
;
...
...
@@ -138,6 +140,12 @@ public class TestTwitter {
System
.
out
.
print
(
"\nBloqueados: "
);
loggedUser
.
seguimiento
.
printBloqueados
();
break
;
case
5
:
Reaccion
.
verReaccionUsuario
(
loggedUser
,
"LIKE"
);
break
;
case
6
:
Reaccion
.
verReaccionUsuario
(
loggedUser
,
"RT"
);
break
;
case
0
:
System
.
out
.
println
(
"Saliendo..."
);
loggedUser
=
null
;
...
...
twitter/src/twitter/Tweet.java
View file @
3256fd1f
...
...
@@ -36,7 +36,9 @@ public class Tweet {
return
;
}
}
this
.
reacciones
.
add
(
new
Reaccion
(
usuario
,
this
,
"LIKE"
));
Reaccion
newReaccion
=
new
Reaccion
(
usuario
,
this
,
"LIKE"
);
this
.
reacciones
.
add
(
newReaccion
);
BaseDeDatos
.
addReaccion
(
newReaccion
);
this
.
numeroFav
++;
}
...
...
@@ -51,7 +53,9 @@ public class Tweet {
return
;
}
}
this
.
reacciones
.
add
(
new
Reaccion
(
usuario
,
this
,
"RT"
));
Reaccion
newReaccion
=
new
Reaccion
(
usuario
,
this
,
"RT"
);
this
.
reacciones
.
add
(
newReaccion
);
BaseDeDatos
.
addReaccion
(
newReaccion
);
this
.
numeroRt
++;
}
...
...
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