2 * Copyright (c) 2018. Developed by Hedgecode.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 package org.hedgecode.chess.position;
22 * @author Dmitry Samoshin aka gotty
24 public enum ColorPiece {
26 WHITE_PAWN (Color.WHITE, Piece.PAWN),
27 WHITE_KNIGHT (Color.WHITE, Piece.KNIGHT),
28 WHITE_BISHOP (Color.WHITE, Piece.BISHOP),
29 WHITE_ROOK (Color.WHITE, Piece.ROOK),
30 WHITE_QUEEN (Color.WHITE, Piece.QUEEN),
31 WHITE_KING (Color.WHITE, Piece.KING),
33 BLACK_PAWN (Color.BLACK, Piece.PAWN),
34 BLACK_KNIGHT (Color.BLACK, Piece.KNIGHT),
35 BLACK_BISHOP (Color.BLACK, Piece.BISHOP),
36 BLACK_ROOK (Color.BLACK, Piece.ROOK),
37 BLACK_QUEEN (Color.BLACK, Piece.QUEEN),
38 BLACK_KING (Color.BLACK, Piece.KING);
43 ColorPiece(Color color, Piece piece) {
48 public Color color() {
52 public Piece piece() {
56 public static ColorPiece getColorPiece(Color color, Piece piece) {
57 if (color == null || piece == null)
59 for (ColorPiece colorPiece : ColorPiece.values()) {
60 if (colorPiece.color.equals(color) && (colorPiece.piece.equals(piece)))