[LIB-9] Set of entities for PGN parsing and formatting
[chesshog.git] / chesshog-format / src / main / java / org / hedgecode / chess / pgn / PGNBuilder.java
index 7095a56..5d57dcf 100644 (file)
@@ -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.
 
 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();
+    }
 
 }