[LIB-9] Add ability to archive qrcode content
[chesshog.git] / chesshog-qrcode / src / main / java / org / hedgecode / chess / qrcode / ChessQRResult.java
index 1b8bbf7..0e2f585 100644 (file)
@@ -23,7 +23,7 @@ import org.hedgecode.chess.position.Parser;
 import org.hedgecode.chess.position.Position;
 
 /**
- * Result storage for Chess-specific QR Codes data.
+ * Result storage for chess-specific QR Codes data.
  *
  * @author Dmitry Samoshin aka gotty
  */
@@ -34,11 +34,12 @@ public class ChessQRResult {
     private Position position;
     private Game game;
 
-    ChessQRResult(ChessQRCodeMode mode, String contents) {
+    public ChessQRResult(ChessQRCodeMode mode, String contents) {
         this.mode = mode;
         this.contents = contents;
     }
 
+/*
     ChessQRResult(Position position) {
         this.position = position;
     }
@@ -46,6 +47,7 @@ public class ChessQRResult {
     ChessQRResult(Game game) {
         this.game = game;
     }
+*/
 
     public ChessQRCodeMode getMode() {
         return mode;
@@ -88,4 +90,14 @@ public class ChessQRResult {
         }
     }
 
+    public static ChessQRCodeMode getMode(String contents) {
+        return ChessQRCodeMode.byCode(
+                contents.substring(0, ChessQRCodeMode.CODE_LENGTH)
+        );
+    }
+
+    public static String getContents(String contents) {
+        return contents.substring(ChessQRCodeMode.CODE_LENGTH);
+    }
+
 }