
public class Entreprise {
	private String nom;
	private Cellule premier;

	public Entreprise(String n) {
		this.nom = n;
		this.premier = null;
	}

	public boolean appartient(String n) {
		if(this.premier == null) {
			return false;
		}
		return this.premier.appartient(n);
	}

	public void ajout(Employe emp) {
		if(!this.appartient(emp.getNom())) {
			this.premier = new Cellule(emp, this.premier);
		}
	}

	public void affiche() {
		if(this.premier != null) {
			this.premier.affiche();
		}
	}

	public void demission(String n) {
		if(this.premier!=null) {
			if(this.premier.getEmploye().getNom().equals(n)) {
				this.premier = this.premier.getSuivant();
			}
			this.premier.demission(n);
		}
	}

	public boolean augmente(String nom, int montant) {
		if(montant <= 0) {
			return false;
		}
		return this.premier.augmente(nom, montant);
	}

	public Entreprise choixSalaireRecursive(int min, int max) {
		Entreprise x = new Entreprise("Samy") ; 
		return premier.choixSalaireRecursive(min, max, x); 
	}

	public Entreprise choixSalaireInterative(int min, int max) {
		Entreprise x = new Entreprise(this.nom);
		if(this.premier == null) {
			return x;
		}
		Cellule temp = this.premier;
		while(temp != null) {
			if(temp.getEmploye().getSalaire() >= min &&  temp.getEmploye().getSalaire() <= max) {
				x.ajout(temp.getEmploye());
			}
			temp = temp.getSuivant();
		}
		return x;
	}

	public boolean croissante() {
		if(this.premier == null) {
			return true;
		}
		return this.premier.croissante();
	}
}
