constructeurs pour classes abstrraites
This commit is contained in:
@@ -22,6 +22,14 @@ public abstract class AbstractBoard implements IBoard{
|
||||
|
||||
// used as a stack.
|
||||
private Deque<AbstractPly> history;
|
||||
|
||||
|
||||
// constructeur à appeler dans le constructeur d'un fils concret avec super.
|
||||
public AbstractBoard(Player p, Deque<AbstractPly> h){
|
||||
this.currentPlayer = p;
|
||||
this.history = h;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* set current player to the other player.
|
||||
|
@@ -32,8 +32,11 @@ public abstract class AbstractGame {
|
||||
// a map from the enum Player to the genuine Player AbstractGamePlayer
|
||||
private EnumMap<Player, AbstractGamePlayer> mapPlayers;
|
||||
|
||||
//NB. pas de constructeur possible on est abstrait, il faut faire une usine abstraite.
|
||||
|
||||
// constructeur à appeler dans le constructeur d'un fils concret avec super.
|
||||
public AbstractGame(IBoard b, EnumMap<Player,AbstractGamePlayer> m){
|
||||
this.currentBoard=b;
|
||||
this.mapPlayers=m;
|
||||
}
|
||||
|
||||
/**
|
||||
* boucle de contrôle du jeu.
|
||||
|
@@ -13,6 +13,10 @@ public abstract class AbstractGamePlayer {
|
||||
// Le joueur réel pourrait avoir besoin de connaître un constructeur de coup?
|
||||
// pas pour l'instant.
|
||||
|
||||
// constructeur à appeler dans le constructeur d'un fils concret avec super.
|
||||
public AbstractGamePlayer(Player p){
|
||||
this.iAm=p;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
|
@@ -3,6 +3,11 @@ package fr.iut_fbleau.GameAPI;
|
||||
public abstract class AbstractPly {
|
||||
private Player joueur;
|
||||
|
||||
// constructeur à appeler dans le constructeur d'un fils concret avec super.
|
||||
public AbstractPly(Player j){
|
||||
this.joueur=j;
|
||||
}
|
||||
|
||||
public Player getPlayer(){
|
||||
return this.joueur;
|
||||
}
|
||||
|
Reference in New Issue
Block a user