From 06595f57ee67ff1f2f2f34d3ce9b0534fe888be7 Mon Sep 17 00:00:00 2001 From: Ivan Ribakov Date: Wed, 4 Apr 2018 13:16:07 +0200 Subject: [PATCH] Revert "Custom tutor config that can be created from an existing config object and override certain fields" This reverts commit 2d1e412852d27c666e9f5bf605c9d30c24edbc4d. --- Utils/Its.Utils.Config/CustomTutorConfig.cs | 191 ------------------ Utils/Its.Utils.Config/DefaultTutorConfig.cs | 125 +++++------- Utils/Its.Utils.Config/ITutorConfig.cs | 1 + .../Its.Utils.Config/Its.Utils.Config.csproj | 1 - 4 files changed, 52 insertions(+), 266 deletions(-) delete mode 100644 Utils/Its.Utils.Config/CustomTutorConfig.cs diff --git a/Utils/Its.Utils.Config/CustomTutorConfig.cs b/Utils/Its.Utils.Config/CustomTutorConfig.cs deleted file mode 100644 index 41de713..0000000 --- a/Utils/Its.Utils.Config/CustomTutorConfig.cs +++ /dev/null @@ -1,191 +0,0 @@ -using System.Collections.Generic; -using System.Configuration; - -namespace Its.Utils.Config -{ - public class CustomTutorConfig : ITutorConfig - { - private int _initialColumn; - private int _finalColumn; - private int _initialRow; - private string _ontologyPath; - private string _logsPath; - private string _domainConfigurationPath; - private string _worldConfigurationPath; - private int _timePenalization; - private int _noTutoringNoBlockErrorPenalization; - private int _tutoringBlockErrorPenalization; - private int _tutoringNoBlockErrorPenalization; - private string _assConString; - private string _bddConString; - - public int InitialColumn - { - get { return _initialColumn; } - } - public int FinalColumn - { - get { return _finalColumn; } - } - public int InitialRow - { - get { return _initialRow; } - } - public string OntologyPath - { - get { return _ontologyPath; } - } - public string LogsPath - { - get { return _logsPath; } - } - public string DomainConfigurationPath - { - get { return _domainConfigurationPath; } - } - public string WorldConfigurationPath - { - get { return _worldConfigurationPath; } - } - public int TimePenalization - { - get { return _timePenalization; } - } - public int NoTutoringNoBlockErrorPenalization - { - get { return _noTutoringNoBlockErrorPenalization; } - } - public int TutoringBlockErrorPenalization - { - get { return _tutoringBlockErrorPenalization; } - } - public int TutoringNoBlockErrorPenalization - { - get { return _tutoringNoBlockErrorPenalization; } - } - public string ASSConString - { - get { return _assConString; } - } - public string BDDConString - { - get { return _bddConString; } - } - - public CustomTutorConfig(ITutorConfig config) - { - InitFromConfig(config); - } - - public CustomTutorConfig(DefaultTutorConfig config, Dictionary overrideValues) - { - InitFromConfig(config); - InitFromDictionary(overrideValues); - } - - public CustomTutorConfig(Dictionary values) - { - InitFromDictionary(values); - } - - private void InitFromConfig(ITutorConfig config) - { - _initialColumn = config.InitialColumn; - _finalColumn = config.FinalColumn; - _initialRow = config.InitialRow; - _ontologyPath = config.OntologyPath; - _logsPath = config.LogsPath; - _domainConfigurationPath = config.DomainConfigurationPath; - _worldConfigurationPath = config.WorldConfigurationPath; - _timePenalization = config.TimePenalization; - _noTutoringNoBlockErrorPenalization = config.NoTutoringNoBlockErrorPenalization; - _tutoringBlockErrorPenalization = config.TutoringBlockErrorPenalization; - _tutoringNoBlockErrorPenalization = config.TutoringNoBlockErrorPenalization; - _assConString = config.ASSConString; - _bddConString = config.BDDConString; - } - - private void InitFromDictionary(Dictionary values) - { - string initialColumn_; - string finalColumn_; - string initialRow_; - string ontologyPath_; - string logsPath_; - string domainConfigurationPath_; - string worldConfigurationPath_; - string timePenalization_; - string noTutoringNoBlockErrorPenalization_; - string tutoringBlockErrorPenalization_; - string tutoringNoBlockErrorPenalization_; - string assConString_; - string bddConString_; - - if (values.TryGetValue("InitialColumn", out initialColumn_)) - { - _initialColumn = int.Parse(initialColumn_); - } - - if (values.TryGetValue("FinalColumn", out finalColumn_)) - { - _finalColumn = int.Parse(finalColumn_); - } - - if (values.TryGetValue("InitialRow", out initialRow_)) - { - _initialRow = int.Parse(initialRow_); - } - - if (values.TryGetValue("OntologyPath", out ontologyPath_)) - { - _ontologyPath = ontologyPath_; - } - - if (values.TryGetValue("LogsPath", out logsPath_)) - { - _logsPath = logsPath_; - } - - if (values.TryGetValue("DomainConfigurationPath", out domainConfigurationPath_)) - { - _domainConfigurationPath = domainConfigurationPath_; - } - - if (values.TryGetValue("WorldConfigurationPath", out worldConfigurationPath_)) - { - _worldConfigurationPath = worldConfigurationPath_; - } - - if (values.TryGetValue("TimePenalization", out timePenalization_)) - { - _timePenalization = int.Parse(timePenalization_); - } - - if (values.TryGetValue("NoTutoringNoBlockErrorPenalization", - out noTutoringNoBlockErrorPenalization_)) - { - _noTutoringNoBlockErrorPenalization = int.Parse(noTutoringNoBlockErrorPenalization_); - } - - if (values.TryGetValue("TutoringBlockErrorPenalization", out tutoringBlockErrorPenalization_)) - { - _tutoringBlockErrorPenalization = int.Parse(tutoringBlockErrorPenalization_); - } - - if (values.TryGetValue("TutoringNoBlockErrorPenalization", out tutoringNoBlockErrorPenalization_)) - { - _tutoringNoBlockErrorPenalization = int.Parse(tutoringNoBlockErrorPenalization_); - } - - if (values.TryGetValue("ASSConString", out assConString_)) - { - _assConString = assConString_; - } - - if (values.TryGetValue("InitialColumn", out bddConString_)) - { - _bddConString = bddConString_; - } - } - } -} \ No newline at end of file diff --git a/Utils/Its.Utils.Config/DefaultTutorConfig.cs b/Utils/Its.Utils.Config/DefaultTutorConfig.cs index d958e9c..3bb3c23 100644 --- a/Utils/Its.Utils.Config/DefaultTutorConfig.cs +++ b/Utils/Its.Utils.Config/DefaultTutorConfig.cs @@ -1,95 +1,72 @@ -using System.Collections.Generic; -using System.Configuration; +using System.Configuration; namespace Its.Utils.Config { public class DefaultTutorConfig : ITutorConfig { - private int _initialColumn; - private int _finalColumn; - private int _initialRow; - private string _ontologyPath; - private string _logsPath; - private string _domainConfigurationPath; - private string _worldConfigurationPath; - private int _timePenalization; - private int _noTutoringNoBlockErrorPenalization; - private int _tutoringBlockErrorPenalization; - private int _tutoringNoBlockErrorPenalization; - private string _assConString; - private string _bddConString; - - public int InitialColumn - { - get { return _initialColumn; } - } - public int FinalColumn - { - get { return _finalColumn; } + public int InitialColumn + { + get { return int.Parse(ConfigurationManager.AppSettings["initialColumn"]); } } - public int InitialRow - { - get { return _initialRow; } + + public int FinalColumn + { + get { return int.Parse(ConfigurationManager.AppSettings["finalColumn"]); } } - public string OntologyPath - { - get { return _ontologyPath; } + + public int InitialRow + { + get { return int.Parse(ConfigurationManager.AppSettings["initialRow"]); } } - public string LogsPath - { - get { return _logsPath; } + + public string OntologyPath + { + get { return ConfigurationManager.AppSettings["ontologyPath"]; } } - public string DomainConfigurationPath - { - get { return _domainConfigurationPath; } + + public string LogsPath + { + get { return ConfigurationManager.AppSettings["logsPath"]; } } - public string WorldConfigurationPath - { - get { return _worldConfigurationPath; } + + public string DomainConfigurationPath + { + get { return ConfigurationManager.AppSettings["domainConfigurationPath"]; } } - public int TimePenalization - { - get { return _timePenalization; } + + public string WorldConfigurationPath + { + get { return ConfigurationManager.AppSettings["worldConfigurationPath"]; } } - public int NoTutoringNoBlockErrorPenalization - { - get { return _noTutoringNoBlockErrorPenalization; } + + public int TimePenalization + { + get { return int.Parse(ConfigurationManager.AppSettings["TimePenalization"]); } } - public int TutoringBlockErrorPenalization - { - get { return _tutoringBlockErrorPenalization; } + + public int NoTutoringNoBlockErrorPenalization + { + get { return int.Parse(ConfigurationManager.AppSettings["NoTutoringNoBlockErrorPenalization"]); } } - public int TutoringNoBlockErrorPenalization - { - get { return _tutoringNoBlockErrorPenalization; } + + public int TutoringBlockErrorPenalization + { + get { return int.Parse(ConfigurationManager.AppSettings["TutoringBlockErrorPenalization"]); } } - public string ASSConString - { - get { return _assConString; } + + public int TutoringNoBlockErrorPenalization + { + get { return int.Parse(ConfigurationManager.AppSettings["TutoringNoBlockErrorPenalization"]); } } - public string BDDConString - { - get { return _bddConString; } + + public string ASSConString + { + get { return ConfigurationManager.AppSettings["ASSConString"]; } } - - public DefaultTutorConfig() + + public string BDDConString { - _initialColumn = int.Parse(ConfigurationManager.AppSettings["initialColumn"]); - _finalColumn = int.Parse(ConfigurationManager.AppSettings["finalColumn"]); - _initialRow = int.Parse(ConfigurationManager.AppSettings["initialRow"]); - _ontologyPath = ConfigurationManager.AppSettings["ontologyPath"]; - _logsPath = ConfigurationManager.AppSettings["logsPath"]; - _domainConfigurationPath = ConfigurationManager.AppSettings["domainConfigurationPath"]; - _worldConfigurationPath = ConfigurationManager.AppSettings["worldConfigurationPath"]; - _timePenalization = int.Parse(ConfigurationManager.AppSettings["TimePenalization"]); - _noTutoringNoBlockErrorPenalization = - int.Parse(ConfigurationManager.AppSettings["NoTutoringNoBlockErrorPenalization"]); - _tutoringBlockErrorPenalization = - int.Parse(ConfigurationManager.AppSettings["TutoringBlockErrorPenalization"]); - _tutoringNoBlockErrorPenalization = - int.Parse(ConfigurationManager.AppSettings["TutoringNoBlockErrorPenalization"]); - _assConString = ConfigurationManager.AppSettings["ASSConString"]; - _bddConString = ConfigurationManager.AppSettings["BDDConString"]; + get { return ConfigurationManager.AppSettings["BDDConString"]; } } } } \ No newline at end of file diff --git a/Utils/Its.Utils.Config/ITutorConfig.cs b/Utils/Its.Utils.Config/ITutorConfig.cs index f3b37d6..3a6e44a 100644 --- a/Utils/Its.Utils.Config/ITutorConfig.cs +++ b/Utils/Its.Utils.Config/ITutorConfig.cs @@ -9,6 +9,7 @@ public interface ITutorConfig string LogsPath { get; } string DomainConfigurationPath { get; } string WorldConfigurationPath { get; } + int TimePenalization { get; } int NoTutoringNoBlockErrorPenalization { get; } int TutoringBlockErrorPenalization { get; } diff --git a/Utils/Its.Utils.Config/Its.Utils.Config.csproj b/Utils/Its.Utils.Config/Its.Utils.Config.csproj index f8eba56..ab8102a 100644 --- a/Utils/Its.Utils.Config/Its.Utils.Config.csproj +++ b/Utils/Its.Utils.Config/Its.Utils.Config.csproj @@ -40,7 +40,6 @@ -