nikelllllllll
This commit is contained in:
parent
207b5ef807
commit
7e7fae17ef
|
|
@ -7,7 +7,7 @@ import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class ListeAvis {
|
public class ListeAvis {
|
||||||
private static List<Avis> listeAvis;
|
private List<Avis> listeAvis;
|
||||||
|
|
||||||
public ListeAvis(String csvPath) {
|
public ListeAvis(String csvPath) {
|
||||||
listeAvis = new ArrayList<>();
|
listeAvis = new ArrayList<>();
|
||||||
|
|
@ -67,7 +67,7 @@ public class ListeAvis {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static List<String> getCommentairesParFilm(int numeroFilm) {
|
public List<String> getCommentairesParFilm(int numeroFilm) {
|
||||||
List<String> commentaires = new ArrayList<>();
|
List<String> commentaires = new ArrayList<>();
|
||||||
|
|
||||||
for (Avis avis : listeAvis) {
|
for (Avis avis : listeAvis) {
|
||||||
|
|
|
||||||
|
|
@ -38,6 +38,8 @@ public class inter extends JFrame {
|
||||||
private JPanel panel;
|
private JPanel panel;
|
||||||
private JButton entreeButton;
|
private JButton entreeButton;
|
||||||
|
|
||||||
|
private ListeAvis listeAvis;
|
||||||
|
|
||||||
// Cache des données
|
// Cache des données
|
||||||
private final Map<Integer, List<String>> commentairesFilms = new HashMap<>();
|
private final Map<Integer, List<String>> commentairesFilms = new HashMap<>();
|
||||||
private final Map<Integer, Integer> notesFilms = new HashMap<>();
|
private final Map<Integer, Integer> notesFilms = new HashMap<>();
|
||||||
|
|
@ -61,6 +63,7 @@ public class inter extends JFrame {
|
||||||
* Create the frame.
|
* Create the frame.
|
||||||
*/
|
*/
|
||||||
public inter() {
|
public inter() {
|
||||||
|
listeAvis = new ListeAvis("C:\\\\Users\\\\Qpelu\\\\Downloads\\\\big.csv\\");
|
||||||
initialiserDictionnaireSentiments();
|
initialiserDictionnaireSentiments();
|
||||||
initialiserInterface();
|
initialiserInterface();
|
||||||
}
|
}
|
||||||
|
|
@ -198,7 +201,7 @@ public class inter extends JFrame {
|
||||||
int totalNotes= 0;
|
int totalNotes= 0;
|
||||||
Dictionnaire dico=new Dictionnaire("C:\\Users\\Qpelu\\Downloads\\dictionnaire.csv");
|
Dictionnaire dico=new Dictionnaire("C:\\Users\\Qpelu\\Downloads\\dictionnaire.csv");
|
||||||
|
|
||||||
totalNotes += Avis.Analyse(ListeAvis.getCommentairesParFilm(filmNumber), dico);
|
totalNotes += Avis.Analyse(listeAvis.getCommentairesParFilm(filmNumber), dico);
|
||||||
System.out.println(totalNotes);
|
System.out.println(totalNotes);
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -233,12 +236,9 @@ public class inter extends JFrame {
|
||||||
JPanel centralPanel = new JPanel();
|
JPanel centralPanel = new JPanel();
|
||||||
centralPanel.setLayout(new GridLayout(1, 2, MARGIN, 0));
|
centralPanel.setLayout(new GridLayout(1, 2, MARGIN, 0));
|
||||||
|
|
||||||
// Initialiser la liste des commentaires si nécessaire
|
|
||||||
if (!commentairesFilms.containsKey(filmNumber)) {
|
|
||||||
commentairesFilms.put(filmNumber, new ArrayList<>());
|
|
||||||
}
|
|
||||||
|
|
||||||
List<String> commentaires = commentairesFilms.get(filmNumber);
|
|
||||||
|
List<String> commentaires = listeAvis.getCommentairesParFilm(filmNumber);
|
||||||
|
|
||||||
// Panel pour la note et les commentaires affichés
|
// Panel pour la note et les commentaires affichés
|
||||||
JPanel notePanel = creerPanelNote(filmNumber, commentaires);
|
JPanel notePanel = creerPanelNote(filmNumber, commentaires);
|
||||||
|
|
@ -392,9 +392,8 @@ public class inter extends JFrame {
|
||||||
*/
|
*/
|
||||||
private void ajouterCommentaire(int filmNumber, String c) {
|
private void ajouterCommentaire(int filmNumber, String c) {
|
||||||
// Récupérer la liste des commentaires
|
// Récupérer la liste des commentaires
|
||||||
ListeAvis lavis = new ListeAvis("C:\\Users\\Qpelu\\Downloads\\big.csv");
|
|
||||||
Dictionnaire dico = new Dictionnaire("C:\\Users\\Qpelu\\Downloads\\dictionnaire.csv");
|
Dictionnaire dico = new Dictionnaire("C:\\Users\\Qpelu\\Downloads\\dictionnaire.csv");
|
||||||
List<String> commentaires = ListeAvis.getCommentairesParFilm(filmNumber);
|
List<String> commentaires = listeAvis.getCommentairesParFilm(filmNumber);
|
||||||
commentaires.add(c);
|
commentaires.add(c);
|
||||||
|
|
||||||
// Calculer la nouvelle note moyenne
|
// Calculer la nouvelle note moyenne
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue