<commit_before>package polytheque.model.pojos;

import java.sql.Date;

import polytheque.model.DAO.AdherentDAO;
/**
 * Classe permettant la r�servation d'un jeu
 * 
 * @author <NAME>
 */
public class Reservation {

	private int idReservation;
	private Date date;
	private Adherent adherent;
	private Jeu jeu;
	private Extension extention;
	private AdherentDAO adherentDAO;

	/**
	 * Constructeur de la classe Reservation
	 * 
	 * @param adherent
	 * @param jeu
	 * @param date
	 */
	public Reservation(Adherent adherent,Jeu jeu, Date date) {
		this.setAdherent(adherent);
		this.setJeu(jeu);
		this.setDate(date);
	}
	
	/**
	 * Constructeur de la classe Reservation
	 * 
	 * @param adherent
	 * @param extention
	 * @param date
	 */
	public Reservation(Adherent adherent,Extension extention, Date date) {
		this.setAdherent(adherent);
		this.setExtension(extention);
		this.setDate(date);
	}
	
	/**
	 * Constructeur de la classe Reservation
	 * 
	 * @param adherent
	 * @param jeu
	 * @param extention
	 * @param date
	 */
	public Reservation(Adherent adherent,Jeu jeu,Extension extention, Date date) {
		this.setAdherent(adherent);
		this.setJeu(jeu);
		this.setExtension(extention);
		this.setDate(date);
	}
	
	/**
	 * Constructeur de la classe Reservation
	 *  
	 * @param idReservation
	 * @param adherent
	 * @param jeu
	 * @param date
	 */
	public Reservation(int id, Adherent adherent,Jeu jeu, Date date) {
		this.setIdReservation(id);
		this.setAdherent(adherent);
		this.setJeu(jeu);
		this.setDate(date);
	}

	/**
	 * Constructeur de la classe Reservation
	 * 
	 * @param idReservation
	 * @param idAdherent
	 * @param date
	 */
	public Reservation(int id, Date date, int idAdherent) {
		this.adherentDAO = new AdherentDAO();
		this.setIdReservation(id);
		this.setDate(date);
		this.setAdherent(adherentDAO.retreive(idAdherent));
	}

	/**
	 * m�thodes
	 * getter et setter qui permettent de r�cup�rer ou modifier les attributs de cette classe dans d'autres classes
	 */
	public Adherent getAdherent() {
		return adherent;
	}

	public void setAdherent(Adherent adherent) {
		this.adherent = adherent;
	}

	public Jeu getJeu() {
		return jeu;
	}

	public int getIdReservation() {
		return idReservation;
	}

	public void setIdReservation(int idReservation) {
		this.idReservation = idReservation;
	}
	
	public void setJeu(Jeu jeu) {
		this.jeu = jeu;
	}
	
	public void setExtension(Extension extention) {
		this.extention=extention;
		
	}
	
	public Extension getExtension() {
		return extention;
		
	}
	
	public Date getDate() {
		return this.date;
	}

	public void setDate(Date date) {
		this.date = date;
	}
	
	/**mthodes
	 * emprunter()
	 * annuler_reservation()
	 * */
	
	public Emprunt validerReservation(){
		Date dateFin = this.date;
		//TODO trouver moyen de fixer la date de fin  3 semaines plus tard (= 21 jours)
		if (this.extention == null){
			this.jeu.setStatus("emprunt");
			this.jeu.setNbReserves(this.jeu.getNbReserves()+1);
			return new Emprunt(this.adherent,this.jeu,this.date,dateFin,null);}
		else{
			if (this.jeu == null){
				this.extention.setStatut("emprunt");
				this.extention.setNbReserves(this.extention.getNbReserves()+1);
				return new Emprunt(this.adherent,this.extention,this.date,dateFin,null);}
			else{
				this.jeu.setStatus("emprunt");
				this.jeu.setNbReserves(this.jeu.getNbReserves()+1);
				this.extention.setNbReserves(this.extention.getNbReserves()+1);
				this.extention.setStatut("emprunt");
				return new Emprunt(this.adherent,this.jeu,this.extention,this.date,dateFin);}
		}
	}

<commit_msg>modification des fonctions de la classe reservation<commit_after>package polytheque.model.pojos;

import java.sql.Date;

import polytheque.model.DAO.AdherentDAO;
/**
 * Classe permettant la r�servation d'un jeu
 * 
 * @author <NAME>
 */
public class Reservation {

	private int idReservation;
	private Date date;
	private Adherent adherent;
	private Jeu jeu;
	private Extension extention;
	private AdherentDAO adherentDAO;

