Upgrade structure of code base
This commit is contained in:
@@ -1,36 +1,41 @@
|
||||
using Enigmos.Ports;
|
||||
using Enigmos.Ports.DataPorts;
|
||||
using Nocturnis.DataStructures;
|
||||
using Nocturnis.DataStructures.ConfigurableParameters;
|
||||
using Nocturnis.Enigmos.Modules;
|
||||
using TabulaSmaragdina;
|
||||
using TabulaSmaragdina.Constants;
|
||||
using Nocturnis.Enigmos.Modules.ComputationalModules;
|
||||
using Nocturnis.Enigmos.Ports;
|
||||
using Nocturnis.GlobalManagement.Constants;
|
||||
using Nocturnis.GlobalManagement.Providers;
|
||||
|
||||
namespace Enigmos.Modules.ComputationalModules.Binary;
|
||||
|
||||
public partial class ComparisionModule : BinaryComputationalModule, IParameterizedModule
|
||||
public partial class ComparisionModule : BinaryComputationalModule,
|
||||
IParameterizedModule,
|
||||
IDuplicateOutputModule,
|
||||
IOperationModule
|
||||
{
|
||||
|
||||
private DataOutPort? Output { get; set; }
|
||||
private IBoolParameter Greater { get; set; }
|
||||
public override IEnumerable<BasePort> Ports => base.Ports.Union(new[] { Output });
|
||||
public HashSet<IConfigurableParameter> ConfigurableParameters { get; set; }
|
||||
private IBoolParameter? Greater { get; set; }
|
||||
public override IEnumerable<IBasePort> Ports => base.Ports.Union(DataOutPorts);
|
||||
public HashSet<IConfigurableParameter> ConfigurableParameters { get; set; } = new();
|
||||
|
||||
public override void Init()
|
||||
{
|
||||
base.Init();
|
||||
Greater = GlobalProvider.DataStructureProvider.NewBoolParameter("Method", "gt", "lt", true);
|
||||
this.DataOutInit("Output",1);
|
||||
this.SetInputType(EnigmosConstant.DataPortTypes.Real);
|
||||
this.SetOutputType(EnigmosConstant.DataPortTypes.Real);
|
||||
Greater = GlobalProvider.DataStructureProvider!.NewBoolParameter("Method", "gt", "lt", true);
|
||||
ConfigurableParameters = new HashSet<IConfigurableParameter>() { Greater };
|
||||
Output = GetPort<DataOutPort>("Output");
|
||||
Input1.SetDataType(EnigmosConstant.DataPortTypes.Real);
|
||||
Input2.SetDataType(EnigmosConstant.DataPortTypes.Real);
|
||||
Output.SetDataType(EnigmosConstant.DataPortTypes.Bit);
|
||||
PostInit();
|
||||
}
|
||||
|
||||
|
||||
protected override void Compute(IDataPackage input1, IDataPackage input2)
|
||||
public override void Define()
|
||||
{
|
||||
Output!.ResultData.Bit = !(Greater.ParameterValue ^ (input1.Real > input2.Real));
|
||||
this.Define(
|
||||
cache => (
|
||||
!(Greater!.ParameterValue ^ (this.X(cache).Double > this.Y(cache).Double)),
|
||||
EnigmosConstant.DataPortTypes.Bit
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user