commit 02390102fe5f1f86fbe8b5b68a82ec6bc616d52c
Author: @havlijan17 <havlijan@students.zcu.cz>
Date:   Thu Apr 16 21:43:20 2020 +0200

    #re#7868 Test - JSON format observed.

diff --git a/project/Deserializer/src/Converter.java b/project/Deserializer/src/Converter.java
index 99818a2..ac1ecb5 100644
--- a/project/Deserializer/src/Converter.java
+++ b/project/Deserializer/src/Converter.java
@@ -4,22 +4,46 @@ import java.io.FileOutputStream;
 import java.io.IOException;
 import java.io.OutputStream;
 import java.io.PrintStream;
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 
 import jdeserialize.content;
 import jdeserialize.jdeserialize;
 
 public class Converter extends Thread {
-	
 	private Deserializer main;
 	
 	private File input;
 	private File output;
+
+	//Key as enum?
+	private HashMap<String, String> html = new HashMap<String, String>();
+	private HashMap<String, String> json = new HashMap<String, String>();
 	
 	public Converter(Deserializer main, File inputFilename, File outputFilename) {
 		this.main = main;
 		this.input = inputFilename;
 		this.output = outputFilename;
+		
+		fillInTestingDictionaries();
+	}
+
+	private void fillInTestingDictionaries()
+	{
+		html.put("indent", "");
+		html.put("lineBreak", "");
+		html.put("classCol", "");
+		html.put("fieldCol", "");
+		html.put("valCol", "");
+		html.put("keywordCol", "");
+
+		json.put("indent", "\t");
+		json.put("lineBreak", "\n");
+		json.put("classCol", "");
+		json.put("fieldCol", "");
+		json.put("valCol", "");
+		json.put("keywordCol", "");
 	}
 	
 	@Override
@@ -72,7 +96,7 @@ public class Converter extends Thread {
 					//replace VS parametr
 					//Pustit 2X s parametrem nenabori vnitrni data (kde muzou byt html znacky)
 					//Ciste HTML / Cisty JSON
-					json += cnt.toJson("", null);
+					json += cnt.toJson("", null, this.json);
 				}
 			}
 
diff --git a/project/Deserializer/src/jdeserialize/arrayobj.java b/project/Deserializer/src/jdeserialize/arrayobj.java
index e553ac5..b850c14 100644
--- a/project/Deserializer/src/jdeserialize/arrayobj.java
+++ b/project/Deserializer/src/jdeserialize/arrayobj.java
@@ -32,14 +32,14 @@ public class arrayobj extends contentbase {
         this.data = data;
     }
 
