List of analyses was added into main window

This commit is contained in:
Evgeny Redikultsev
2024-09-01 13:04:00 +05:00
parent 8c030e2271
commit 2268557672
35 changed files with 656 additions and 130 deletions

View File

@@ -0,0 +1,21 @@
using StructureHelperCommon.Infrastructures.Interfaces;
using StructureHelperCommon.Services;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StructureHelperCommon.Models.Analyses
{
public class AnalysisUpdateStrategy : IUpdateStrategy<IAnalysis>
{
public void Update(IAnalysis targetObject, IAnalysis sourceObject)
{
CheckObject.IsNull(targetObject, sourceObject, "Analysis Properties");
if (ReferenceEquals(targetObject, sourceObject)) { return; }
targetObject.Name = sourceObject.Name;
targetObject.Tags = sourceObject.Tags;
}
}
}

View File

@@ -0,0 +1,16 @@
using StructureHelperCommon.Infrastructures.Interfaces;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StructureHelperCommon.Models.Analyses
{
public interface IAnalysis : ISaveable
{
string Name { get; set; }
string Tags { get; set; }
IVersionProcessor VersionProcessor { get;}
}
}

View File

@@ -0,0 +1,15 @@
using StructureHelperCommon.Infrastructures.Interfaces;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StructureHelperCommon.Models.Analyses
{
public interface IVersion
{
DateTime DateTime { get; }
ISaveable Item { get; set; }
}
}

View File

@@ -0,0 +1,16 @@
using StructureHelperCommon.Infrastructures.Interfaces;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StructureHelperCommon.Models.Analyses
{
public interface IVersionProcessor : ISaveable
{
void AddVersion(ISaveable newItem);
List<IVersion> Versions { get; }
IVersion GetCurrentVersion();
}
}

View File

@@ -0,0 +1,16 @@
using StructureHelperCommon.Infrastructures.Interfaces;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StructureHelperCommon.Models.Analyses
{
public class Version : IVersion
{
public DateTime DateTime { get; set; }
public ISaveable Item { get; set; }
}
}

View File

@@ -0,0 +1,48 @@
using StructureHelperCommon.Infrastructures.Interfaces;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StructureHelperCommon.Models.Analyses
{
public class VersionProcessor : IVersionProcessor
{
public List<IVersion> Versions { get; }
public Guid Id { get; }
public VersionProcessor(Guid id)
{
Id = id;
Versions = new();
}
public VersionProcessor() : this (new Guid())
{
}
private void AddVersion(IVersion version)
{
Versions.Add(version);
}
public void AddVersion(ISaveable newItem)
{
var version = new Version()
{
DateTime = DateTime.Now,
Item = newItem
};
AddVersion(version);
}
public IVersion GetCurrentVersion()
{
return Versions[^1];
}
}
}

View File

@@ -0,0 +1,21 @@
using StructureHelperCommon.Infrastructures.Interfaces;
using StructureHelperCommon.Services;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StructureHelperCommon.Models.Forces.Logics
{
public class HasForceCombinationUpdateStrategy : IUpdateStrategy<IHasForceCombinations>
{
public void Update(IHasForceCombinations targetObject, IHasForceCombinations sourceObject)
{
CheckObject.IsNull(targetObject, sourceObject, "Interface IHasForceCombination");
if (ReferenceEquals(targetObject, sourceObject)) { return; }
targetObject.ForceActions.Clear();
targetObject.ForceActions.AddRange(sourceObject.ForceActions);
}
}
}