From 569af88b0115065e1a4551a20501bbd200fcba17 Mon Sep 17 00:00:00 2001 From: gotty Date: Fri, 19 Apr 2019 06:56:28 +0300 Subject: [PATCH] [LIB-9] Fix some class dependencies between modules --- .../src/main/java/org/hedgecode/chess/fen/FEN.java | 16 ++++++++-------- .../main/java/org/hedgecode/chess/tcd/TCDBuilder.java | 18 +++++++++--------- .../java/org/hedgecode/chess/AbstractPositionTest.java | 0 .../org/hedgecode/chess/AbstractXMLConfigTest.java | 0 .../org/hedgecode/chess/ascii/ASCIIBuilderTest.java | 4 ++-- .../org/hedgecode/chess/ascii/ASCIIParserTest.java | 4 ++-- .../java/org/hedgecode/chess/fen/FENBuilderTest.java | 4 ++-- .../java/org/hedgecode/chess/fen/FENParserTest.java | 4 ++-- .../java/org/hedgecode/chess/tcd/TCDBuilderTest.java | 4 ++-- .../java/org/hedgecode/chess/tcd/TCDParserTest.java | 4 ++-- .../java/org/hedgecode/chess/wiki/WikiBuilderTest.java | 4 ++-- .../java/org/hedgecode/chess/wiki/WikiParserTest.java | 4 ++-- chesshog-qrcode/pom.xml | 5 +++++ 13 files changed, 38 insertions(+), 33 deletions(-) rename {chesshog-core => chesshog-format}/src/test/java/org/hedgecode/chess/AbstractPositionTest.java (100%) rename {chesshog-core => chesshog-format}/src/test/java/org/hedgecode/chess/AbstractXMLConfigTest.java (100%) diff --git a/chesshog-format/src/main/java/org/hedgecode/chess/fen/FEN.java b/chesshog-format/src/main/java/org/hedgecode/chess/fen/FEN.java index 36a781c..8523371 100644 --- a/chesshog-format/src/main/java/org/hedgecode/chess/fen/FEN.java +++ b/chesshog-format/src/main/java/org/hedgecode/chess/fen/FEN.java @@ -140,11 +140,11 @@ public final class FEN { } else { boolean isKing = false, isQueen = false; switch (color) { - case Color.WHITE: + case WHITE: isKing = (castles.indexOf(WHITE_KING) >= 0); isQueen = (castles.indexOf(WHITE_QUEEN) >= 0); break; - case Color.BLACK: + case BLACK: isKing = (castles.indexOf(BLACK_KING) >= 0); isQueen = (castles.indexOf(BLACK_QUEEN) >= 0); break; @@ -160,24 +160,24 @@ public final class FEN { public static String getCastle(Castle whiteCastle, Castle blackCastle) { StringBuilder sb = new StringBuilder(); switch (whiteCastle) { - case Castle.KING: + case KING: sb.append(WHITE_KING); break; - case Castle.QUEEN: + case QUEEN: sb.append(WHITE_QUEEN); break; - case Castle.BOTH: + case BOTH: sb.append(WHITE_KING).append(WHITE_QUEEN); break; } switch (blackCastle) { - case Castle.KING: + case KING: sb.append(BLACK_KING); break; - case Castle.QUEEN: + case QUEEN: sb.append(BLACK_QUEEN); break; - case Castle.BOTH: + case BOTH: sb.append(BLACK_KING).append(BLACK_QUEEN); break; } diff --git a/chesshog-format/src/main/java/org/hedgecode/chess/tcd/TCDBuilder.java b/chesshog-format/src/main/java/org/hedgecode/chess/tcd/TCDBuilder.java index b72372c..ea9355f 100644 --- a/chesshog-format/src/main/java/org/hedgecode/chess/tcd/TCDBuilder.java +++ b/chesshog-format/src/main/java/org/hedgecode/chess/tcd/TCDBuilder.java @@ -82,22 +82,22 @@ public final class TCDBuilder implements Builder { byte[] pieces = new byte[2 * (squarePieces.size() + 1)]; int i = 0; switch (piece) { - case Piece.PAWN: + case PAWN: pieces[i++] = TCD.PAWN; break; - case Piece.KNIGHT: + case KNIGHT: pieces[i++] = TCD.KNIGHT; break; - case Piece.BISHOP: + case BISHOP: pieces[i++] = TCD.BISHOP; break; - case Piece.ROOK: + case ROOK: pieces[i++] = TCD.ROOK; break; - case Piece.QUEEN: + case QUEEN: pieces[i++] = TCD.QUEEN; break; - case Piece.KING: + case KING: pieces[i++] = TCD.KING; break; } @@ -143,13 +143,13 @@ public final class TCDBuilder implements Builder { if (castle != null) { byte castleByte; switch (castle) { - case Castle.KING: + case KING: castleByte = TCD.CASTLE_KING; break; - case Castle.QUEEN: + case QUEEN: castleByte = TCD.CASTLE_QUEEN; break; - case Castle.BOTH: + case BOTH: castleByte = TCD.CASTLE_BOTH; break; default: diff --git a/chesshog-core/src/test/java/org/hedgecode/chess/AbstractPositionTest.java b/chesshog-format/src/test/java/org/hedgecode/chess/AbstractPositionTest.java similarity index 100% rename from chesshog-core/src/test/java/org/hedgecode/chess/AbstractPositionTest.java rename to chesshog-format/src/test/java/org/hedgecode/chess/AbstractPositionTest.java diff --git a/chesshog-core/src/test/java/org/hedgecode/chess/AbstractXMLConfigTest.java b/chesshog-format/src/test/java/org/hedgecode/chess/AbstractXMLConfigTest.java similarity index 100% rename from chesshog-core/src/test/java/org/hedgecode/chess/AbstractXMLConfigTest.java rename to chesshog-format/src/test/java/org/hedgecode/chess/AbstractXMLConfigTest.java diff --git a/chesshog-format/src/test/java/org/hedgecode/chess/ascii/ASCIIBuilderTest.java b/chesshog-format/src/test/java/org/hedgecode/chess/ascii/ASCIIBuilderTest.java index 2c5e177..9123b93 100644 --- a/chesshog-format/src/test/java/org/hedgecode/chess/ascii/ASCIIBuilderTest.java +++ b/chesshog-format/src/test/java/org/hedgecode/chess/ascii/ASCIIBuilderTest.java @@ -44,7 +44,7 @@ public class ASCIIBuilderTest extends AbstractPositionTest implements ASCIIPosit @Test public void testBuild() throws Exception { Builder asciiBuilder = ASCIIBuilder.getInstance(); - for (HierarchicalConfiguration testConfig : getXMLConfig().configurationsAt(AbstractXMLConfigTest.TESTS)) { + for (HierarchicalConfiguration testConfig : getXMLConfig().configurationsAt(TESTS)) { setPositionName( String.format( MSG_ASCII_POSITION, testConfig.getString(AbstractPositionTest.NAME) @@ -94,7 +94,7 @@ public class ASCIIBuilderTest extends AbstractPositionTest implements ASCIIPosit @Override public List getXMLPositions() throws Exception { List xmlPositions = new LinkedList<>(); - for (HierarchicalConfiguration testConfig : getXMLConfig().configurationsAt(AbstractXMLConfigTest.TESTS)) { + for (HierarchicalConfiguration testConfig : getXMLConfig().configurationsAt(TESTS)) { xmlPositions.add( new XMLConfiguration( testConfig.configurationAt(AbstractPositionTest.POSITION) diff --git a/chesshog-format/src/test/java/org/hedgecode/chess/ascii/ASCIIParserTest.java b/chesshog-format/src/test/java/org/hedgecode/chess/ascii/ASCIIParserTest.java index c8cce99..e88b664 100644 --- a/chesshog-format/src/test/java/org/hedgecode/chess/ascii/ASCIIParserTest.java +++ b/chesshog-format/src/test/java/org/hedgecode/chess/ascii/ASCIIParserTest.java @@ -41,7 +41,7 @@ public class ASCIIParserTest extends AbstractPositionTest implements ASCIIPositi @Test public void testParse() throws Exception { Parser asciiParser = ASCIIParser.getInstance(); - for (HierarchicalConfiguration testConfig : getXMLConfig().configurationsAt(AbstractXMLConfigTest.TESTS)) { + for (HierarchicalConfiguration testConfig : getXMLConfig().configurationsAt(TESTS)) { setPositionName( String.format( MSG_ASCII_POSITION, testConfig.getString(AbstractPositionTest.NAME) @@ -61,7 +61,7 @@ public class ASCIIParserTest extends AbstractPositionTest implements ASCIIPositi @Override public List getXMLPositions() throws Exception { List xmlPositions = new LinkedList<>(); - for (HierarchicalConfiguration testConfig : getXMLConfig().configurationsAt(AbstractXMLConfigTest.TESTS)) { + for (HierarchicalConfiguration testConfig : getXMLConfig().configurationsAt(TESTS)) { xmlPositions.add( new XMLConfiguration( testConfig.configurationAt(AbstractPositionTest.POSITION) diff --git a/chesshog-format/src/test/java/org/hedgecode/chess/fen/FENBuilderTest.java b/chesshog-format/src/test/java/org/hedgecode/chess/fen/FENBuilderTest.java index b04b307..ccdaaf8 100644 --- a/chesshog-format/src/test/java/org/hedgecode/chess/fen/FENBuilderTest.java +++ b/chesshog-format/src/test/java/org/hedgecode/chess/fen/FENBuilderTest.java @@ -41,7 +41,7 @@ public class FENBuilderTest extends AbstractPositionTest implements FENPositionT @Test public void testBuild() throws Exception { Builder fenBuilder = FENBuilder.getInstance(); - for (HierarchicalConfiguration testConfig : getXMLConfig().configurationsAt(AbstractXMLConfigTest.TESTS)) { + for (HierarchicalConfiguration testConfig : getXMLConfig().configurationsAt(TESTS)) { setPositionName( String.format( MSG_FEN_POSITION, testConfig.getString(AbstractPositionTest.NAME) @@ -61,7 +61,7 @@ public class FENBuilderTest extends AbstractPositionTest implements FENPositionT @Override public List getXMLPositions() throws Exception { List xmlPositions = new LinkedList<>(); - for (HierarchicalConfiguration testConfig : getXMLConfig().configurationsAt(AbstractXMLConfigTest.TESTS)) { + for (HierarchicalConfiguration testConfig : getXMLConfig().configurationsAt(TESTS)) { xmlPositions.add( new XMLConfiguration( testConfig.configurationAt(AbstractPositionTest.POSITION) diff --git a/chesshog-format/src/test/java/org/hedgecode/chess/fen/FENParserTest.java b/chesshog-format/src/test/java/org/hedgecode/chess/fen/FENParserTest.java index 38d2520..910c662 100644 --- a/chesshog-format/src/test/java/org/hedgecode/chess/fen/FENParserTest.java +++ b/chesshog-format/src/test/java/org/hedgecode/chess/fen/FENParserTest.java @@ -41,7 +41,7 @@ public class FENParserTest extends AbstractPositionTest implements FENPositionTe @Test public void testParse() throws Exception { Parser fenParser = FENParser.getInstance(); - for (HierarchicalConfiguration testConfig : getXMLConfig().configurationsAt(AbstractXMLConfigTest.TESTS)) { + for (HierarchicalConfiguration testConfig : getXMLConfig().configurationsAt(TESTS)) { setPositionName( String.format( MSG_FEN_POSITION, testConfig.getString(AbstractPositionTest.NAME) @@ -61,7 +61,7 @@ public class FENParserTest extends AbstractPositionTest implements FENPositionTe @Override public List getXMLPositions() throws Exception { List xmlPositions = new LinkedList<>(); - for (HierarchicalConfiguration testConfig : getXMLConfig().configurationsAt(AbstractXMLConfigTest.TESTS)) { + for (HierarchicalConfiguration testConfig : getXMLConfig().configurationsAt(TESTS)) { xmlPositions.add( new XMLConfiguration( testConfig.configurationAt(AbstractPositionTest.POSITION) diff --git a/chesshog-format/src/test/java/org/hedgecode/chess/tcd/TCDBuilderTest.java b/chesshog-format/src/test/java/org/hedgecode/chess/tcd/TCDBuilderTest.java index 9530475..9d6dde7 100644 --- a/chesshog-format/src/test/java/org/hedgecode/chess/tcd/TCDBuilderTest.java +++ b/chesshog-format/src/test/java/org/hedgecode/chess/tcd/TCDBuilderTest.java @@ -41,7 +41,7 @@ public class TCDBuilderTest extends AbstractPositionTest implements TCDPositionT @Test public void testBuild() throws Exception { Builder tcdBuilder = TCDBuilder.getInstance(); - for (HierarchicalConfiguration testConfig : getXMLConfig().configurationsAt(AbstractXMLConfigTest.TESTS)) { + for (HierarchicalConfiguration testConfig : getXMLConfig().configurationsAt(TESTS)) { setPositionName( String.format( MSG_TCD_POSITION, testConfig.getString(AbstractPositionTest.NAME) @@ -61,7 +61,7 @@ public class TCDBuilderTest extends AbstractPositionTest implements TCDPositionT @Override public List getXMLPositions() throws Exception { List xmlPositions = new LinkedList<>(); - for (HierarchicalConfiguration testConfig : getXMLConfig().configurationsAt(AbstractXMLConfigTest.TESTS)) { + for (HierarchicalConfiguration testConfig : getXMLConfig().configurationsAt(TESTS)) { xmlPositions.add( new XMLConfiguration( testConfig.configurationAt(AbstractPositionTest.POSITION) diff --git a/chesshog-format/src/test/java/org/hedgecode/chess/tcd/TCDParserTest.java b/chesshog-format/src/test/java/org/hedgecode/chess/tcd/TCDParserTest.java index 93ea766..8eaa61a 100644 --- a/chesshog-format/src/test/java/org/hedgecode/chess/tcd/TCDParserTest.java +++ b/chesshog-format/src/test/java/org/hedgecode/chess/tcd/TCDParserTest.java @@ -41,7 +41,7 @@ public class TCDParserTest extends AbstractPositionTest implements TCDPositionTe @Test public void testParse() throws Exception { Parser tcdParser = TCDParser.getInstance(); - for (HierarchicalConfiguration testConfig : getXMLConfig().configurationsAt(AbstractXMLConfigTest.TESTS)) { + for (HierarchicalConfiguration testConfig : getXMLConfig().configurationsAt(TESTS)) { setPositionName( String.format( MSG_TCD_POSITION, testConfig.getString(AbstractPositionTest.NAME) @@ -61,7 +61,7 @@ public class TCDParserTest extends AbstractPositionTest implements TCDPositionTe @Override public List getXMLPositions() throws Exception { List xmlPositions = new LinkedList<>(); - for (HierarchicalConfiguration testConfig : getXMLConfig().configurationsAt(AbstractXMLConfigTest.TESTS)) { + for (HierarchicalConfiguration testConfig : getXMLConfig().configurationsAt(TESTS)) { xmlPositions.add( new XMLConfiguration( testConfig.configurationAt(AbstractPositionTest.POSITION) diff --git a/chesshog-format/src/test/java/org/hedgecode/chess/wiki/WikiBuilderTest.java b/chesshog-format/src/test/java/org/hedgecode/chess/wiki/WikiBuilderTest.java index 3db948a..236a4ea 100644 --- a/chesshog-format/src/test/java/org/hedgecode/chess/wiki/WikiBuilderTest.java +++ b/chesshog-format/src/test/java/org/hedgecode/chess/wiki/WikiBuilderTest.java @@ -44,7 +44,7 @@ public class WikiBuilderTest extends AbstractPositionTest implements WikiPositio @Test public void testBuild() throws Exception { Builder wikiBuilder = WikiBuilder.getInstance(); - for (HierarchicalConfiguration testConfig : getXMLConfig().configurationsAt(AbstractXMLConfigTest.TESTS)) { + for (HierarchicalConfiguration testConfig : getXMLConfig().configurationsAt(TESTS)) { setPositionName( String.format( MSG_WIKI_POSITION, testConfig.getString(AbstractPositionTest.NAME) @@ -87,7 +87,7 @@ public class WikiBuilderTest extends AbstractPositionTest implements WikiPositio @Override public List getXMLPositions() throws Exception { List xmlPositions = new LinkedList<>(); - for (HierarchicalConfiguration testConfig : getXMLConfig().configurationsAt(AbstractXMLConfigTest.TESTS)) { + for (HierarchicalConfiguration testConfig : getXMLConfig().configurationsAt(TESTS)) { xmlPositions.add( new XMLConfiguration( testConfig.configurationAt(AbstractPositionTest.POSITION) diff --git a/chesshog-format/src/test/java/org/hedgecode/chess/wiki/WikiParserTest.java b/chesshog-format/src/test/java/org/hedgecode/chess/wiki/WikiParserTest.java index 2a1ee8d..2dbd4f3 100644 --- a/chesshog-format/src/test/java/org/hedgecode/chess/wiki/WikiParserTest.java +++ b/chesshog-format/src/test/java/org/hedgecode/chess/wiki/WikiParserTest.java @@ -41,7 +41,7 @@ public class WikiParserTest extends AbstractPositionTest implements WikiPosition @Test public void testParse() throws Exception { Parser wikiParser = WikiParser.getInstance(); - for (HierarchicalConfiguration testConfig : getXMLConfig().configurationsAt(AbstractXMLConfigTest.TESTS)) { + for (HierarchicalConfiguration testConfig : getXMLConfig().configurationsAt(TESTS)) { setPositionName( String.format( MSG_WIKI_POSITION, testConfig.getString(AbstractPositionTest.NAME) @@ -66,7 +66,7 @@ public class WikiParserTest extends AbstractPositionTest implements WikiPosition @Override public List getXMLPositions() throws Exception { List xmlPositions = new LinkedList<>(); - for (HierarchicalConfiguration testConfig : getXMLConfig().configurationsAt(AbstractXMLConfigTest.TESTS)) { + for (HierarchicalConfiguration testConfig : getXMLConfig().configurationsAt(TESTS)) { xmlPositions.add( new XMLConfiguration( testConfig.configurationAt(AbstractPositionTest.POSITION) diff --git a/chesshog-qrcode/pom.xml b/chesshog-qrcode/pom.xml index 3892e5e..b32e9d1 100644 --- a/chesshog-qrcode/pom.xml +++ b/chesshog-qrcode/pom.xml @@ -53,6 +53,11 @@ ${chessHogVersion} + org.hedgecode.chess + chesshog-format + ${chessHogVersion} + + com.google.zxing core ${zxingVersion} -- 2.10.0