Show BlackPassAction.java syntax highlighted
package geronimo.hoshigo.control.player;
import geronimo.hoshigo.model.game.Game;
import geronimo.hoshigo.model.game.Player.PlayerState;
import geronimo.hoshigo.model.goban.GoColor;
public class BlackPassAction extends PassAction
{
private static BlackPassAction instance;
/**
* Constructeur. Il est privé car on ne peut créer qu'une instance de cette
* classe.
* @see AnyColorPassAction#getInstance()
*/
private BlackPassAction()
{
}
/**
* Accès à l'instance
* @return Retourne l'instance de la classe
*/
public static synchronized BlackPassAction getInstance()
{
// Création de l'instance au premier appel
if( BlackPassAction.instance == null )
{
BlackPassAction.instance = new BlackPassAction();
}
return BlackPassAction.instance;
}
/**
* Changement de la partie active.
* @param game Nouvelle partie courante
*/
public void setActiveGame(Game game)
{
super.setActiveGame(game);
if( this.game.getCurrentPlayer().isHuman()
&& this.game.getPlayingColor () == GoColor.BLACK
&& this.game.getCurrentPlayer().getState() == PlayerState.THINKING)
{
this.setEnabled(true);
}
else
{
this.setEnabled(false);
}
}
}
See more files for this project here