42 lines
872 B
Java
42 lines
872 B
Java
|
|
package fr.iut_fbleau.Avalam ;
|
||
|
|
|
||
|
|
/**
|
||
|
|
* La classe <code>Tower</code> stocke la couleur de son pion haut et la hauteur de la tour.
|
||
|
|
*
|
||
|
|
* @version 1.0
|
||
|
|
* @author Aurélien
|
||
|
|
* Date : 16-10-25 ; 16-10-25
|
||
|
|
* Licence :
|
||
|
|
*/
|
||
|
|
public class Tower {
|
||
|
|
//Attributs
|
||
|
|
private Color color ;
|
||
|
|
private byte height = 1 ;
|
||
|
|
|
||
|
|
//Constructeur
|
||
|
|
public Tower(Color color) {
|
||
|
|
this.color = color ;
|
||
|
|
}
|
||
|
|
//Méthodes
|
||
|
|
public Color getColor() {
|
||
|
|
return this.color ;
|
||
|
|
}
|
||
|
|
public byte getHeight() {
|
||
|
|
return this.height ;
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Méthode qui empile une autre tour sur l'objet sur lequel le méthode est appelée.
|
||
|
|
* Aucune vérification de hauteur n'est effectuée.
|
||
|
|
*/
|
||
|
|
public void mergeTower(Tower tower) {
|
||
|
|
this.color = tower.getColor();
|
||
|
|
this.height += tower.getHeight();
|
||
|
|
}
|
||
|
|
|
||
|
|
//Affichage
|
||
|
|
public String toString() {
|
||
|
|
return "" ;
|
||
|
|
}
|
||
|
|
}
|