Switch to PredictorModel from string

This commit is contained in:
2022-07-30 17:26:32 -07:00
parent 2ebec0b7a9
commit b3f79bd143
15 changed files with 106 additions and 96 deletions

View File

@ -5,6 +5,7 @@ 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;
@ -52,8 +53,8 @@ public class Compare
Models.Configuration configuration = Models.Stateless.Configuration.Get(isEnvironment, configurationRoot, workingDirectory, propertyConfiguration);
Verify(configuration);
bool reverse = false;
string modelName = nameof(modelName);
string predictorModelName = nameof(predictorModelName);
Model model = Model.Hog;
PredictorModel predictorModel = PredictorModel.Large;
if (propertyConfiguration.PopulatePropertyId is null)
throw new Exception($"{nameof(propertyConfiguration.PopulatePropertyId)} is null!");
foreach (string spelling in configuration.Spelling)
@ -162,7 +163,7 @@ public class Compare
PropertyLogic propertyLogic = GetPropertyLogic();
if (_IsEnvironment.Development && propertyConfiguration.PopulatePropertyId.Value && !propertyLogic.KeyValuePairs.Any())
throw new Exception("Copy keyValuePairs-####.json file");
List<PropertyHolder[]> propertyHolderCollections = Property.Models.Stateless.A_Property.Get(propertyConfiguration, reverse, modelName, predictorModelName, propertyLogic);
List<PropertyHolder[]> propertyHolderCollections = Property.Models.Stateless.A_Property.Get(propertyConfiguration, reverse, model, predictorModel, propertyLogic);
if (!isSilent)
{
_Log.Information("First pass completed");
@ -204,7 +205,7 @@ public class Compare
_Log.Information(". . .");
}
string aPropertyContentCollectionDirectory = Property.Models.Stateless.IResult.GetResultsDateGroupDirectory(propertyConfiguration, nameof(A_Property), "[()]");
ThirdPassToMove(propertyConfiguration, modelName, predictorModelName, propertyLogic, propertyHolderCollections, aPropertyContentCollectionDirectory);
ThirdPassToMove(propertyConfiguration, model, predictorModel, propertyLogic, propertyHolderCollections, aPropertyContentCollectionDirectory);
if (!isSilent)
{
_Log.Information("Third pass completed");
@ -216,7 +217,7 @@ public class Compare
}
_Log.Information(". . .");
}
FourthPassCreateWindowsShortcuts(propertyConfiguration, modelName, predictorModelName, propertyLogic, propertyHolderCollections, saveToCollection: false, keepAll: false);
FourthPassCreateWindowsShortcuts(propertyConfiguration, model, predictorModel, propertyLogic, propertyHolderCollections, saveToCollection: false, keepAll: false);
if (!isSilent)
{
_Log.Information("Fourth pass completed");
@ -749,7 +750,7 @@ public class Compare
}
}
private void ThirdPassToMove(Property.Models.Configuration configuration, string modelName, string predictorModelName, PropertyLogic propertyLogic, List<PropertyHolder[]> propertyHolderCollections, string aPropertyContentCollectionDirectory)
private void ThirdPassToMove(Property.Models.Configuration configuration, Model model, PredictorModel predictorModel, PropertyLogic propertyLogic, List<PropertyHolder[]> propertyHolderCollections, string aPropertyContentCollectionDirectory)
{
if (_Log is null)
throw new Exception($"{nameof(_Log)} is null!");
@ -768,7 +769,7 @@ public class Compare
List<string> distinctDirectories = new();
List<KeyValuePair<int, int[]>> valueCollection = new();
List<Property.Models.DirectoryInfo> directoryInfoCollection = new();
propertyLogic.ParallelWork(configuration, modelName, predictorModelName, ticks, propertyHolderCollections, firstPass: false);
propertyLogic.ParallelWork(configuration, model, predictorModel, ticks, propertyHolderCollections, firstPass: false);
if (propertyLogic.ExceptionsDirectories.Any())
throw new Exception();
foreach (Property.Models.DirectoryInfo group in directoryInfoCollection)
@ -827,7 +828,7 @@ public class Compare
}
}
private void FourthPassCreateWindowsShortcuts(Property.Models.Configuration configuration, string modelName, string predictorModelName, PropertyLogic propertyLogic, List<PropertyHolder[]> propertyHolderCollections, bool saveToCollection, bool keepAll)
private void FourthPassCreateWindowsShortcuts(Property.Models.Configuration configuration, Model model, PredictorModel predictorModel, PropertyLogic propertyLogic, List<PropertyHolder[]> propertyHolderCollections, bool saveToCollection, bool keepAll)
{
if (_Log is null)
throw new Exception($"{nameof(_Log)} is null!");
@ -840,7 +841,7 @@ public class Compare
List<KeyValuePair<int, int[]>> valueCollection = new();
(long Ticks, string FilteredSourceDirectoryFile, string PropertyDirectory, int PropertyId)[] collection;
List<Property.Models.DirectoryInfo> directoryInfoCollection = new();
propertyLogic.ParallelWork(configuration, modelName, predictorModelName, ticks, propertyHolderCollections, firstPass: false);
propertyLogic.ParallelWork(configuration, model, predictorModel, ticks, propertyHolderCollections, firstPass: false);
if (propertyLogic.ExceptionsDirectories.Any())
throw new Exception();
foreach (Property.Models.DirectoryInfo group in directoryInfoCollection)
@ -858,7 +859,7 @@ public class Compare
fileMoveCollection.Add(filteredSourceDirectoryFile);
}
}
collection = propertyLogic.GetPropertyIds(configuration, modelName, predictorModelName, directoryInfoCollection, saveToCollection);
collection = propertyLogic.GetPropertyIds(configuration, model, predictorModel, directoryInfoCollection, saveToCollection);
_Log.Information($"{stay} file(s) are staying and {fileMoveCollection.Count} file(s) will be moved");
for (int x = 0; x < int.MaxValue; x++)
{