29 lines
778 B
Java
29 lines
778 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.Métier;
|
|
|
|
import com.mycompany.bibliotheque.Métier.Utilisateur;
|
|
import com.mycompany.bibliotheque.Métier.Livre;
|
|
|
|
/**
|
|
*
|
|
* @author dthev
|
|
*/
|
|
|
|
public class Emprunt {
|
|
|
|
// TODO: logique métier d'emprunt
|
|
public static boolean effectuerEmprunt(Utilisateur u, Livre l) {
|
|
if (l.isEmprunte()) {
|
|
return false; // déjà emprunté
|
|
}
|
|
if (u.getEmprunts().size() >= 3) {
|
|
return false; // trop de livres empruntés
|
|
}
|
|
l.setEmprunte(true);
|
|
return u.emprunterLivre(l);
|
|
}
|
|
}
|