Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- *
- */
- package iut.acy.cut4u.model;
- import java.util.ArrayList;
- import java.util.GregorianCalendar;
- /**
- * @author cazajeug
- *
- */
- /**
- * @author cazajeug
- *
- */
- public class Employe extends Personne {
- private StatutEmploye statut;
- private CategorieEmploye categorie;
- private ArrayList<Conge> conges;
- private ArrayList<Integer> demiJoursRepos;
- public boolean estEnRepos(int demiJour) throws IllegalArgumentException {
- // TO DO
- // le paramètre passé doit être compris entre 1 et 14
- // veuillez vous assurer d'avoir le tag nécessaire pour que l'exception
- // soit
- // mentionnée au sein de la javadoc
- if (demiJour > 14 || demiJour < 0) {
- throw new IllegalArgumentException(
- "Impossible que ce soit inférieur à 0 ou supérieur à 14");
- }
- return (this.demiJoursRepos.contains(demiJour));
- }
- public boolean estEnConge(GregorianCalendar jour) {
- if (jour == null)
- throw new IllegalArgumentException("Allo, le jour n'existe pas !");
- for (Conge c : conges) {
- if (c.getDateDebut().compareTo(jour) <= 0
- && jour.compareTo(c.getDateFin()) <= 0)
- return true;
- }
- return false;
- }
- /**
- * @param id
- * @param sexe
- * @param nom
- * @param prenom
- * @param statut
- * @param categorie
- * @param adresse
- * @param codePostal
- * @param ville
- * @param tel
- * @param conges
- * @param demiJoursRepos
- */
- public Employe(int id, Sexe sexe, String nom, String prenom,
- StatutEmploye statut, CategorieEmploye categorie, String adresse,
- String codePostal, String ville, String tel,
- ArrayList<Conge> conges, ArrayList<Integer> demiJoursRepos) {
- super(id, sexe, nom, prenom, adresse, codePostal, ville, tel);
- this.setStatut(statut);
- this.setCategorie(categorie);
- this.setConges(conges);
- this.setDemiJoursRepos(demiJoursRepos);
- }
- /**
- * @param sexe
- * @param nom
- * @param prenom
- * @param statut
- * @param categorie
- */
- public Employe(Sexe sexe, String nom, String prenom, StatutEmploye statut,
- CategorieEmploye categorie) {
- this(0, sexe, nom, prenom, statut, categorie, "", "", "", "",
- new ArrayList<Conge>(), new ArrayList<Integer>());
- }
- /**
- * @return
- */
- public ArrayList<Integer> getDemiJoursRepos() {
- return demiJoursRepos;
- }
- /**
- * @param joursRepos
- */
- public void setDemiJoursRepos(ArrayList<Integer> joursRepos) {
- if (joursRepos != null)
- this.demiJoursRepos = joursRepos;
- else
- this.demiJoursRepos = new ArrayList<Integer>();
- }
- /**
- * ajoute le congé passé en paramètre
- *
- * @return true si l'ajout s'est bien effectué sinon false
- */
- public boolean ajouteConge(Conge c) {
- if (this.conges.add(c))
- return true;
- else
- return false;
- }
- /**
- * ajoute le demi-jour de repos passé en paramètre
- *
- * @return true si l'ajout s'est bien effectué sinon false
- */
- public boolean ajouteDemiJourRepos(int demiJournee) {
- if (this.demiJoursRepos.contains(demiJournee))
- return false;
- this.demiJoursRepos.add(demiJournee);
- return true;
- }
- /**
- * @param args
- */
- public static void main(String[] args) {
- }
- /**
- * renvoie le statut de l'employé
- *
- * @return the statut
- */
- public StatutEmploye getStatut() {
- return statut;
- }
- /**
- * met à jour le statut de l'employé
- *
- * @param statut
- * the statut to set
- */
- public void setStatut(StatutEmploye statut) {
- this.statut = statut;
- }
- /**
- * @return the categorie
- */
- public CategorieEmploye getCategorie() {
- return categorie;
- }
- /**
- * @param categorie
- * the categorie to set
- */
- public void setCategorie(CategorieEmploye categorie) {
- this.categorie = categorie;
- }
- /**
- * @return the conges
- */
- public ArrayList<Conge> getConges() {
- return conges;
- }
- /**
- * @param conges
- * the conges to set
- */
- public void setConges(ArrayList<Conge> conges) {
- if (conges != null)
- this.conges = conges;
- else
- this.conges = new ArrayList<Conge>();
- }
- }
Add Comment
Please, Sign In to add comment