Show WhitePassAction.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 WhitePassAction extends PassAction
{
private static WhitePassAction instance;
/**
* Constructeur. Il est privé car on ne peut créer qu'une instance de cette
* classe.
* @see AnyColorPassAction#getInstance()
*/
private WhitePassAction()
{
}
/**
* Accès à l'instance
* @return Retourne l'instance de la classe
*/
public static synchronized WhitePassAction getInstance()
{
// Création de l'instance au premier appel
if( WhitePassAction.instance == null )
{
WhitePassAction.instance = new WhitePassAction();
}
return WhitePassAction.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.WHITE
&& this.game.getCurrentPlayer().getState() == PlayerState.THINKING)
{
this.setEnabled(true);
}
else
{
this.setEnabled(false);
}
}
}
See more files for this project here