Skip to content

Commit dc4c525

Browse files
author
T480
committed
cleanup
1 parent 1a59810 commit dc4c525

File tree

30 files changed

+678
-668
lines changed

30 files changed

+678
-668
lines changed

chessy-cli/src/main/java/com/saucecode/chessy/cli/CLI.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ public class CLI {
66

77
@SuppressWarnings("unused")
88
public static void main(String[] args) {
9-
Game game = new Game();
10-
Terminal terminal = new Terminal();
9+
final Game game = new Game();
10+
final Terminal terminal = new Terminal();
1111
int fromX, fromY, toX, toY;
1212
while (true) {
1313
System.out.println(game);

chessy-cli/src/main/java/com/saucecode/chessy/cli/Terminal.java

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,15 @@
66

77
/**
88
* Provides methods for reading data from the console.
9-
*
9+
*
1010
* @author Torben Krüger
1111
*/
1212
public class Terminal {
1313

1414
/**
1515
* The reader for receiving data.
1616
*/
17-
private BufferedReader console;
17+
private final BufferedReader console;
1818

1919
/**
2020
* Creates a new Terminal, which is ready for use.
@@ -25,21 +25,21 @@ public Terminal() {
2525

2626
/**
2727
* Returns the next line from the console as a String.
28-
*
28+
*
2929
* @return String read from the console
3030
*/
3131
public String readLine() {
3232
try {
3333
return console.readLine();
34-
} catch (IOException e) {
34+
} catch (final IOException e) {
3535
return "\n";
3636
}
3737
}
3838

3939
/**
40-
* Returns the next line from the console interpreted as an int. Only the
41-
* first digits including a sign will be read.
42-
*
40+
* Returns the next line from the console interpreted as an int. Only the first digits including a sign will be
41+
* read.
42+
*
4343
* @return int read from the console
4444
*/
4545
public int readInt() {
@@ -48,19 +48,18 @@ public int readInt() {
4848

4949
/**
5050
* Parses a String to an int.
51-
*
52-
* @param string
53-
* the String to be parsed
51+
*
52+
* @param string the String to be parsed
5453
* @return
55-
* <ul>
54+
* <ul>
5655
* <li>the parsed int</li>
5756
* <li>{@code -1}, if an error occurred</li>
5857
* </ul>
5958
*/
6059
private int parseInt(String string) {
6160
try {
6261
return Integer.parseInt(string);
63-
} catch (NumberFormatException e) {
62+
} catch (final NumberFormatException e) {
6463
return -1;
6564
}
6665
}

chessy-core/src/main/java/com/saucecode/chessy/core/Field.java

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
/**
66
* In implementation of {@link FieldI}.
7-
*
7+
*
88
* @author Torben Kr&uuml;ger
99
*/
1010
public class Field implements FieldI {
@@ -21,7 +21,7 @@ public class Field implements FieldI {
2121

2222
/**
2323
* Creates a new Field with given values.
24-
*
24+
*
2525
* @param figureType figure type
2626
* @param modifier modifier
2727
*/
@@ -58,17 +58,22 @@ public int hashCode() {
5858

5959
@Override
6060
public boolean equals(Object obj) {
61-
if (this == obj)
61+
if (this == obj) {
6262
return true;
63-
if (obj == null)
63+
}
64+
if (obj == null) {
6465
return false;
65-
if (getClass() != obj.getClass())
66+
}
67+
if (getClass() != obj.getClass()) {
6668
return false;
67-
Field other = (Field) obj;
68-
if (figureType != other.figureType)
69+
}
70+
final Field other = (Field) obj;
71+
if (figureType != other.figureType) {
6972
return false;
70-
if (modifier != other.modifier)
73+
}
74+
if (modifier != other.modifier) {
7175
return false;
76+
}
7277
return true;
7378
}
7479

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,30 @@
11
package com.saucecode.chessy.core;
22

33
/**
4-
* Interface for value-holding fields, which represent one of each field on a
5-
* chessgame.
6-
*
4+
* Interface for value-holding fields, which represent one of each field on a chessgame.
5+
*
76
* @since 1.0.0
8-
*
7+
*
98
* @author Torben Kr&uuml;ger
109
*/
1110
public interface FieldI {
1211

1312
/**
1413
* Returns the figure, which is standing on this field.
15-
*
14+
*
1615
* @return figure, which is standing on this field
17-
*
16+
*
1817
* @since 1.0.0
1918
*/
20-
public FigureType getFigure();
19+
FigureType getFigure();
2120

2221
/**
2322
* Returns the modifier for this field.
24-
*
23+
*
2524
* @return modifier for this field
26-
*
25+
*
2726
* @since 1.0.0
2827
*/
29-
public Modifier getModifier();
28+
Modifier getModifier();
3029

3130
}

chessy-core/src/main/java/com/saucecode/chessy/core/FigureType.java

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,100 +2,100 @@
22

33
/**
44
* All possible Figures.
5-
*
5+
*
66
* @since 1.0.0
7-
*
7+
*
88
* @author Torben Kr&uuml;ger
99
*/
1010
public enum FigureType {
1111

1212
/**
1313
* Black bishop.
14-
*
14+
*
1515
* @since 1.0.0
1616
*/
1717
BISHOP_BLACK,
1818

1919
/**
2020
* White bishop.
21-
*
21+
*
2222
* @since 1.0.0
2323
*/
2424
BISHOP_WHITE,
2525

2626
/**
2727
* Black King.
28-
*
28+
*
2929
* @since 1.0.0
3030
*/
3131
KING_BLACK,
3232

3333
/**
3434
* White King.
35-
*
35+
*
3636
* @since 1.0.0
3737
*/
3838
KING_WHITE,
3939

4040
/**
4141
* Black Knight.
42-
*
42+
*
4343
* @since 1.0.0
4444
*/
4545
KNIGHT_BLACK,
4646

4747
/**
4848
* White Knight.
49-
*
49+
*
5050
* @since 1.0.0
5151
*/
5252
KNIGHT_WHITE,
5353

5454
/**
5555
* Black Pawn.
56-
*
56+
*
5757
* @since 1.0.0
5858
*/
5959
PAWN_BLACK,
6060

6161
/**
6262
* White Pawn.
63-
*
63+
*
6464
* @since 1.0.0
6565
*/
6666
PAWN_WHITE,
6767

6868
/**
6969
* Black Queen.
70-
*
70+
*
7171
* @since 1.0.0
7272
*/
7373
QUEEN_BLACK,
7474

7575
/**
7676
* White Queen.
77-
*
77+
*
7878
* @since 1.0.0
7979
*/
8080
QUEEN_WHITE,
8181

8282
/**
8383
* Black Rook.
84-
*
84+
*
8585
* @since 1.0.0
8686
*/
8787
ROOK_BLACK,
8888

8989
/**
9090
* White Rook.
91-
*
91+
*
9292
* @since 1.0.0
9393
*/
9494
ROOK_WHITE,
9595

9696
/**
9797
* No figure.
98-
*
98+
*
9999
* @since 1.0.0
100100
*/
101101
NONE,

0 commit comments

Comments
 (0)