Index: /branches/3026_IntegrationIntoSymSpace/HeuristicLab.Manufacture/Component.cs
===================================================================
--- /branches/3026_IntegrationIntoSymSpace/HeuristicLab.Manufacture/Component.cs	(revision 17279)
+++ /branches/3026_IntegrationIntoSymSpace/HeuristicLab.Manufacture/Component.cs	(revision 17280)
@@ -9,4 +9,5 @@
 
 namespace HeuristicLab.Manufacture {
+  //JsonItem
   public class Component {
     private IList<object> range;
@@ -23,5 +24,5 @@
       } 
     }
-    public string Path { get; set; }
+    public string Path { get; set; } = "";
 
     public IList<object> Range { 
@@ -43,7 +44,4 @@
 
     [JsonIgnore]
-    public IList<Component> ParameterizedItems { get; set; }
-
-    [JsonIgnore]
     public Component Reference { get; set; }
     
@@ -56,5 +54,4 @@
       target.Reference = from.Reference ?? target.Reference;
       target.Parameters = from.Parameters ?? target.Parameters;
-      target.ParameterizedItems = from.ParameterizedItems ?? target.ParameterizedItems;
       target.Operators = from.Operators ?? target.Operators;
     }
@@ -72,6 +69,34 @@
       IsInNumericRange<double>(data.Default, data.Range[0], data.Range[1]));
 
+
+
+    public void UpdatePaths() {
+      if (Parameters != null) {
+        foreach (var p in Parameters) {
+          p.Path = Path + "." + p.Name;
+        }
+      }
+
+      if (Operators != null) {
+        foreach (var p in Operators) {
+          p.Path = Path + "." + p.Name;
+        }
+      }
+    }
+
+    public void PrependPath(string str) {
+      Path = $"{str}.{Path}";
+      PrependPathHelper(Parameters, str);
+      PrependPathHelper(Operators, str);
+    }
+
+    private void PrependPathHelper(IEnumerable<Component> components, string str) {
+      if (components != null) {
+        foreach (var p in components)
+          p.PrependPath(str);
+      }
+    }
+
     #region Helper
