Sealed a lot of classes that are not meant to be inherited

This commit is contained in:
DarthAffe committed 2023-04-19 21:19:05 +02:00
1 parent d9c244a044
commit 2020992249
155 files changed
+205 -344

No files matched your search

@@ -8,7 +8,7 @@ namespace RGB.NET.Presets.Textures.Gradients;
/// <summary>
/// Represents a stop on a gradient.
/// </summary>
public class GradientStop : AbstractBindable
public sealed class GradientStop : AbstractBindable
{
#region Properties & Fields
@@ -11,12 +11,12 @@ namespace RGB.NET.Presets.Textures.Gradients;
/// <summary>
/// Represents a linear interpolated gradient with n stops.
/// </summary>
public class LinearGradient : AbstractGradient
public sealed class LinearGradient : AbstractGradient
{
#region Properties & Fields
private bool _isOrderedGradientListDirty = true;
private LinkedList<GradientStop> _orderedGradientStops = new();
private readonly List<GradientStop> _orderedGradientStops = new();
#endregion
@@ -89,7 +89,10 @@ public class LinearGradient : AbstractGradient
if (GradientStops.Count == 1) return GradientStops[0].Color;
if (_isOrderedGradientListDirty)
_orderedGradientStops = new LinkedList<GradientStop>(GradientStops.OrderBy(x => x.Offset));
{
_orderedGradientStops.Clear();
_orderedGradientStops.AddRange(GradientStops.OrderBy(x => x.Offset));
}
(GradientStop gsBefore, GradientStop gsAfter) = GetEnclosingGradientStops(offset, _orderedGradientStops, WrapGradient);
@@ -112,7 +115,7 @@ public class LinearGradient : AbstractGradient
/// <param name="orderedStops">The ordered list of <see cref="GradientStop"/> to choose from.</param>
/// <param name="wrap">Bool indicating if the gradient should be wrapped or not.</param>
/// <returns>The two <see cref="GradientStop"/>s encapsulating the specified offset.</returns>
protected virtual (GradientStop gsBefore, GradientStop gsAfter) GetEnclosingGradientStops(float offset, LinkedList<GradientStop> orderedStops, bool wrap)
private (GradientStop gsBefore, GradientStop gsAfter) GetEnclosingGradientStops(float offset, IEnumerable<GradientStop> orderedStops, bool wrap)
{
LinkedList<GradientStop> gradientStops = new(orderedStops);
@@ -13,7 +13,7 @@ namespace RGB.NET.Presets.Textures.Gradients;
/// Represents a rainbow gradient which circles through all colors of the HUE-color-space.<br />
/// See <see href="http://upload.wikimedia.org/wikipedia/commons/a/ad/HueScale.svg" /> as reference.
/// </summary>
public class RainbowGradient : AbstractDecoratable<IGradientDecorator>, IGradient
public sealed class RainbowGradient : AbstractDecoratable<IGradientDecorator>, IGradient
{
#region Properties & Fields
@@ -102,7 +102,7 @@ public class RainbowGradient : AbstractDecoratable<IGradientDecorator>, IGradien
/// <summary>
/// Should be called to indicate that the gradient was changed.
/// </summary>
protected void OnGradientChanged() => GradientChanged?.Invoke(this, EventArgs.Empty);
private void OnGradientChanged() => GradientChanged?.Invoke(this, EventArgs.Empty);
#endregion
}