	/**
	 * Constructeur de la classe Reservation
	 * 
	 * @param adherent
	 * @param jeu
	 * @param date
	 */
	public Reservation(Adherent adherent,Jeu jeu, Date date) {
		this.setAdherent(adherent);
		this.setJeu(jeu);
		this.setDate(date);
		this.jeu.setNbReserves(this.jeu.getNbReserves()+1);
		this.jeu.setStatus("rserv");
	}
	
	/**
	 * Constructeur de la classe Reservation
	 * 
	 * @param adherent
	 * @param extention
	 * @param date
	 */
	public Reservation(Adherent adherent,Extension extention, Date date) {
		this.setAdherent(adherent);
		this.setExtension(extention);
		this.setDate(date);
		this.extention.setNbReserves(this.extention.getNbReserves()+1);
		this.extention.setStatut("rserv");
	}
	
	/**
	 * Constructeur de la classe Reservation
	 * 
	 * @param adherent
	 * @param jeu
	 * @param extention
	 * @param date
	 */
	public Reservation(Adherent adherent,Jeu jeu,Extension extention, Date date) {
		this.setAdherent(adherent);
		this.setJeu(jeu);
		this.setExtension(extention);
		this.setDate(date);
		this.jeu.setNbReserves(this.jeu.getNbReserves()+1);
		this.jeu.setStatus("rserv");
		this.extention.setNbReserves(this.extention.getNbReserves()+1);
		this.extention.setStatut("rserv");
	}
	
	/**
	 * Constructeur de la classe Reservation
	 *  
	 * @param idReservation
	 * @param adherent
	 * @param jeu
	 * @param date
	 */
	public Reservation(int id, Adherent adherent,Jeu jeu, Date date) {
		this.setIdReservation(id);
		this.setAdherent(adherent);
		this.setJeu(jeu);
		this.setDate(date);
		this.jeu.setNbReserves(this.jeu.getNbReserves()+1);
		this.jeu.setStatus("rserv");
	}

	/**
	 * Constructeur de la classe Reservation
	 * 
	 * @param idReservation
	 * @param idAdherent
	 * @param date
	 */
	public Reservation(int id, Date date, int idAdherent) {
		this.adherentDAO = new AdherentDAO();
		this.setIdReservation(id);
		this.setDate(date);
		this.setAdherent(adherentDAO.retreive(idAdherent));
	}

	/**
	 * m�thodes
	 * getter et setter qui permettent de r�cup�rer ou modifier les attributs de cette classe dans d'autres classes
	 */
	public Adherent getAdherent() {
		return adherent;
	}

	public void setAdherent(Adherent adherent) {
		this.adherent = adherent;
	}

	public Jeu getJeu() {
		return jeu;
	}

	public int getIdReservation() {
		return idReservation;
	}

	public void setIdReservation(int idReservation) {
		this.idReservation = idReservation;
	}
	
	public void setJeu(Jeu jeu) {
		this.jeu = jeu;
	}
	
	public void setExtension(Extension extention) {
		this.extention=extention;
		
	}
	
	public Extension getExtension() {
		return extention;
		
	}
	
	public Date getDate() {
		return this.date;
	}

	public void setDate(Date date) {
		this.date = date;
	}
	
	/**mthodes
	 * emprunter()
	 * annuler_reservation()
	 * */
	
	public Emprunt validerReservation(){
		Date dateFin = this.date;
		//TODO trouver moyen de fixer la date de fin  3 semaines plus tard (= 21 jours)
		if (this.extention == null){
			this.jeu.setStatus("emprunt");
			this.jeu.setNbReserves(this.jeu.getNbReserves()-1);
			this.jeu.setNbEmpruntes(this.jeu.getNbEmpruntes()+1);
			return new Emprunt(this.adherent,this.jeu,this.date,dateFin,null);}
		else{
			if (this.jeu == null){
				this.extention.setStatut("emprunt");
				this.extention.setNbReserves(this.extention.getNbReserves()-1);
				this.extention.setNbEmpruntes(this.extention.getNbEmpruntes()+1);
				return new Emprunt(this.adherent,this.extention,this.date,dateFin,null);}
			else{
				this.jeu.setStatus("emprunt");
				this.jeu.setNbEmpruntes(this.jeu.getNbEmpruntes()+1);
				this.jeu.setNbReserves(this.jeu.getNbReserves()-1);
				this.extention.setNbReserves(this.extention.getNbReserves()-1);
				this.extention.setNbEmpruntes(this.extention.getNbEmpruntes()+1);
				this.extention.setStatut("emprunt");
				return new Emprunt(this.adherent,this.jeu,this.extention,this.date,dateFin);}
		}
	}


{'fraction_non_alphanumeric': 0.12347405900305188, 'fraction_numerical': 0.0029247202441505596, 'mean_word_length': 4.02234993614304, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '672685', 'n_tokens_mistral': 3161, 'n_tokens_neox': 2838, 'n_words': 558}