Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue 99 pgn parsing order #104

Merged
merged 8 commits into from
Feb 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
*/
public class Event {

private final Map<Integer, Round> round = new HashMap<Integer, Round>();
private final Map<Integer, Round> round = new HashMap<>();
private String id;
private String name;
private EventType eventType;
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/com/github/bhlangonijr/chesslib/game/Game.java
Original file line number Diff line number Diff line change
Expand Up @@ -556,7 +556,7 @@ private int translateVariation(StringBuilder sb, MoveList variation, int parent,
@Override
public String toString() {
try {
return toPgn(true, true);
return toPgn(true, true); //TODO this throws NPE in debugger sometimes
} catch (MoveConversionException e) {
return null;
}
Expand Down Expand Up @@ -802,7 +802,7 @@ public void loadMoveText(StringBuilder moveText) throws Exception {
onCommentBlock = false;
if (comment != null) {
if (getComments() == null) {
setComments(new HashMap<Integer, String>());
setComments(new HashMap<>());
}
getComments().put(variantIndex, comment.toString());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,7 @@ public static Round newRound(Event event, int number) {
*/
public static Game newGame(String gameId, Round round) {

Game game = new Game(gameId, round);

return game;
return new Game(gameId, round);
}

/**
Expand All @@ -73,7 +71,9 @@ public static Game newGame(String gameId, Round round) {
* @return he newly created instance of a player
*/
public static Player newPlayer(PlayerType type, String name) {
return new GenericPlayer(name, name);
Player player = new GenericPlayer(name, name);
player.setType(type);
return player;
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
* A round of a chess event.
*/
public class Round {
private final List<Game> game = new ArrayList<Game>();
private final List<Game> game = new ArrayList<>();
private final Event event;
private int number;

Expand Down
Loading