Add function decorator pattern

This commit is contained in:
Иван Ивашкин
2024-10-10 16:11:04 +05:00
parent 72add44fe7
commit b5ed00341c
8 changed files with 200 additions and 0 deletions

View File

@@ -0,0 +1,48 @@
<?xml version="1.0" encoding="utf-8"?>
<ClassDiagram MajorVersion="1" MinorVersion="1">
<Class Name="StructureHelperCommon.Models.Functions.TableFunction" BaseTypeListCollapsed="true">
<Position X="3" Y="3" Width="1.5" />
<TypeIdentifier>
<HashCode>AAAAAAgAAAAAAAAAAAAAAAQAAAAIAAAAAQAAAAAAAAA=</HashCode>
<FileName>Models\Functions\TableFunction.cs</FileName>
</TypeIdentifier>
<Lollipop Position="0.2" />
</Class>
<Class Name="StructureHelperCommon.Models.Functions.FormulaFunction" BaseTypeListCollapsed="true">
<Position X="1.25" Y="3" Width="1.5" />
<TypeIdentifier>
<HashCode>AAAAAAgAAAAAAAAAAAAAAAQAAAAIAAAAAQAAAAAAAAA=</HashCode>
<FileName>Models\Functions\FormulaFunction.cs</FileName>
</TypeIdentifier>
<Lollipop Position="0.2" />
</Class>
<Interface Name="StructureHelperCommon.Infrastructures.Interfaces.IOneVariableFunction">
<Position X="2" Y="0.5" Width="1.5" />
<TypeIdentifier>
<HashCode>AAAAAAgAAAAAAAAAAAAAAAQAAAAIAAAAAQAAAAAAAAA=</HashCode>
<FileName>Infrastructures\Interfaces\IOneVariableFunction.cs</FileName>
</TypeIdentifier>
</Interface>
<Interface Name="StructureHelperCommon.Models.Functions.IScaleFunction">
<Position X="9" Y="3" Width="1.5" />
<TypeIdentifier>
<HashCode>AAAAAAAAAAAAAAAAAAIAAAAAAAAAAAAAAAAAAAAAAAA=</HashCode>
<FileName>Models\Functions\IScaleFunction.cs</FileName>
</TypeIdentifier>
</Interface>
<Interface Name="StructureHelperCommon.Models.Functions.ILimitFunction">
<Position X="7.25" Y="3" Width="1.5" />
<TypeIdentifier>
<HashCode>AAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAA=</HashCode>
<FileName>Models\Functions\ILimitFunction.cs</FileName>
</TypeIdentifier>
</Interface>
<Interface Name="StructureHelperCommon.Infrastructures.Interfaces.IFunctionDecorator">
<Position X="8" Y="0.75" Width="1.5" />
<TypeIdentifier>
<HashCode>AAAAAAAAAAAAAAAAAAAAIAAAAAAAAAAAAAAAAAAAAAA=</HashCode>
<FileName>Infrastructures\Interfaces\IFunctionDecorator.cs</FileName>
</TypeIdentifier>
</Interface>
<Font Name="Segoe UI" Size="9" />
</ClassDiagram>

View File

@@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StructureHelperCommon.Infrastructures.Enums
{
public enum FunctionType
{
TableFunction,
FormulaFunction
}
}

View File

@@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StructureHelperCommon.Infrastructures.Interfaces
{
public interface IFunctionDecorator
{
public IOneVariableFunction OneVariableFunction { get; }
}
}

View File

@@ -0,0 +1,17 @@
using StructureHelperCommon.Infrastructures.Enums;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StructureHelperCommon.Infrastructures.Interfaces
{
public interface IOneVariableFunction
{
public FunctionType Type { get; set; }
public string Name { get; set; }
public bool Check();
public double GetByX(double xValue);
}
}

View File

@@ -0,0 +1,40 @@
using StructureHelperCommon.Infrastructures.Enums;
using StructureHelperCommon.Infrastructures.Interfaces;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StructureHelperCommon.Models.Functions
{
public class FormulaFunction : IOneVariableFunction
{
public FunctionType Type { get; set; }
public string Name { get; set; }
public bool Check()
{
throw new NotImplementedException();
}
public double GetByX(double xValue)
{
throw new NotImplementedException();
}
}
public class CopyOfFormulaFunction : IOneVariableFunction
{
public FunctionType Type { get; set; }
public string Name { get; set; }
public bool Check()
{
throw new NotImplementedException();
}
public double GetByX(double xValue)
{
throw new NotImplementedException();
}
}
}

View File

@@ -0,0 +1,14 @@
using StructureHelperCommon.Infrastructures.Interfaces;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StructureHelperCommon.Models.Functions
{
public interface ILimitFunction : IFunctionDecorator
{
public void Limit();
}
}

View File

@@ -0,0 +1,14 @@
using StructureHelperCommon.Infrastructures.Interfaces;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StructureHelperCommon.Models.Functions
{
public interface IScaleFunction : IFunctionDecorator
{
public void Scale();
}
}

View File

@@ -0,0 +1,40 @@
using StructureHelperCommon.Infrastructures.Enums;
using StructureHelperCommon.Infrastructures.Interfaces;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StructureHelperCommon.Models.Functions
{
public class TableFunction : IOneVariableFunction
{
public FunctionType Type { get; set; }
public string Name { get; set; }
public bool Check()
{
throw new NotImplementedException();
}
public double GetByX(double xValue)
{
throw new NotImplementedException();
}
}
public class CopyOfTableFunction : IOneVariableFunction
{
public FunctionType Type { get; set; }
public string Name { get; set; }
public bool Check()
{
throw new NotImplementedException();
}
public double GetByX(double xValue)
{
throw new NotImplementedException();
}
}
}