-
     private static bool IsInRangeList(IEnumerable<object> list, object value) {
       foreach (var x in list)
Index: /branches/3026_IntegrationIntoSymSpace/HeuristicLab.Manufacture/CustomJsonWriter.cs
===================================================================
--- /branches/3026_IntegrationIntoSymSpace/HeuristicLab.Manufacture/CustomJsonWriter.cs	(revision 17280)
+++ /branches/3026_IntegrationIntoSymSpace/HeuristicLab.Manufacture/CustomJsonWriter.cs	(revision 17280)
@@ -0,0 +1,41 @@
+﻿using System.IO;
+using Newtonsoft.Json;
+using Newtonsoft.Json.Linq;
+
+namespace HeuristicLab.Manufacture {
+  internal class CustomJsonWriter : JsonTextWriter {
+    private bool isRangeArray = false;
+    public override void WriteStartArray() {
+      
+      if (isRangeArray) base.Formatting = Formatting.None;
+      base.WriteStartArray();
+    }
+
+    public override void WritePropertyName(string name) {
+      base.Formatting = Formatting.Indented;
+      base.WritePropertyName(name);
+      isRangeArray = name == "Range" || name == "Default";
+    }
+
+    public override void WriteStartObject() {
+      base.Formatting = Formatting.Indented;
+      base.WriteStartObject();
+    }
+
+    public override void WriteEndObject() {
+      base.Formatting = Formatting.Indented;
+      base.WriteEndObject();
+    }
+
+    public CustomJsonWriter(TextWriter writer) : base(writer) { }
+
+    public static string Serialize(JToken token) {
+      JsonSerializer serializer = new JsonSerializer();
+      StringWriter sw = new StringWriter();
+      CustomJsonWriter writer = new CustomJsonWriter(sw);
+      writer.Formatting = Formatting.Indented;
+      serializer.Serialize(writer, token);
+      return sw.ToString();
+    }
+  }
+}
Index: /branches/3026_IntegrationIntoSymSpace/HeuristicLab.Manufacture/HeuristicLab.Manufacture.csproj
===================================================================
--- /branches/3026_IntegrationIntoSymSpace/HeuristicLab.Manufacture/HeuristicLab.Manufacture.csproj	(revision 17279)
+++ /branches/3026_IntegrationIntoSymSpace/HeuristicLab.Manufacture/HeuristicLab.Manufacture.csproj	(revision 17280)
@@ -51,4 +51,5 @@
   </ItemGroup>
   <ItemGroup>
+    <Compile Include="CustomJsonWriter.cs" />
     <Compile Include="Extensions\ObjectExtensions.cs" />
     <Compile Include="Extensions\TypeExtensions.cs" />
Index: /branches/3026_IntegrationIntoSymSpace/HeuristicLab.Manufacture/Interfaces/ITypeTransformer.cs
===================================================================
--- /branches/3026_IntegrationIntoSymSpace/HeuristicLab.Manufacture/Interfaces/ITypeTransformer.cs	(revision 17279)
+++ /branches/3026_IntegrationIntoSymSpace/HeuristicLab.Manufacture/Interfaces/ITypeTransformer.cs	(revision 17280)
@@ -8,7 +8,19 @@
 
 namespace HeuristicLab.Manufacture {
-  //IDataProcessor?
   public interface ITypeTransformer {
+    /// <summary>
+    /// Extracts all infos out of an IItem to create a Component. 
+    /// (For template generation.)
+    /// </summary>
+    /// <param name="value">The IItem to extract infos.</param>
+    /// <returns>Component with infos to reinitialise the IItem.</returns>
     Component Extract(IItem value);
+
+    /// <summary>
+    /// Injects the saved infos from the Component into the IItem.
+    /// (Sets the necessary values.)
+    /// </summary>
+    /// <param name="item">The IItem which get the data injected.</param>
+    /// <param name="data">The Component with the saved values.</param>
     void Inject(IItem item, Component data);
   }
Index: /branches/3026_IntegrationIntoSymSpace/HeuristicLab.Manufacture/JCGenerator.cs
===================================================================
--- /branches/3026_IntegrationIntoSymSpace/HeuristicLab.Manufacture/JCGenerator.cs	(revision 17279)
+++ /branches/3026_IntegrationIntoSymSpace/HeuristicLab.Manufacture/JCGenerator.cs	(revision 17280)
@@ -1,5 +1,4 @@
 ﻿using System;
 using System.Collections.Generic;
-using System.IO;
 using System.Linq;
 using HeuristicLab.Algorithms.GeneticAlgorithm;
@@ -14,52 +13,4 @@
 
 namespace HeuristicLab.Manufacture {
-
-  public class CustomWriter : JsonTextWriter {
-    private const int ArrayFlatterLvl = 1;
-    private Stack<Formatting> formattings = new Stack<Formatting>();
-    private int lvl = 0;
-    private bool isRangeArray = false;
-    public override void WriteStartArray() {
-      base.WriteStartArray();
-      /*
-      if(lvl > ArrayFlatterLvl) {
-        formattings.Push(base.Formatting);
-        base.Formatting = Formatting.None;
-      }
-      lvl++;
-      */
-      if(isRangeArray) base.Formatting = Formatting.None;
-    }
-
-    public override void WriteEndArray() {
-      base.WriteEndArray();
-      /*
-      lvl--;
-      if (lvl > ArrayFlatterLvl)
-        base.Formatting = formattings.Pop();
-      */
-      if(isRangeArray) {
-        base.Formatting = Formatting.Indented;
-        isRangeArray = false;
-      }
-    }
-
-    public override void WritePropertyName(string name) {
-      base.WritePropertyName(name);
-      isRangeArray = name == "Range";
-    }
-
-    public CustomWriter(TextWriter writer) : base(writer) { }
-
-    public static string Serialize(JToken token) {
-      JsonSerializer serializer = new JsonSerializer();
-      StringWriter sw = new StringWriter();
-      CustomWriter writer = new CustomWriter(sw);
-      writer.Formatting = Formatting.Indented;
-      serializer.Serialize(writer, token);
-      return sw.ToString();
-    }
-  }
-
   public class JCGenerator {
 
@@ -74,47 +25,38 @@
 
     private Dictionary<string, string> TypeList = new Dictionary<string, string>();
-    
+
+    JArray jsonItems = new JArray();
+    private void PopulateJsonItems(Component component) {
+      if (component.Parameters != null) {
+        if(component.Range == null)
+          jsonItems.Add(Serialize(component));
+        foreach (var p in component.Parameters)
+          if(p.Parameters != null)
+            PopulateJsonItems(p);
+      }
+    }
+
+    private JObject Serialize(Component component) {
+      JObject obj = JObject.FromObject(component, Settings());
+      obj["StaticParameters"] = obj["Parameters"];
+      obj["FreeParameters"] = obj["Parameters"];
+
+      obj.Property("Parameters")?.Remove();
+      RefactorFreeParameters(obj, null);
+      RefactorStaticParameters(obj);
+
+      obj.Property("Default")?.Remove();
+      obj.Property("Type")?.Remove();
+
+      TypeList.Add(component.Path, component.Type);
+      return obj;
+    }
+
     public string GenerateTemplate(IAlgorithm algorithm, IProblem problem, params string[] freeParameters) {
       algorithm.Problem = problem;
       Component algorithmData = Transformer.Extract(algorithm);
       Component problemData = Transformer.Extract(problem);
-      IList<Component> items = algorithmData.ParameterizedItems;
-      foreach (var pItem in problemData.ParameterizedItems) items.Add(pItem);
-      JArray jsonItems = new JArray();
-      
-      foreach(var item in items.Distinct()) {
-        JObject token = JObject.FromObject(item, Settings());
-        //token["StaticParameters"] = token["Parameters"];
-        //token["FreeParameters"] = token["Parameters"];
-
-        foreach (JObject x in token["Parameters"]) {
-          x.Property("Parameters")?.Remove();
-          x.Property("Type")?.Remove();
-        }
-        TypeList.Add(item.Name, item.Type);
-        RefactorParameters(token);
-        /*
-        foreach (JObject x in token["StaticParameters"]) {
-          x.Property("Parameters")?.Remove();
-          x.Property("Type")?.Remove();
-        }
-        foreach (JObject x in token["FreeParameters"]) {
-          x.Property("Parameters")?.Remove();
-          x.Property("Type")?.Remove();
-        }
-        */
-        //token.Cast<JObject>().Property("Parameters")?.Remove();
-        token.Property("Default")?.Remove();
-        token.Property("Type")?.Remove();
-
-        //RefactorFreeParameters(token, freeParameters);
-        //RefactorStaticParameters(token);
-        if (/*token["StaticParameters"].HasValues || token["FreeParameters"].HasValues ||*/ token["Parameters"].HasValues || (token["Operators"]?.HasValues ?? false))
-          jsonItems.Add(token);
-
-        if(!token["Parameters"].HasValues) {
-          token.Property("Parameters")?.Remove();
-        }
-      }
+      PopulateJsonItems(algorithmData);
+      PopulateJsonItems(problemData);
 
       template["Metadata"]["Algorithm"] = algorithm.Name;
@@ -123,5 +65,5 @@
       template["Types"] = JObject.FromObject(TypeList);
 
-      return CustomWriter.Serialize(template);
+      return CustomJsonWriter.Serialize(template);
     }
 
@@ -129,5 +71,4 @@
     private void RefactorFreeParameters(JToken token, string[] freeParameters) {
 
-      //token["FreeParameters"] = token["StaticParameters"];
 
       IList<JObject> objToRemove = new List<JObject>();
@@ -145,4 +86,5 @@
           x.Property("Path")?.Remove();
           x.Property("Type")?.Remove();
+          x.Property("Parameters")?.Remove();
         }
       }, token["FreeParameters"]);
@@ -156,4 +98,7 @@
         var p = x.ToObject<Component>();
         x.Property("Range")?.Remove();
+        x.Property("Operators")?.Remove();
+        x.Property("Parameters")?.Remove();
+        x.Property("Type")?.Remove();
         if (p.Default == null) objToRemove.Add(x);
       }, token["StaticParameters"]);
