style patterns

This commit is contained in:
Miha Kralj
2026-01-25 16:01:45 -08:00
parent 2836f253c4
commit e59665c8f0
399 changed files with 6892 additions and 1323 deletions
+13 -3
View File
@@ -54,7 +54,9 @@ public sealed class Adxr : ITValuePublisher
public Adxr(int period)
{
if (period <= 0)
{
throw new ArgumentException("Period must be greater than 0", nameof(period));
}
_period = period;
Name = $"Adxr({period})";
@@ -126,7 +128,10 @@ public sealed class Adxr : ITValuePublisher
public TSeries Update(TBarSeries source)
{
if (source.Count == 0) return new TSeries([], []);
if (source.Count == 0)
{
return new TSeries([], []);
}
int len = source.Count;
var v = new double[len];
@@ -205,14 +210,19 @@ public sealed class Adxr : ITValuePublisher
finally
{
if (rentedAdx != null)
{
ArrayPool<double>.Shared.Return(rentedAdx);
}
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static TSeries Batch(TBarSeries source, int period)
{
if (source.Count == 0) return new TSeries([], []);
if (source.Count == 0)
{
return new TSeries([], []);
}
int len = source.Count;
var v = new double[len];
@@ -228,4 +238,4 @@ public sealed class Adxr : ITValuePublisher
return new TSeries(tList, [.. v]);
}
}
}