X-Git-Url: https://git.hedgecode.org/?p=chesshog.git;a=blobdiff_plain;f=chesshog-format%2Fsrc%2Fmain%2Fjava%2Forg%2Fhedgecode%2Fchess%2Fpgn%2FPGNBuilder.java;h=5d57dcf988283e633f8060c75089327f4e886d56;hp=7095a56f0d139adb94aa6ec60a45d4e31105fa12;hb=5d271f23371d6a435a0435f000370f4d9b8c621a;hpb=569af88b0115065e1a4551a20501bbd200fcba17 diff --git a/chesshog-format/src/main/java/org/hedgecode/chess/pgn/PGNBuilder.java b/chesshog-format/src/main/java/org/hedgecode/chess/pgn/PGNBuilder.java index 7095a56..5d57dcf 100644 --- a/chesshog-format/src/main/java/org/hedgecode/chess/pgn/PGNBuilder.java +++ b/chesshog-format/src/main/java/org/hedgecode/chess/pgn/PGNBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018. Developed by Hedgecode. + * Copyright (c) 2018-2020. Developed by Hedgecode. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,14 +16,31 @@ package org.hedgecode.chess.pgn; +import org.hedgecode.chess.pgn.entity.Game; +import org.hedgecode.chess.pgn.format.PGNFormat; +import org.hedgecode.chess.pgn.format.ReducePGNFormat; + /** - * + * PGNBuilder * * @author Dmitry Samoshin aka gotty */ public class PGNBuilder { + public static String build(Game game) { + return build( + game, new ReducePGNFormat() + ); + } - + public static String build(Game game, PGNFormat pgnFormat) { + pgnFormat.addTags( + game.getTags() + ); + pgnFormat.addMoves( + game.getMoves() + ); + return pgnFormat.format(); + } }