@@ -161,23 +106,14 @@
     }
 
-    private void RefactorParameters(JToken token) {
-      IList<JObject> objToRemove = new List<JObject>();
-      TransformNodes(x => {
-        var p = x.ToObject<Component>();
-        if (p.Default == null) objToRemove.Add(x);
-      }, token["Parameters"]);
-      foreach (var x in objToRemove) x.Remove();
-    }
 
     private JsonSerializer Settings() => new JsonSerializer() {
       TypeNameHandling = TypeNameHandling.None,
-      NullValueHandling = NullValueHandling.Ignore
+      NullValueHandling = NullValueHandling.Ignore,
+      ReferenceLoopHandling = ReferenceLoopHandling.Serialize
     };
 
-
     private void TransformNodes(Action<JObject> action, params JToken[] tokens) {
-      foreach(JObject obj in tokens.SelectMany(x => x.Children<JObject>())) {
+      foreach(JObject obj in tokens.SelectMany(x => x.Children<JObject>()))
         action(obj);
-      }
     }
     #endregion
Index: /branches/3026_IntegrationIntoSymSpace/HeuristicLab.Manufacture/JCInstantiator.cs
===================================================================
--- /branches/3026_IntegrationIntoSymSpace/HeuristicLab.Manufacture/JCInstantiator.cs	(revision 17279)
+++ /branches/3026_IntegrationIntoSymSpace/HeuristicLab.Manufacture/JCInstantiator.cs	(revision 17280)
@@ -47,5 +47,5 @@
       foreach(JObject item in Config["Objects"])
       {
-        Component data = item.ToObject<Component>();// Component.Build(item);
+        Component data = BuildComponent(item);
         if (data.Name == key) return data;
       }
