Error - Don't keep
This commit is contained in:
@ -2,5 +2,5 @@ using System.Drawing;
|
||||
|
||||
namespace View_by_Distance.Shared.Models;
|
||||
|
||||
public record LocationContainer<T>(bool FromDistanceContent, string File, int NormalizedRectangle, IReadOnlyList<T> Directories, Rectangle? Rectangle, Location? Location)
|
||||
public record LocationContainer<T>(bool FromDistanceContent, string File, long PersonKey, int Id, int NormalizedRectangle, IReadOnlyList<T> Directories, Rectangle? Rectangle, Location? Location)
|
||||
{ }
|
@ -7,6 +7,5 @@ public interface ISorting
|
||||
public int DistancePermyriad { init; get; }
|
||||
public int Id { init; get; }
|
||||
public int NormalizedRectangle { init; get; }
|
||||
public int WithinRange { init; get; }
|
||||
|
||||
}
|
@ -11,21 +11,19 @@ public record class Sorting : Properties.ISorting
|
||||
public int Id { init; get; }
|
||||
public int NormalizedRectangle { init; get; }
|
||||
public bool Older { init; get; }
|
||||
public int WithinRange { init; get; }
|
||||
|
||||
[JsonConstructor]
|
||||
public Sorting(int daysDelta, int distancePermyriad, int id, int normalizedRectangle, bool older, int withinRange)
|
||||
public Sorting(int daysDelta, int distancePermyriad, int id, int normalizedRectangle, bool older)
|
||||
{
|
||||
DaysDelta = daysDelta;
|
||||
DistancePermyriad = distancePermyriad;
|
||||
Id = id;
|
||||
NormalizedRectangle = normalizedRectangle;
|
||||
Older = older;
|
||||
WithinRange = withinRange;
|
||||
}
|
||||
|
||||
public Sorting(Mapping mapping) :
|
||||
this(0, 0, mapping.MappingFromItem.Id, mapping.MappingFromLocation.NormalizedRectangle, false, 0)
|
||||
this(0, 0, mapping.MappingFromItem.Id, mapping.MappingFromLocation.NormalizedRectangle, false)
|
||||
{ }
|
||||
|
||||
public override string ToString()
|
||||
|
@ -17,7 +17,7 @@ public record class SortingContainer : Properties.ISortingContainer
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
string result = string.Concat(Mapping.MappingFromItem.Id, '\t', Mapping.MappingFromLocation.NormalizedRectangle, '\t', Sorting.Id, '\t', Sorting.NormalizedRectangle, '\t', Sorting.Older, '\t', Sorting.WithinRange, '\t', Sorting.DistancePermyriad, '\t', Sorting.DaysDelta);
|
||||
string result = string.Concat(Mapping.MappingFromItem.Id, '\t', Mapping.MappingFromLocation.NormalizedRectangle, '\t', Sorting.Id, '\t', Sorting.NormalizedRectangle, '\t', Sorting.Older, '\t', '\t', Sorting.DistancePermyriad, '\t', Sorting.DaysDelta);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -6,11 +6,11 @@ public interface ISorting
|
||||
Models.Sorting[] TestStatic_Sort(List<Models.Sorting> collection) =>
|
||||
Sort(collection);
|
||||
static Models.Sorting[] Sort(List<Models.Sorting> collection) =>
|
||||
(from l in collection orderby l.WithinRange, l.DistancePermyriad, l.DaysDelta select l).ToArray();
|
||||
(from l in collection orderby l.DistancePermyriad, l.DaysDelta select l).ToArray();
|
||||
|
||||
Models.Sorting TestStatic_Get(int faceDistancePermyriad, double rangeDistanceTolerance, Models.FaceDistance faceDistanceEncoding, Models.FaceDistance faceDistanceLength, List<(long lcl, long minimum, long maximum, long ucl)> personKeysRangesCollection) =>
|
||||
Get(faceDistancePermyriad, rangeDistanceTolerance, faceDistanceEncoding, faceDistanceLength, personKeysRangesCollection);
|
||||
static Models.Sorting Get(int faceDistancePermyriad, double rangeDistanceTolerance, Models.FaceDistance faceDistanceEncoding, Models.FaceDistance faceDistanceLength, List<(long lcl, long minimum, long maximum, long ucl)> personKeysRangesCollection) =>
|
||||
Sorting.Get(faceDistancePermyriad, rangeDistanceTolerance, faceDistanceEncoding, faceDistanceLength, personKeysRangesCollection);
|
||||
Models.Sorting TestStatic_Get(int faceDistancePermyriad, double rangeDistanceTolerance, Models.FaceDistance faceDistanceEncoding, Models.FaceDistance faceDistanceLength) =>
|
||||
Get(faceDistancePermyriad, rangeDistanceTolerance, faceDistanceEncoding, faceDistanceLength);
|
||||
static Models.Sorting Get(int faceDistancePermyriad, double rangeDistanceTolerance, Models.FaceDistance faceDistanceEncoding, Models.FaceDistance faceDistanceLength) =>
|
||||
Sorting.Get(faceDistancePermyriad, rangeDistanceTolerance, faceDistanceEncoding, faceDistanceLength);
|
||||
|
||||
}
|
@ -6,6 +6,6 @@ public interface ISortingContainer
|
||||
Models.SortingContainer[] TestStatic_Sort(List<Models.SortingContainer> collection) =>
|
||||
Sort(collection);
|
||||
static Models.SortingContainer[] Sort(List<Models.SortingContainer> collection) =>
|
||||
(from l in collection orderby l.Sorting.WithinRange, l.Sorting.DistancePermyriad, l.Sorting.DaysDelta select l).ToArray();
|
||||
(from l in collection orderby l.Sorting.DistancePermyriad, l.Sorting.DaysDelta select l).ToArray();
|
||||
|
||||
}
|
@ -3,7 +3,7 @@ namespace View_by_Distance.Shared.Models.Stateless.Methods;
|
||||
internal abstract class Sorting
|
||||
{
|
||||
|
||||
internal static Models.Sorting Get(int faceDistancePermyriad, double rangeDistanceTolerance, Models.FaceDistance faceDistanceEncoding, Models.FaceDistance faceDistanceLength, List<(long lcl, long minimum, long maximum, long ucl)> personKeysRangesCollection)
|
||||
internal static Models.Sorting Get(int faceDistancePermyriad, double rangeDistanceTolerance, Models.FaceDistance faceDistanceEncoding, Models.FaceDistance faceDistanceLength)
|
||||
{
|
||||
Models.Sorting result;
|
||||
if (faceDistanceLength.Length is null)
|
||||
@ -12,28 +12,12 @@ internal abstract class Sorting
|
||||
throw new NotSupportedException();
|
||||
if (faceDistanceEncoding.MinimumDateTime is null || faceDistanceLength.MinimumDateTime is null)
|
||||
throw new NotSupportedException();
|
||||
List<int> withinRanges = new();
|
||||
long ticks = faceDistanceEncoding.MinimumDateTime.Value.Ticks;
|
||||
TimeSpan timeSpan = new(faceDistanceLength.MinimumDateTime.Value.Ticks - ticks);
|
||||
bool older = timeSpan.TotalMilliseconds < 0;
|
||||
int daysDelta = (int)Math.Round(Math.Abs(timeSpan.TotalDays), 0);
|
||||
int distancePermyriad = (int)(faceDistanceLength.Length.Value / rangeDistanceTolerance * faceDistancePermyriad);
|
||||
if (!personKeysRangesCollection.Any())
|
||||
withinRanges.Add(0);
|
||||
else
|
||||
{
|
||||
foreach ((long lcl, long minimum, long maximum, long ucl) in personKeysRangesCollection)
|
||||
{
|
||||
if (ticks > minimum && ticks < maximum)
|
||||
withinRanges.Add(0);
|
||||
else if (ticks > lcl && ticks < ucl)
|
||||
withinRanges.Add(1);
|
||||
else
|
||||
withinRanges.Add(2);
|
||||
}
|
||||
}
|
||||
int withinRange = withinRanges.Max();
|
||||
result = new(daysDelta, distancePermyriad, faceDistanceLength.Id, faceDistanceLength.NormalizedRectangle.Value, older, withinRange);
|
||||
result = new(daysDelta, distancePermyriad, faceDistanceLength.Id, faceDistanceLength.NormalizedRectangle.Value, older);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user