Moved Model Name and Predictor Model Name to

Property Configuration
This commit is contained in:
2022-10-09 08:50:48 -07:00
parent a6168f5976
commit d951ad6696
34 changed files with 181 additions and 185 deletions

View File

@ -5,7 +5,6 @@ using System.Text.Json;
using View_by_Distance.Compare.Models;
using View_by_Distance.Property.Models;
using View_by_Distance.Shared.Models.Methods;
using View_by_Distance.Shared.Models.Stateless;
using WindowsShortcutFactory;
namespace View_by_Distance.Compare;
@ -50,16 +49,14 @@ public class Compare
Property.Models.Configuration.Verify(propertyConfiguration, requireExist: true);
Models.Configuration configuration = Models.Stateless.Configuration.Get(isEnvironment, configurationRoot, workingDirectory, propertyConfiguration);
Verify(configuration);
Model? model = null;
bool reverse = false;
string outputExtension = ".jpg";
PredictorModel? predictorModel = null;
string eResultsFullGroupDirectory = string.Empty;
string a2PeopleSingletonDirectory = string.Empty;
Map.Models.Configuration? mapConfiguration = null;
Shared.Models.PersonContainer[] personContainers = Array.Empty<Shared.Models.PersonContainer>();
Map.Models.MapLogic mapLogic = new(_AppSettings.MaxDegreeOfParallelism, propertyConfiguration, mapConfiguration, ticks, personContainers, a2PeopleSingletonDirectory, eResultsFullGroupDirectory);
A_Property propertyLogic = GetPropertyLogic(reverse, model, outputExtension, predictorModel, mapLogic);
A_Property propertyLogic = GetPropertyLogic(reverse, outputExtension, mapLogic);
foreach (string spelling in configuration.Spelling)
{
segments = spelling.Split('|');
@ -207,7 +204,7 @@ public class Compare
_Log.Information(". . .");
}
string aPropertyContentCollectionDirectory = Property.Models.Stateless.IResult.GetResultsDateGroupDirectory(propertyConfiguration, nameof(A_Property), "[()]");
ThirdPassToMove(propertyConfiguration, model, predictorModel, mapLogic, propertyLogic, containers, aPropertyContentCollectionDirectory);
ThirdPassToMove(propertyConfiguration, mapLogic, propertyLogic, containers, aPropertyContentCollectionDirectory);
if (!isSilent)
{
_Log.Information("Third pass completed");
@ -219,7 +216,7 @@ public class Compare
}
_Log.Information(". . .");
}
FourthPassCreateWindowsShortcuts(propertyConfiguration, model, predictorModel, mapLogic, propertyLogic, containers, saveToCollection: false, keepAll: false);
FourthPassCreateWindowsShortcuts(propertyConfiguration, mapLogic, propertyLogic, containers, saveToCollection: false, keepAll: false);
if (!isSilent)
{
_Log.Information("Fourth pass completed");
@ -388,12 +385,12 @@ public class Compare
return result;
}
private A_Property GetPropertyLogic(bool reverse, Model? model, string outputExtension, PredictorModel? predictorModel, Map.Models.MapLogic mapLogic)
private A_Property GetPropertyLogic(bool reverse, string outputExtension, Map.Models.MapLogic mapLogic)
{
A_Property result;
if (_Configuration?.PropertyConfiguration is null)
throw new NullReferenceException(nameof(_Configuration.PropertyConfiguration));
result = new(_AppSettings.MaxDegreeOfParallelism, _Configuration.PropertyConfiguration, outputExtension, reverse, model, predictorModel);
result = new(_AppSettings.MaxDegreeOfParallelism, _Configuration.PropertyConfiguration, outputExtension, reverse);
string fromPrepareForOld = "34720-637858334555170379.tsv";
string fromPrepareForOldFile = Path.Combine(_Configuration.PropertyConfiguration.RootDirectory, fromPrepareForOld);
if (File.Exists(fromPrepareForOldFile))
@ -746,7 +743,7 @@ public class Compare
}
}
private void ThirdPassToMove(Property.Models.Configuration configuration, Model? model, PredictorModel? predictorModel, Map.Models.MapLogic mapLogic, A_Property propertyLogic, Shared.Models.Container[] containers, string aPropertyContentCollectionDirectory)
private void ThirdPassToMove(Property.Models.Configuration configuration, Map.Models.MapLogic mapLogic, A_Property propertyLogic, Shared.Models.Container[] containers, string aPropertyContentCollectionDirectory)
{
if (_Log is null)
throw new NullReferenceException(nameof(_Log));
@ -824,7 +821,7 @@ public class Compare
}
}
private void FourthPassCreateWindowsShortcuts(Property.Models.Configuration configuration, Model? model, PredictorModel? predictorModel, Map.Models.MapLogic mapLogic, A_Property propertyLogic, Shared.Models.Container[] containers, bool saveToCollection, bool keepAll)
private void FourthPassCreateWindowsShortcuts(Property.Models.Configuration configuration, Map.Models.MapLogic mapLogic, A_Property propertyLogic, Shared.Models.Container[] containers, bool saveToCollection, bool keepAll)
{
if (_Log is null)
throw new NullReferenceException(nameof(_Log));

View File

@ -6,7 +6,7 @@ namespace View_by_Distance.Compare.Models.Binder;
public class Configuration
{
[Display(Name = "Diff Property Directory"), Required] public string DiffPropertyDirectory { get; set; }
[Display(Name = "Property Configuration"), Required] public Property.Models.Configuration? PropertyConfiguration { get; set; }
[Display(Name = "Property Configuration"), Required] public Property.Models.Configuration PropertyConfiguration { get; set; }
[Display(Name = "Rename"), Required] public string[] Rename { get; set; }
[Display(Name = "Rename B"), Required] public string[] RenameB { get; set; }
[Display(Name = "Rename C"), Required] public string[] RenameC { get; set; }

View File

@ -7,20 +7,20 @@ public class Configuration
{
protected readonly string _DiffPropertyDirectory;
protected Property.Models.Configuration? _PropertyConfiguration;
protected Property.Models.Configuration _PropertyConfiguration;
protected readonly string[] _Rename;
protected readonly string[] _RenameB;
protected readonly string[] _RenameC;
protected readonly string[] _Spelling;
public string DiffPropertyDirectory => _DiffPropertyDirectory;
public Property.Models.Configuration? PropertyConfiguration => _PropertyConfiguration;
public Property.Models.Configuration PropertyConfiguration => _PropertyConfiguration;
public string[] Rename => _Rename;
public string[] RenameB => _RenameB;
public string[] RenameC => _RenameC;
public string[] Spelling => _Spelling;
[JsonConstructor]
public Configuration(string diffPropertyDirectory, Property.Models.Configuration? propertyConfiguration, string[] rename, string[] renameB, string[] renameC, string[] spelling)
public Configuration(string diffPropertyDirectory, Property.Models.Configuration propertyConfiguration, string[] rename, string[] renameB, string[] renameC, string[] spelling)
{
_DiffPropertyDirectory = diffPropertyDirectory;
_PropertyConfiguration = propertyConfiguration;
@ -36,8 +36,10 @@ public class Configuration
return result;
}
public void Set(Property.Models.Configuration configuration) => _PropertyConfiguration = configuration;
public void Update() => _PropertyConfiguration?.Update();
public void SetAndUpdate(Property.Models.Configuration configuration, int? numberOfJitters, int? numberOfTimesToUpsample, string? modelName, string? predictorModelName)
{
_PropertyConfiguration = configuration;
_PropertyConfiguration.Update(numberOfJitters, numberOfTimesToUpsample, modelName, predictorModelName);
}
}

View File

@ -19,8 +19,7 @@ public abstract class Configuration
if (result is null)
throw new Exception(json);
string jsonThis = result.ToString();
result.Set(propertyConfiguration);
result.Update();
result.SetAndUpdate(propertyConfiguration, null, null, null, null);
if (jsonThis != json)
{
int? check = null;