ScaleXDecorator done

This commit is contained in:
Иван Ивашкин
2024-10-29 23:58:25 +05:00
parent 2738b1b7b3
commit 49d04c7bcc
18 changed files with 173 additions and 78 deletions

View File

@@ -0,0 +1,32 @@
using StructureHelperCommon.Infrastructures.Interfaces;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StructureHelperCommon.Models.Functions.Decorator
{
public class LimXDecorator : FunctionDecorator
{
private double leftBound;
private double rightBound;
public LimXDecorator(IOneVariableFunction function, double leftBound, double rightBound) : base(function)
{
this.leftBound = leftBound;
this.rightBound = rightBound;
}
public override bool Check()
{
return base.Check();
}
public override double GetByX(double xValue)
{
if (xValue > leftBound && xValue < rightBound)
{
return base.GetByX(xValue);
}
return 0;
}
}
}

View File

@@ -0,0 +1,27 @@
using StructureHelperCommon.Infrastructures.Interfaces;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StructureHelperCommon.Models.Functions.Decorator
{
public class ScaleXDecorator : FunctionDecorator
{
private double factor;
public ScaleXDecorator(IOneVariableFunction function, double factor) : base(function)
{
this.factor = factor;
Name = $"{function.Name}, y=f({factor}x)";
}
public override bool Check()
{
return base.Check();
}
public override double GetByX(double xValue)
{
return base.GetByX(factor * xValue);
}
}
}

View File

@@ -41,6 +41,7 @@ namespace StructureHelperCommon.Models.Functions
public ObservableCollection<IOneVariableFunction> Functions { get; set; } = new ObservableCollection<IOneVariableFunction>();
public double MinArg { get; set; }
public double MaxArg { get; set; }
public IShiftTraceLogger? TraceLogger { get; set; }
public FormulaFunction(bool isUser = false)
{

View File

@@ -1,14 +0,0 @@
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

@@ -1,14 +0,0 @@
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

@@ -29,6 +29,7 @@ namespace StructureHelperCommon.Models.Functions
public ObservableCollection<IOneVariableFunction> Functions { get; set; } = new ObservableCollection<IOneVariableFunction>();
public double MinArg { get; set; }
public double MaxArg { get; set; }
public IShiftTraceLogger? TraceLogger { get; set; }
public TableFunction(bool isUser = false)
{
@@ -68,7 +69,9 @@ namespace StructureHelperCommon.Models.Functions
public double GetByX(double xValue)
{
throw new NotImplementedException();
//Реализовать взятие значения из таблицы и интерполяцию по таблице
return 100;
}
}
}