47 lines
1005 B
Java
47 lines
1005 B
Java
/*
|
|
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
|
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
|
|
*/
|
|
package com.mycompany.bibliotheque.Metier;
|
|
|
|
/**
|
|
*
|
|
* @author dthev
|
|
*/
|
|
|
|
import java.util.ArrayList;
|
|
import java.util.List;
|
|
|
|
public class Utilisateur {
|
|
private final String nom;
|
|
private final ArrayList<Livre> emprunts;
|
|
|
|
public Utilisateur(String nom, ArrayList<Livre> mesLivres) {
|
|
this.nom = nom;
|
|
this.emprunts = new ArrayList<>();
|
|
}
|
|
|
|
public String getNom() {
|
|
return nom;
|
|
}
|
|
|
|
public List<Livre> getEmprunts() {
|
|
return emprunts;
|
|
}
|
|
|
|
|
|
// TODO: ajouter un emprunt si l'utilisateur a moins de 3 livres
|
|
/**
|
|
* @author Medhi
|
|
* @param livre
|
|
*/
|
|
public boolean emprunterLivre(Livre livre) {
|
|
if (emprunts.size() < 3) {
|
|
emprunts.add(livre);
|
|
return true;
|
|
} else {
|
|
return false;
|
|
}
|
|
}
|
|
}
|