normalization of methods

This commit is contained in:
Miha Kralj
2026-02-10 21:33:16 -08:00
parent 915d7a007b
commit 6d6259a47d
527 changed files with 10525 additions and 2123 deletions
+15 -3
View File
@@ -24,6 +24,7 @@ public sealed class Vidya : AbstractBase
private readonly ITValuePublisher? _source;
private readonly TValuePublishedHandler? _pubHandler;
private bool _isNew = true;
private bool _disposed;
[StructLayout(LayoutKind.Auto)]
private record struct State(
@@ -59,9 +60,13 @@ public sealed class Vidya : AbstractBase
protected override void Dispose(bool disposing)
{
if (disposing && _source != null && _pubHandler != null)
if (!_disposed)
{
_source.Pub -= _pubHandler;
if (disposing && _source != null && _pubHandler != null)
{
_source.Pub -= _pubHandler;
}
_disposed = true;
}
base.Dispose(disposing);
}
@@ -388,4 +393,11 @@ public sealed class Vidya : AbstractBase
System.Buffers.ArrayPool<double>.Shared.Return(downs);
}
}
}
public static (TSeries Results, Vidya Indicator) Calculate(TSeries source, int period)
{
var indicator = new Vidya(period);
TSeries results = indicator.Update(source);
return (results, indicator);
}
}