webidor/src/main/java/cz/xelfi/quoridor/webidor/GameStatus.java
changeset 256 1758a7727278
parent 255 9ecd02d694cd
child 257 03762a20a808
child 258 935118a5831a
     1.1 --- a/webidor/src/main/java/cz/xelfi/quoridor/webidor/GameStatus.java	Sun Sep 05 22:34:43 2010 +0200
     1.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.3 @@ -1,61 +0,0 @@
     1.4 -/*
     1.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
     1.6 - *
     1.7 - * The contents of this file are subject to the terms of either the GNU
     1.8 - * General Public License Version 2 only ("GPL") or the Common
     1.9 - * Development and Distribution License("CDDL") (collectively, the
    1.10 - * "License"). You may not use this file except in compliance with the
    1.11 - * License. You can obtain a copy of the License at
    1.12 - * http://www.netbeans.org/cddl-gplv2.html
    1.13 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
    1.14 - * specific language governing permissions and limitations under the
    1.15 - * License.  When distributing the software, include this License Header
    1.16 - * Notice in each file and include the License file at
    1.17 - * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
    1.18 - * particular file as subject to the "Classpath" exception as provided
    1.19 - * by Sun in the GPL Version 2 section of the License file that
    1.20 - * accompanied this code. If applicable, add the following below the
    1.21 - * License Header, with the fields enclosed by brackets [] replaced by
    1.22 - * your own identifying information:
    1.23 - * "Portions Copyrighted [year] [name of copyright owner]"
    1.24 - *
    1.25 - * Contributor(s):
    1.26 - *
    1.27 - * Portions Copyrighted 2009 Jaroslav Tulach
    1.28 - */
    1.29 -
    1.30 -package cz.xelfi.quoridor.webidor;
    1.31 -
    1.32 -import cz.xelfi.quoridor.Board;
    1.33 -
    1.34 -/** Possible states of the game.
    1.35 - *
    1.36 - * @author Jaroslav Tulach <jtulach@netbeans.org>
    1.37 - */
    1.38 -public enum GameStatus {
    1.39 -    whiteMove,
    1.40 -    blackMove,
    1.41 -    whiteWon,
    1.42 -    blackWon,
    1.43 -    history;
    1.44 -
    1.45 -    /** Creates appropriate status of the game based on the state
    1.46 -     * on the board.
    1.47 -     *
    1.48 -     * @param board the board
    1.49 -     * @return status describing the situation on the board
    1.50 -     */
    1.51 -    public static GameStatus valueOf(Board board) {
    1.52 -        if (board.getWinner() != null) {
    1.53 -            return board.getWinner() == board.getPlayers().get(0) ? GameStatus.whiteWon : GameStatus.blackWon;
    1.54 -        } else {
    1.55 -            return board.getCurrentPlayer() == board.getPlayers().get(0) ? GameStatus.whiteMove : GameStatus.blackMove;
    1.56 -        }
    1.57 -    }
    1.58 -
    1.59 -    /** @return true if the game is in progress
    1.60 -     */
    1.61 -    public boolean isInProgress() {
    1.62 -        return this == whiteMove || this == blackMove;
    1.63 -    }
    1.64 -}