-    public @Override String toJson(String indentation, Map<classdesc, Map<field, Object>> fielddata) {
+    public @Override String toJson(String indentation, Map<classdesc, Map<field, Object>> fielddata, Map<String, String> formatting) {
         StringBuilder sb = new StringBuilder();
         sb.append("[ ");
 
         for (Object el : this.data) {
             if (el != null) {
                 if (el instanceof content) {
-                    sb.append(((content) el).toJson(indentation, fielddata));
+                    sb.append(((content) el).toJson(indentation, fielddata, formatting));
                 }else{
                     sb.append(el.toString());
                 }
diff --git a/project/Deserializer/src/jdeserialize/classdesc.java b/project/Deserializer/src/jdeserialize/classdesc.java
index 7991280..2bf7a6f 100644
--- a/project/Deserializer/src/jdeserialize/classdesc.java
+++ b/project/Deserializer/src/jdeserialize/classdesc.java
@@ -224,14 +224,14 @@ public class classdesc extends contentbase {
         }
     }
 
-    public @Override String toJson(String indentation, Map<classdesc, Map<field, Object>> fielddata)
+    public @Override String toJson(String indentation, Map<classdesc, Map<field, Object>> fielddata, Map<String, String> formatting)
     {
         StringBuffer sb = new StringBuffer();
         String val = "";
 
-        sb.append(indentation).append("{\n");
+        sb.append(indentation).append("{" + formatting.get("lineBreak"));
 
-        indentation += "\t";
+        indentation += formatting.get("indent");
 
         // ClassName
         sb.append(indentation).append("class ").append(this.name);
@@ -248,7 +248,7 @@ public class classdesc extends contentbase {
         }
         sb.append(" : {"); // ending of first line
         
-        indentation += "\t";
+        indentation += formatting.get("indent");
 
         for (field f : this.fields) {
             // v this.fielddata najit element, jehoz key == classdesc
@@ -258,13 +258,13 @@ public class classdesc extends contentbase {
 
             if(locVal instanceof content)
             {
-                val = ((content)locVal).toJson(indentation, fielddata);
+                val = ((content)locVal).toJson(indentation, fielddata, formatting);
             }
             else {
                 val = locVal.toString();
             }
 
-            sb.append("\n").append(indentation);
+            sb.append(formatting.get("lineBreak")).append(indentation);
             sb.append("\"").append(f.name).append("\"");
             sb.append(" : ");
             sb.append(val);
@@ -275,19 +275,19 @@ public class classdesc extends contentbase {
         }
         indentation = indentation.substring(0, indentation.length() - 1);
 
-        sb.append("\n").append(indentation).append("}");
+        sb.append(formatting.get("lineBreak")).append(indentation).append("}");
 
         if(this.superclass != null)
         {
             indentation = indentation.substring(0, indentation.length() - 1);
-            sb.append("\n}");
-            sb.append(",\n");
-            sb.append(this.superclass.toJson(indentation, fielddata));
+            sb.append(formatting.get("lineBreak")).append("}");
+            sb.append("," + formatting.get("lineBreak"));
+            sb.append(this.superclass.toJson(indentation, fielddata, formatting));
         }
         else 
         {
             indentation = indentation.substring(0, indentation.length() - 1);
-            sb.append("\n").append(indentation).append("}");
+            sb.append(formatting.get("lineBreak")).append(indentation).append("}");
         }
 
         return sb.toString();
diff --git a/project/Deserializer/src/jdeserialize/content.java b/project/Deserializer/src/jdeserialize/content.java
index 2c06750..fb4ed3b 100644
--- a/project/Deserializer/src/jdeserialize/content.java
+++ b/project/Deserializer/src/jdeserialize/content.java
@@ -1,5 +1,6 @@
 package jdeserialize;
 
+import java.util.HashMap;
 import java.util.Map;
 
 /**
@@ -68,6 +69,6 @@ public interface content {
      */
     public void setIsExceptionObject(boolean value);
 
-    public String toJson(String indentation, Map<classdesc, Map<field, Object>> fielddata);
+    public String toJson(String indentation, Map<classdesc, Map<field, Object>> fielddata, Map<String, String> formatting);
 }
 
diff --git a/project/Deserializer/src/jdeserialize/contentbase.java b/project/Deserializer/src/jdeserialize/contentbase.java
index dee4908..0e3e70d 100644
--- a/project/Deserializer/src/jdeserialize/contentbase.java
+++ b/project/Deserializer/src/jdeserialize/contentbase.java
@@ -27,7 +27,7 @@ public class contentbase implements content {
     public void validate() throws ValidityException {
     }
 
-    public @Override String toJson(String indetation, Map<classdesc, Map<field, Object>> fielddata)
+    public @Override String toJson(String indetation, Map<classdesc, Map<field, Object>> fielddata, Map<String, String> formatting)
     {
         return this.toString();
     }
diff --git a/project/Deserializer/src/jdeserialize/enumobj.java b/project/Deserializer/src/jdeserialize/enumobj.java
index 09e26ce..a8abc15 100644
--- a/project/Deserializer/src/jdeserialize/enumobj.java
+++ b/project/Deserializer/src/jdeserialize/enumobj.java
@@ -34,7 +34,7 @@ public class enumobj extends contentbase {
         this.classdesc = cd;
         this.value = so;
     }
-    public @Override String toJson(String indetation, Map<classdesc, Map<field, Object>> fielddata) {
+    public @Override String toJson(String indetation, Map<classdesc, Map<field, Object>> fielddata, Map<String, String> formatting) {
         return this.value.value;
     }
 
diff --git a/project/Deserializer/src/jdeserialize/instance.java b/project/Deserializer/src/jdeserialize/instance.java
index 199dadb..5829d49 100644
--- a/project/Deserializer/src/jdeserialize/instance.java
+++ b/project/Deserializer/src/jdeserialize/instance.java
@@ -26,14 +26,14 @@ public class instance extends contentbase {
         this.fielddata = new HashMap<classdesc, Map<field, Object>>();
     }
 
-    public @Override String toJson(String indentation, Map<classdesc, Map<field, Object>> fielddata)
+    public @Override String toJson(String indentation, Map<classdesc, Map<field, Object>> fielddata, Map<String, String> formatting)
     {
         StringBuffer sb = new StringBuffer();
         String val = "";
         
-        sb.append("{\n");
+        sb.append("{" + formatting.get("lineBreak"));
         
-        indentation += "\t";
+        indentation += formatting.get("indent");
 
         // ClassName
         sb.append(indentation).append("class ").append(classdesc.name);
@@ -50,7 +50,7 @@ public class instance extends contentbase {
         }
         sb.append(" : {"); // ending of first line
         
-        indentation += "\t";
+        indentation += formatting.get("indent");
 
         for (field f : classdesc.fields) {
             // v this.fielddata najit element, jehoz key == classdesc
@@ -60,13 +60,13 @@ public class instance extends contentbase {
 
             if(locVal instanceof content)
             {
-                val = ((content)locVal).toJson(indentation, this.fielddata);
+                val = ((content)locVal).toJson(indentation, this.fielddata, formatting);
             }
             else {
                 val = locVal.toString();
             }
 
-            sb.append("\n").append(indentation);
+            sb.append(formatting.get("lineBreak")).append(indentation);
             sb.append("\"").append(f.name).append("\"");
             sb.append(" : ");
             sb.append(val);
@@ -77,19 +77,19 @@ public class instance extends contentbase {
         }
         indentation = indentation.substring(0, indentation.length() - 1);
 
-        sb.append("\n").append(indentation).append("}");
+        sb.append(formatting.get("lineBreak")).append(indentation).append("}");
 
         if(classdesc.superclass != null)
         {
             indentation = indentation.substring(0, indentation.length() - 1);
-            sb.append("\n}");
-            sb.append(",\n");
-            sb.append(classdesc.superclass.toJson(indentation, this.fielddata));
+            sb.append(formatting.get("lineBreak") + "}");
+            sb.append(",").append(formatting.get("lineBreak"));
+            sb.append(classdesc.superclass.toJson(indentation, this.fielddata, formatting));
         }
         else 
         {
             indentation = indentation.substring(0, indentation.length() - 1);
-            sb.append("\n").append(indentation).append("}");
+            sb.append(formatting.get("lineBreak")).append(indentation).append("}");
         }
 
         return sb.toString();
diff --git a/project/Deserializer/src/jdeserialize/stringobj.java b/project/Deserializer/src/jdeserialize/stringobj.java
index 2974ee8..f47d73b 100644
--- a/project/Deserializer/src/jdeserialize/stringobj.java
+++ b/project/Deserializer/src/jdeserialize/stringobj.java
@@ -18,7 +18,7 @@ public class stringobj extends contentbase {
         return x;
     }
 
-    public @Override String toJson(String indetation, Map<classdesc, Map<field, Object>> fielddata)
+    public @Override String toJson(String indetation, Map<classdesc, Map<field, Object>> fielddata, Map<String, String> formatting)
     {
         return "\"" + this.value + "\"";
     }