@@ -80,5 +80,5 @@
           Component tmp = BuildComponent(param);
           Component comp = null;
-          foreach (var p in list)
+          foreach (var p in list) // TODO: nicht notwendig, da immer alle params im static block sind
             if (p.Name == tmp.Name) comp = p;
           if (comp != null) 
Index: /branches/3026_IntegrationIntoSymSpace/HeuristicLab.Manufacture/ParameterTransformer/ConstrainedValueParameterTransformer.cs
===================================================================
--- /branches/3026_IntegrationIntoSymSpace/HeuristicLab.Manufacture/ParameterTransformer/ConstrainedValueParameterTransformer.cs	(revision 17279)
+++ /branches/3026_IntegrationIntoSymSpace/HeuristicLab.Manufacture/ParameterTransformer/ConstrainedValueParameterTransformer.cs	(revision 17280)
@@ -17,13 +17,11 @@
     }
 
-    public override Component ExtractData(IParameter value) {
-
-      return new Component() {
+    public override Component ExtractData(IParameter value) =>
+      new Component() {
         Name = value.Name,
         Default = value.ActualValue?.GetType().Name,
         Range = GetValidValues(value),
-        ParameterizedItems = GetParameterizedChilds(value)
+        Parameters = GetParameterizedChilds(value)
       };
-    }
 
     #region Helper
@@ -34,16 +32,13 @@
       return list.ToArray();
     }
