[LIB-9] Add original chesshog source files
[chesshog.git] / src / main / java / org / hedgecode / chess / position / GamePosition.java
1 /*
2  * Copyright (c) 2018. Developed by Hedgecode.
3  *
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
7  *
8  *   http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  */
16
17 package org.hedgecode.chess.position;
18
19 import java.util.HashMap;
20 import java.util.Map;
21
22 /**
23  *
24  *
25  * @author Dmitry Samoshin aka gotty
26  */
27 public class GamePosition extends DiagramPosition {
28
29     private Map<Color, Castle> castles = new HashMap<Color, Castle>(){
30         {
31             put(Color.WHITE, Castle.NONE);
32             put(Color.BLACK, Castle.NONE);
33         }
34     };
35
36     private int halfMove;
37     private int fullMove;
38
39     private Square enPassant;
40
41     @Override
42     public boolean isDiagram() {
43         return false;
44     }
45
46     @Override
47     public Castle getCastle(Color color) {
48         return castles.get(color);
49     }
50
51     @Override
52     public void setCastle(Color color, Castle castle) {
53         castles.put(color, castle);
54     }
55
56     @Override
57     public Square getEnPassant() {
58         return enPassant;
59     }
60
61     @Override
62     public void setEnPassant(Square square) {
63         enPassant = square;
64     }
65
66     @Override
67     public int getHalfMove() {
68         return halfMove;
69     }
70
71     @Override
72     public void setHalfMove(int count) {
73         halfMove = count;
74     }
75
76     @Override
77     public int getFullMove() {
78         return fullMove;
79     }
80
81     @Override
82     public void setFullMove(int number) {
83         fullMove = number;
84     }
85
86 }