Ajout des cellules et du plateau

master
Allan POINT 4 years ago
parent d1e139d1fa
commit 6026d905b0

@ -0,0 +1,42 @@
package model;
import javafx.beans.property.BooleanProperty;
import javafx.beans.property.ReadOnlyBooleanProperty;
public class Cellule {
private int x;
private int y;
private BooleanProperty vivante;
public Cellule(int x, int y) throws IllegalArgumentException{
if(x < 0 && y < 0){
throw new IllegalArgumentException("Les coordonées doivent être positives");
}
this.x = x;
this.y = y;
}
public Boolean estVivante(){ return vivante.get();}
public void setVivante(Boolean vivante){ this.vivante.set(vivante);}
public ReadOnlyBooleanProperty vivanteProperty(){return vivante;}
public int getX(){
return x;
}
public void setX(int valeur) throws IllegalArgumentException{
if(valeur<0){
throw new IllegalArgumentException("La valeur de X doit être positive");
}
x = valeur;
}
public int getY(){
return y;
}
public void setY(int valeur) throws IllegalArgumentException{
if(valeur<0){
throw new IllegalArgumentException("La valeure de Y doit être positive");
}
y = valeur;
}
}

@ -0,0 +1,22 @@
package model;
import javafx.beans.property.*;
import java.util.List;
public class Plateau {
private IntegerProperty longueure = new SimpleIntegerProperty();
public int getLongueure() {return longueure.get();}
public void setLongueure(int valeur) {longueure.set(valeur);}
public ReadOnlyIntegerProperty longueureProperty(){return longueure;}
private IntegerProperty largeure = new SimpleIntegerProperty();
public int getLargeure() {return largeure.get();}
public void setLargeure(int valeur) {largeure.set(valeur);}
public ReadOnlyIntegerProperty largeureProperty(){return largeure;}
private ObjectProperty grilleCellules = new SimpleObjectProperty();
public List<Cellule> getGrilleCellules() {return (List<Cellule>) grilleCellules.get();}
public void setGrilleCellules(List<Cellule> cells) {grilleCellules.set(cells);}
public ReadOnlyObjectProperty grilleCellulesProperty() {return grilleCellules;}
}
Loading…
Cancel
Save