-
+    // id = kombi aus path + default 
     private IList<Component> GetParameterizedChilds(IParameter value) {
       List<Component> list = new List<Component>();
       var values = value.Cast<dynamic>().ValidValues;
       foreach(var x in values) {
-        if (x is IParameterizedItem &&
-            ((IParameterizedItem)x).Parameters.Any(p => !p.Hidden)) {
+        if (x is IParameterizedItem) {
           Component tmp = Transformer.Extract(x);
-          if (tmp.ParameterizedItems != null)
-            list.AddRange(tmp.ParameterizedItems);
-          else
-            list.Add(tmp);
+          tmp.PrependPath(value.Name);
+          list.Add(tmp);
         }
       }
Index: /branches/3026_IntegrationIntoSymSpace/HeuristicLab.Manufacture/ParameterTransformer/ParameterBaseTransformer.cs
===================================================================
--- /branches/3026_IntegrationIntoSymSpace/HeuristicLab.Manufacture/ParameterTransformer/ParameterBaseTransformer.cs	(revision 17279)
+++ /branches/3026_IntegrationIntoSymSpace/HeuristicLab.Manufacture/ParameterTransformer/ParameterBaseTransformer.cs	(revision 17280)
@@ -8,5 +8,16 @@
 namespace HeuristicLab.Manufacture {
   public abstract class ParameterBaseTransformer : BaseTransformer {
-    public override Component ExtractData(IItem value) => ExtractData(value.Cast<IParameter>());
+    public override Component ExtractData(IItem value) {
+      IParameter param = value.Cast<IParameter>();
+      Component comp = ExtractData(param);
+      //comp.Path = value.Cast<IParameter>().ActualValue?.ItemName;
+      /*comp.Path = value.Cast<IParameter>().Name + "." + comp.Path;
+      if(comp.ParameterizedItems != null) {
+        foreach (var item in comp.ParameterizedItems) {
+          item.Path = value.Cast<IParameter>().Name + "." + item.Path;
+        }
+      }*/
+      return comp;
+    }
     public abstract Component ExtractData(IParameter value);
 
Index: /branches/3026_IntegrationIntoSymSpace/HeuristicLab.Manufacture/ParameterTransformer/ParameterizedItemTransformer.cs
===================================================================
--- /branches/3026_IntegrationIntoSymSpace/HeuristicLab.Manufacture/ParameterTransformer/ParameterizedItemTransformer.cs	(revision 17279)
+++ /branches/3026_IntegrationIntoSymSpace/HeuristicLab.Manufacture/ParameterTransformer/ParameterizedItemTransformer.cs	(revision 17280)
@@ -9,5 +9,4 @@
 {
   public class ParameterizedItemTransformer : BaseTransformer {
-    
     public override void InjectData(IItem item, Component data) {
       IParameterizedItem pItem = item.Cast<IParameterizedItem>();
@@ -21,20 +20,19 @@
 
     public override Component ExtractData(IItem value) {
-      List<Component> list = new List<Component>();
-
       Component obj = new Component();
       obj.Name = value.ItemName;
       obj.Type = value.GetType().AssemblyQualifiedName;
-      obj.ParameterizedItems = list;
-      obj.Parameters = new List<Component>();
-      list.Add(obj);
+      obj.Path = value.ItemName;
 
       foreach (var param in value.Cast<IParameterizedItem>().Parameters) {
-        if (!param.Hidden) {
-          Component data = Transformer.Extract(param);
-          obj.Parameters.Add(data);
-          if(data.ParameterizedItems != null)
-            list.AddRange(data.ParameterizedItems);
-        }
+        Component data = Transformer.Extract(param);
+        data.Name = param.Name;
+        data.Path = param.Name;
+        data.PrependPath(obj.Path);
+        data.UpdatePaths();
+        
+        if (obj.Parameters == null)
+          obj.Parameters = new List<Component>();
+        obj.Parameters.Add(data);
       }
       return obj;
Index: /branches/3026_IntegrationIntoSymSpace/HeuristicLab.Manufacture/Program.cs
===================================================================
--- /branches/3026_IntegrationIntoSymSpace/HeuristicLab.Manufacture/Program.cs	(revision 17279)
+++ /branches/3026_IntegrationIntoSymSpace/HeuristicLab.Manufacture/Program.cs	(revision 17280)
@@ -35,8 +35,8 @@
 
       JCGenerator gen = new JCGenerator();
-      File.WriteAllText(@"C:\Workspace\TemplateProto10.json", gen.GenerateTemplate(alg, tsp));
+      //File.WriteAllText(@"C:\Workspace\TemplateProto11.json", gen.GenerateTemplate(alg, tsp));
       
       JCInstantiator configurator = new JCInstantiator();
-      configurator.Instantiate(@"C:\Workspace\TemplateProto10.json");
+      configurator.Instantiate(@"C:\Workspace\TemplateProto11.json");
 
       //Console.ReadLine();
Index: /branches/3026_IntegrationIntoSymSpace/HeuristicLab.Manufacture/Transformer.cs
===================================================================
--- /branches/3026_IntegrationIntoSymSpace/HeuristicLab.Manufacture/Transformer.cs	(revision 17279)
+++ /branches/3026_IntegrationIntoSymSpace/HeuristicLab.Manufacture/Transformer.cs	(revision 17280)
@@ -11,6 +11,6 @@
     private static IDictionary<Type, ITypeTransformer> transformers = new Dictionary<Type, ITypeTransformer>();
     
-    public static void Register(Type type, ITypeTransformer transformer) {
-      if(!transformers.ContainsKey(type))
+    public static void Register(Type type, ITypeTransformer transformer) { // TODO: explizit
+      if (!transformers.ContainsKey(type))
         transformers.Add(type, transformer);
     }
@@ -19,5 +19,5 @@
     public static void Register<T>(ITypeTransformer transformer) => Register(typeof(T), transformer);
 
-    public static IEnumerable<ITypeTransformer> Get(Type type) {
+    public static IEnumerable<ITypeTransformer> Get(Type type) { 
       IList<KeyValuePair<Type, ITypeTransformer>> possibleTransformers = new List<KeyValuePair<Type, ITypeTransformer>>();
 
Index: /branches/3026_IntegrationIntoSymSpace/HeuristicLab.Manufacture/TypeTransformer/EnumTypeTransformer.cs
===================================================================
--- /branches/3026_IntegrationIntoSymSpace/HeuristicLab.Manufacture/TypeTransformer/EnumTypeTransformer.cs	(revision 17279)
+++ /branches/3026_IntegrationIntoSymSpace/HeuristicLab.Manufacture/TypeTransformer/EnumTypeTransformer.cs	(revision 17280)
@@ -9,5 +9,4 @@
 namespace HeuristicLab.Manufacture {
   public class EnumTypeTransformer : BaseTransformer {
-
     public override void InjectData(IItem item, Component data) =>
       item.Cast<dynamic>().Value = Enum.Parse(
Index: /branches/3026_IntegrationIntoSymSpace/HeuristicLab.Manufacture/TypeTransformer/MultiCheckedOperatorTransformer.cs
===================================================================
--- /branches/3026_IntegrationIntoSymSpace/HeuristicLab.Manufacture/TypeTransformer/MultiCheckedOperatorTransformer.cs	(revision 17279)
+++ /branches/3026_IntegrationIntoSymSpace/HeuristicLab.Manufacture/TypeTransformer/MultiCheckedOperatorTransformer.cs	(revision 17280)
@@ -10,7 +10,12 @@
     public override Component ExtractData(IItem value) {
       Component data = base.ExtractData(value);
+
       data.Default = value.GetType().Name;
-
       data.Operators = new List<Component>();
+      /*
+      if (data.ParameterizedItems == null)
+        data.ParameterizedItems = new List<Component>();
+      data.ParameterizedItems.Add(data);
+      */
       dynamic val = value.Cast<dynamic>();
       foreach (var op in val.Operators) {
@@ -18,5 +23,6 @@
           Name = op.Name,
           Default = val.Operators.ItemChecked(op),
-          Range = new object[] { false, true }
+          Range = new object[] { false, true },
+          Path = data.Path + "." + op.Name
         });
       }
Index: /branches/3026_IntegrationIntoSymSpace/HeuristicLab.Manufacture/TypeTransformer/ValueTypeValueTransformer.cs
===================================================================
--- /branches/3026_IntegrationIntoSymSpace/HeuristicLab.Manufacture/TypeTransformer/ValueTypeValueTransformer.cs	(revision 17279)
+++ /branches/3026_IntegrationIntoSymSpace/HeuristicLab.Manufacture/TypeTransformer/ValueTypeValueTransformer.cs	(revision 17280)
@@ -18,5 +18,5 @@
       new Component() {
         Default = value.Cast<ValueType>().Value,
-        Range = new object[] { default(T), GetMaxValue() }
+        Range = new object[] { GetMinValue(), GetMaxValue() }
       };
 
@@ -43,4 +43,26 @@
       }
     }
+
+    private object GetMinValue() {
+      TypeCode typeCode = Type.GetTypeCode(typeof(T));
+
+      if (typeof(ValueType).IsEqualTo(typeof(PercentValue)))
+        return 0.0d;
+
+      switch (typeCode) {
+        case TypeCode.Int16: return Int16.MinValue;
+        case TypeCode.Int32: return Int32.MinValue;
+        case TypeCode.Int64: return Int64.MinValue;
+        case TypeCode.UInt16: return UInt16.MinValue;
+        case TypeCode.UInt32: return UInt32.MinValue;
+        case TypeCode.UInt64: return UInt64.MinValue;
+        case TypeCode.Single: return Single.MinValue;
+        case TypeCode.Double: return Double.MinValue;
+        case TypeCode.Decimal: return Decimal.MinValue;
+        case TypeCode.Byte: return Byte.MinValue;
+        case TypeCode.Boolean: return false;
+        default: return default(T);
+      }
+    }
     #endregion
   }
