Index: /branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface.App/Runner.cs
===================================================================
--- /branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface.App/Runner.cs	(revision 17348)
+++ /branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface.App/Runner.cs	(revision 17349)
@@ -11,6 +11,5 @@
   internal static class Runner {
     internal static void Run(string template, string config, string outputFile = @"C:\Workspace\test.txt") {
-      JCInstantiator instantiator = new JCInstantiator();
-      IAlgorithm alg = instantiator.Instantiate(template, config);
+      IAlgorithm alg = JCInstantiator.Instantiate(template, config);
   
       Task task = alg.StartAsync();
Index: /branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface.OptimizerIntegration/FileManager.cs
===================================================================
--- /branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface.OptimizerIntegration/FileManager.cs	(revision 17348)
+++ /branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface.OptimizerIntegration/FileManager.cs	(revision 17349)
@@ -43,7 +43,6 @@
 
         if (saveFileDialog.ShowDialog() == DialogResult.OK) {
-          JCGenerator gen = new JCGenerator();
           IAlgorithm alg = namedItem as IAlgorithm;
-          File.WriteAllText(saveFileDialog.FileName, gen.GenerateTemplate(alg));
+          File.WriteAllText(saveFileDialog.FileName, JCGenerator.GenerateTemplate(alg));
         }
       }
@@ -62,7 +61,6 @@
 
       if (openFileDialog.ShowDialog() == DialogResult.OK) {
-        JCInstantiator instantiator = new JCInstantiator();
         try {
-          var content = instantiator.Instantiate(openFileDialog.FileName);
+          var content = JCInstantiator.Instantiate(openFileDialog.FileName);
           IView view = MainFormManager.MainForm.ShowContent(content);
           if (view == null)
Index: /branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface/Attributes/ConvertableAttribute.cs
===================================================================
--- /branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface/Attributes/ConvertableAttribute.cs	(revision 17349)
+++ /branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface/Attributes/ConvertableAttribute.cs	(revision 17349)
@@ -0,0 +1,13 @@
+﻿using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Reflection;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace HeuristicLab.JsonInterface {
+  [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct)]
+  public class ConvertableAttribute : Attribute {
+    public static bool IsConvertable(object obj) => obj.GetType().GetCustomAttribute<ConvertableAttribute>(true) != null;
+  }
+}
Index: /branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface/HeuristicLab.JsonInterface.csproj
===================================================================
--- /branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface/HeuristicLab.JsonInterface.csproj	(revision 17348)
+++ /branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface/HeuristicLab.JsonInterface.csproj	(revision 17349)
@@ -61,4 +61,5 @@
   </ItemGroup>
   <ItemGroup>
+    <Compile Include="Attributes\ConvertableAttribute.cs" />
     <Compile Include="Constants.cs" />
     <Compile Include="Converters\ValueLookupParameterConverter.cs" />
Index: /branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface/JCGenerator.cs
===================================================================
--- /branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface/JCGenerator.cs	(revision 17348)
+++ /branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface/JCGenerator.cs	(revision 17349)
@@ -9,46 +9,62 @@
 
 namespace HeuristicLab.JsonInterface {
-  public class JCGenerator {
-    private JObject template = JObject.Parse(Constants.Template);
-    private Dictionary<string, string> TypeList = new Dictionary<string, string>();
-    private JArray JsonItems { get; set; } = new JArray();
+  public static class JCGenerator {
 
-    public string GenerateTemplate(IAlgorithm algorithm) {
-      JsonItems.Clear();
-      TypeList.Clear();
+    private struct GenData {
+      public JObject Template { get; set; }
+      public IDictionary<string, string> TypeList { get; set; }
+      public JArray JsonItems { get; set; }
+    }
+
+
+    public static string GenerateTemplate(IAlgorithm algorithm) {
+      // data container
+      GenData genData = new GenData() {
+        Template = JObject.Parse(Constants.Template),
+        TypeList = new Dictionary<string, string>(),
+        JsonItems = new JArray()
+      };
 
       // 1.1. extract JsonItem, save the name in the metadata section of the 
       // template and save it an JArray incl. all parameters of the JsonItem, 
       // which have parameters aswell
-      AddInstantiableIItem(Constants.Algorithm, algorithm);
-      if (algorithm.Problem != null) // 1.2. only when an problem exists
-        AddInstantiableIItem(Constants.Problem, algorithm.Problem);
+      AddInstantiableIItem(Constants.Algorithm, algorithm, genData);
+      IsConvertable(algorithm, true);
+      if (algorithm.Problem != null && IsConvertable(algorithm.Problem, true)) // 1.2. only when an problem exists
+        AddInstantiableIItem(Constants.Problem, algorithm.Problem, genData);
 
       // 2. save the JArray with JsonItems (= IParameterizedItems)
-      template[Constants.Objects] = JsonItems;
+      genData.Template[Constants.Objects] = genData.JsonItems;
       // 3. save the types of the JsonItems (for instatiation)
-      template[Constants.Types] = JObject.FromObject(TypeList);
+      genData.Template[Constants.Types] = JObject.FromObject(genData.TypeList);
       // 4. serialize template and return string
-      return CustomJsonWriter.Serialize(template);
+      return CustomJsonWriter.Serialize(genData.Template);
+    }
+    
+    #region Helper
+    private static bool IsConvertable(object obj, bool throwException) {
+      bool tmp = ConvertableAttribute.IsConvertable(obj);
+      if (throwException && tmp)
+        throw new NotSupportedException($"Type {obj.GetType().Name} is not convertable!");
+      return tmp;
+    }
+    private static void AddInstantiableIItem(string metaDataTagName, IItem item, GenData genData) {
+      JsonItem jsonItem = JsonItemConverter.Extract(item);
+      genData.Template[Constants.Metadata][metaDataTagName] = item.ItemName;
+      PopulateJsonItems(jsonItem, genData);
     }
 
-    #region Helper
-    private void AddInstantiableIItem(string metaDataTagName, IItem item) {
-      JsonItem jsonItem = JsonItemConverter.Extract(item);
-      template[Constants.Metadata][metaDataTagName] = item.ItemName;
-      PopulateJsonItems(jsonItem);
-    }
-
-    private void PopulateJsonItems(JsonItem item) {
+    // serializes ParameterizedItems and saves them in list "JsonItems".
+    private static void PopulateJsonItems(JsonItem item, GenData genData) {
       if (item.Parameters != null) {
         if (item.Range == null)
-          JsonItems.Add(Serialize(item));
+          genData.JsonItems.Add(Serialize(item, genData));
         foreach (var p in item.Parameters)
-          if (p.Parameters != null)
-            PopulateJsonItems(p);
+          if (p.IsParameterizedItem)
+            PopulateJsonItems(p, genData);
       }
     }
 
-    private JObject Serialize(JsonItem item) {
+    private static JObject Serialize(JsonItem item, GenData genData) {
       JObject obj = JObject.FromObject(item, Settings());
       obj[Constants.StaticParameters] = obj[nameof(JsonItem.Parameters)];
@@ -62,9 +78,10 @@
       obj.Property(nameof(JsonItem.Type))?.Remove();
 
-      TypeList.Add(item.Path, item.Type);
+      genData.TypeList.Add(item.Path, item.Type);
       return obj;
     }
 
-    private void RefactorFreeParameters(JToken token) {
+    // deletes unnecessary properties for free parameters.
+    private static void RefactorFreeParameters(JToken token) {
       IList<JObject> objToRemove = new List<JObject>();
       TransformNodes(x => {
@@ -80,5 +97,6 @@
     }
 
-    private void RefactorStaticParameters(JToken token) {
+    // deletes unnecessary properties for static parameters.
+    private static void RefactorStaticParameters(JToken token) {
       IList<JObject> objToRemove = new List<JObject>();
       TransformNodes(x => {
@@ -88,10 +106,15 @@
         x.Property(nameof(JsonItem.Parameters))?.Remove();
         x.Property(nameof(JsonItem.Type))?.Remove();
-        if (p.Value == null) objToRemove.Add(x);
+        //TODO: maybe allow JsonItems with Value==null in static parameters too?
+        if (p.Value == null) objToRemove.Add(x); 
       }, token[Constants.StaticParameters]);
       foreach (var x in objToRemove) x.Remove();
     }
 
-    private JsonSerializer Settings() => new JsonSerializer() {
+    /// <summary>
+    /// Settings for the json serialization.
+    /// </summary>
+    /// <returns>A configured JsonSerializer.</returns>
+    private static JsonSerializer Settings() => new JsonSerializer() {
       TypeNameHandling = TypeNameHandling.None,
       NullValueHandling = NullValueHandling.Ignore,
@@ -99,5 +122,5 @@
     };
 
-    private void TransformNodes(Action<JObject> action, params JToken[] tokens) {
+    private static void TransformNodes(Action<JObject> action, params JToken[] tokens) {
       foreach(JObject obj in tokens.SelectMany(x => x.Children<JObject>()))
         action(obj);
Index: /branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface/JCInstantiator.cs
===================================================================
--- /branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface/JCInstantiator.cs	(revision 17348)
+++ /branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface/JCInstantiator.cs	(revision 17349)
@@ -14,43 +14,48 @@
 
 namespace HeuristicLab.JsonInterface {
-  public class JCInstantiator {
+  public static class JCInstantiator {
+    private struct InstData {
+      public JToken Template { get; set; }
+      public JArray Config { get; set; }
+      public Dictionary<string, string> TypeList { get; set; }
+      public IDictionary<string, JsonItem> ParameterizedItems { get; set; }
+      public IDictionary<string, JsonItem> ConfigurableItems { get; set; }
+    }
 
-    private JToken Template { get; set; }
-    private JArray Config { get; set; }
-
-    private Dictionary<string, string> TypeList = new Dictionary<string, string>();
-    private IDictionary<string, JsonItem> ParameterizedItems { get; set; } = new Dictionary<string, JsonItem>();
-    private IDictionary<string, JsonItem> ConfigurableItems { get; set; } = new Dictionary<string, JsonItem>();
-    
-    public IAlgorithm Instantiate(string templateFile, string configFile = "") {
+    public static IAlgorithm Instantiate(string templateFile, string configFile = "") {
+      InstData instData = new InstData() {
+        TypeList = new Dictionary<string, string>(),
+        ParameterizedItems = new Dictionary<string, JsonItem>(),
+        ConfigurableItems = new Dictionary<string, JsonItem>()
+      };
 
       //1. Parse Template and Config files
-      Template = JToken.Parse(File.ReadAllText(templateFile));
+      instData.Template = JToken.Parse(File.ReadAllText(templateFile));
       if(!string.IsNullOrEmpty(configFile))
-        Config = JArray.Parse(File.ReadAllText(configFile));
-      TypeList = Template[Constants.Types].ToObject<Dictionary<string, string>>();
-      string algorithmName = Template[Constants.Metadata][Constants.Algorithm].ToString();
-      string problemName = Template[Constants.Metadata][Constants.Problem].ToString();
+        instData.Config = JArray.Parse(File.ReadAllText(configFile));
+      instData.TypeList = instData.Template[Constants.Types].ToObject<Dictionary<string, string>>();
+      string algorithmName = instData.Template[Constants.Metadata][Constants.Algorithm].ToString();
+      string problemName = instData.Template[Constants.Metadata][Constants.Problem].ToString();
 
       //2. Collect all parameterizedItems from template
-      CollectParameterizedItems();
+      CollectParameterizedItems(instData);
 
       //3. select all ConfigurableItems
-      SelectConfigurableItems();
+      SelectConfigurableItems(instData);
 
       //4. if config != null -> merge Template and Config 
-      if (Config != null)
-        MergeTemplateWithConfig();
+      if (instData.Config != null)
+        MergeTemplateWithConfig(instData);
 
       //5. resolve the references between parameterizedItems
-      ResolveReferences();
+      ResolveReferences(instData);
 
       //6. get algorthm data and object
-      JsonItem algorithmData = GetData(algorithmName);
-      IAlgorithm algorithm = CreateObject<IAlgorithm>(algorithmData);
+      JsonItem algorithmData = GetData(algorithmName, instData);
+      IAlgorithm algorithm = CreateObject<IAlgorithm>(algorithmData, instData);
 
       //7. get problem data and object
-      JsonItem problemData = GetData(problemName);
-      IProblem problem = CreateObject<IProblem>(problemData);
+      JsonItem problemData = GetData(problemName, instData);
+      IProblem problem = CreateObject<IProblem>(problemData, instData);
       algorithm.Problem = problem;
 
@@ -59,4 +64,5 @@
       JsonItemConverter.Inject(problem, problemData);
 
+      // TODO: let the engine be configurable
       if (algorithm is EngineAlgorithm)
         algorithm.Cast<EngineAlgorithm>().Engine = new SequentialEngine.SequentialEngine();
@@ -65,29 +71,30 @@
     }
 
-    private void CollectParameterizedItems() {
-      foreach (JObject item in Template[Constants.Objects]) {
-        JsonItem data = BuildJsonItem(item);
-        ParameterizedItems.Add(data.Path, data);
+    #region Helper
+    private static void CollectParameterizedItems(InstData instData) {
+      foreach (JObject item in instData.Template[Constants.Objects]) {
+        JsonItem data = BuildJsonItem(item, instData);
+        instData.ParameterizedItems.Add(data.Path, data);
       }
     }
 
-    private void SelectConfigurableItems() {
-      foreach (var item in ParameterizedItems.Values) {
+    private static void SelectConfigurableItems(InstData instData) {
+      foreach (var item in instData.ParameterizedItems.Values) {
         if (item.Parameters != null)
-          AddConfigurableItems(item.Parameters);
+          AddConfigurableItems(item.Parameters, instData);
 
         if (item.Operators != null)
-          AddConfigurableItems(item.Operators);
+          AddConfigurableItems(item.Operators, instData);
       }
     }
 
-    private void AddConfigurableItems(IEnumerable<JsonItem> items) {
+    private static void AddConfigurableItems(IEnumerable<JsonItem> items, InstData instData) {
       foreach (var item in items)
         if (item.IsConfigurable)
-          ConfigurableItems.Add(item.Path, item);
+          instData.ConfigurableItems.Add(item.Path, item);
     }
 
-    private void ResolveReferences() {
-      foreach(var x in ParameterizedItems.Values)
+    private static void ResolveReferences(InstData instData) {
+      foreach(var x in instData.ParameterizedItems.Values)
         foreach (var p in x.Parameters)
           if (p.Value is string) {
@@ -96,15 +103,15 @@
               key = $"{p.Path}.{p.Value.Cast<string>()}";
 
-            if (ParameterizedItems.TryGetValue(key, out JsonItem value))
+            if (instData.ParameterizedItems.TryGetValue(key, out JsonItem value))
               p.Reference = value;
           }
     }
 
-    private void MergeTemplateWithConfig() {
-      foreach (JObject obj in Config) {
+    private static void MergeTemplateWithConfig(InstData instData) {
+      foreach (JObject obj in instData.Config) {
         // build item from config object
-        JsonItem item = BuildJsonItem(obj);
+        JsonItem item = BuildJsonItem(obj, instData);
         // override default value
-        if (ConfigurableItems.TryGetValue(item.Path, out JsonItem param)) {
+        if (instData.ConfigurableItems.TryGetValue(item.Path, out JsonItem param)) {
           param.Value = item.Value;
           // override ActualName (for LookupParameters)
@@ -115,7 +122,7 @@
     }
 
-    private JsonItem GetData(string key)
+    private static JsonItem GetData(string key, InstData instData)
     {
-      if (ParameterizedItems.TryGetValue(key, out JsonItem value))
+      if (instData.ParameterizedItems.TryGetValue(key, out JsonItem value))
         return value;
       else
@@ -123,6 +130,6 @@
     }
 
-    private T CreateObject<T>(JsonItem data) {
-      if (TypeList.TryGetValue(data.Name, out string typeName)) {
+    private static T CreateObject<T>(JsonItem data, InstData instData) {
+      if (instData.TypeList.TryGetValue(data.Name, out string typeName)) {
         Type type = Type.GetType(typeName);
         return (T)Activator.CreateInstance(type);
@@ -131,5 +138,5 @@
 
     #region BuildJsonItemMethods
-    private JsonItem BuildJsonItem(JObject obj) =>
+    private static JsonItem BuildJsonItem(JObject obj, InstData instData) =>
       new JsonItem() {
         Name = obj[nameof(JsonItem.Name)]?.ToString(),
@@ -137,18 +144,18 @@
         Value = obj[nameof(JsonItem.Value)]?.ToObject<object>(),
         Range = obj[nameof(JsonItem.Range)]?.ToObject<object[]>(),
-        Type = GetType(obj[nameof(JsonItem.Path)]?.ToObject<string>()),
+        Type = GetType(obj[nameof(JsonItem.Path)]?.ToObject<string>(), instData),
         ActualName = obj[nameof(JsonItem.ActualName)]?.ToString(),
-        Parameters = PopulateParameters(obj),
-        Operators = PopulateOperators(obj)
+        Parameters = PopulateParameters(obj, instData),
+        Operators = PopulateOperators(obj, instData)
       };
 
-    private string GetType(string path) {
+    private static string GetType(string path, InstData instData) {
       if(!string.IsNullOrEmpty(path))
-        if (TypeList.TryGetValue(path, out string value))
+        if (instData.TypeList.TryGetValue(path, out string value))
           return value;
       return null;
     }
 
-    private IList<JsonItem> PopulateParameters(JObject obj) {
+    private static IList<JsonItem> PopulateParameters(JObject obj, InstData instData) {
       IList<JsonItem> list = new List<JsonItem>();
 
@@ -156,10 +163,10 @@
       if (obj[Constants.StaticParameters] != null)
         foreach (JObject param in obj[Constants.StaticParameters])
-          list.Add(BuildJsonItem(param));
+          list.Add(BuildJsonItem(param, instData));
 
       // merge staticParameter with freeParameter
       if (obj[Constants.FreeParameters] != null) {
         foreach (JObject param in obj[Constants.FreeParameters]) {
-          JsonItem tmp = BuildJsonItem(param);
+          JsonItem tmp = BuildJsonItem(param, instData);
           
           // search staticParameter from list
@@ -176,13 +183,14 @@
     }
 
-    private IList<JsonItem> PopulateOperators(JObject obj) {
+    private static IList<JsonItem> PopulateOperators(JObject obj, InstData instData) {
       IList<JsonItem> list = new List<JsonItem>();
       JToken operators = obj[nameof(JsonItem.Operators)];
       if (operators != null)
         foreach (JObject sp in operators)
-          list.Add(BuildJsonItem(sp));
+          list.Add(BuildJsonItem(sp, instData));
       return list;
     }
     #endregion
+    #endregion
   }
 }
Index: /branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface/JsonItem.cs
===================================================================
--- /branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface/JsonItem.cs	(revision 17348)
+++ /branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface/JsonItem.cs	(revision 17349)
@@ -10,6 +10,11 @@
 namespace HeuristicLab.JsonInterface {
   public class JsonItem {
+
+    #region Private Fields
+    private string name;
+    private object value;
+    private IList<object> range;
+    #endregion
     
-    private string name;
     public string Name { 
       get => name; 
@@ -24,27 +29,21 @@
     public IList<JsonItem> Parameters { get; set; }
     public IList<JsonItem> Operators { get; set; }
-
-    private object value;
     public object Value {
       get => value; 
       set {
         this.value = value;
-        if(Range != null && value != null && !FulfillConstraints())
-          throw new ArgumentOutOfRangeException("Default", "Default is not in range.");
+        CheckConstraints();
       } 
     }
-
-    private IList<object> range;
     public IList<object> Range { 
       get => range; 
       set {
         range = value;
-        if (Value != null && value != null && !FulfillConstraints())
-          throw new ArgumentOutOfRangeException("Default", "Default is not in range.");
+        CheckConstraints();
       } 
     }
-    
     public string ActualName { get; set; }
 
+    #region JsonIgnore Properties
     [JsonIgnore]
     public JsonItem Reference { get; set; }
@@ -53,4 +52,9 @@
     public bool IsConfigurable => (Value != null && Range != null);
 
+    [JsonIgnore]
+    public bool IsParameterizedItem => Parameters != null;
+    #endregion
+
+    #region Public Static Methods
     public static void Merge(JsonItem target, JsonItem from) {
       target.Name = from.Name ?? target.Name;
@@ -64,17 +68,7 @@
       target.Operators = from.Operators ?? target.Operators;
     }
+    #endregion
 
-    public bool FulfillConstraints() => FulfillConstraints(this);
-
-    public static bool FulfillConstraints(JsonItem data) =>
-      data.Range != null && data.Value != null && (
-      IsInRangeList(data.Range, data.Value) ||
-      IsInNumericRange<long>(data.Value, data.Range[0], data.Range[1]) ||
-      IsInNumericRange<int>(data.Value, data.Range[0], data.Range[1]) ||
-      IsInNumericRange<short>(data.Value, data.Range[0], data.Range[1]) ||
-      IsInNumericRange<byte>(data.Value, data.Range[0], data.Range[1]) ||
-      IsInNumericRange<float>(data.Value, data.Range[0], data.Range[1]) ||
-      IsInNumericRange<double>(data.Value, data.Range[0], data.Range[1]));
-
+    #region Public Methods
     public void UpdatePath() {
       if (Parameters != null)
@@ -87,4 +81,5 @@
         UpdatePathHelper(Reference);
     }
+    #endregion
 
     #region Helper
@@ -99,14 +94,33 @@
     }
 
-    private static bool IsInRangeList(IEnumerable<object> list, object value) {
-      foreach (var x in list)
-        if (x.Equals(value)) return true;
+    private void CheckConstraints() {
+      if (Range != null && Value != null && !IsInRange())
+        throw new ArgumentOutOfRangeException("Default", "Default is not in range.");
+    }
+
+
+    private bool IsInRange() => IsInRangeList() || IsInNumericRange();
+
+    private bool IsInRangeList() {
+      foreach (var x in Range)
+        if (x.Equals(Value)) return true;
       return false;
     }
 
-    private static bool IsInNumericRange<T>(object value, object min, object max) where T : IComparable =>
-      (value != null && min != null && max != null && value is T && min is T && max is T &&
-        (((T)min).CompareTo(value) == -1 || ((T)min).CompareTo(value) == 0) &&
-        (((T)max).CompareTo(value) == 1 || ((T)max).CompareTo(value) == 0));
+    private bool IsInNumericRange() =>
+      IsInNumericRange<long>()
+      || IsInNumericRange<int>()
+      || IsInNumericRange<short>()
+      || IsInNumericRange<byte>()
+      || IsInNumericRange<float>()
+      || IsInNumericRange<double>();
+
+    private bool IsInNumericRange<T>() where T : IComparable {
+      object value = Value, min = Range[0], max = Range[1];
+      return value != null && min != null && max != null && value is T && min is T && max is T &&
+            (((T)min).CompareTo(value) == -1 || ((T)min).CompareTo(value) == 0) &&
+            (((T)max).CompareTo(value) == 1 || ((T)max).CompareTo(value) == 0);
+    }
+      
     #endregion
   }
