
public class Cellule {
	private Animal contenu;
	private Cellule suivant;

	public Cellule(String reg) {
		this.contenu = new Animal(reg);
		this.suivant = null;
	}

	public Cellule(String reg, Cellule c) {
		this.contenu = new Animal(reg);
		this.suivant = c;
	}

	public int taille() {
		Cellule temp = this;
		int n = 0;
		while(temp != null) {
			n++;
			temp = temp.suivant;
		}
		return n;
	}

	public int tailleS(int i) {
		if(this.suivant == null) {
			return i;
		}
		else {
			i++;
			return this.suivant.tailleS(i);
		}
	}

	public void inverser() {
		Cellule temp = this;
		while(temp != null) {
			temp.contenu.inverser();
			temp = temp.suivant;
		}
	}

	public void afficher() {
		Cellule temp = this;
		while(temp != null) {
			System.out.println(temp.contenu.getRegime());
			temp = temp.suivant;
		}
	}

	public String afficher2() {
		String s = "";
		Cellule temp = this;
		while(temp != null) {
			s = s + temp.contenu.getRegime() + " ";
			temp = temp.suivant;
		}
		return s;
	}

}
