Skip to content

Commit

Permalink
Merge pull request #60 from do-i-know-it/release/2.0.0
Browse files Browse the repository at this point in the history
Release version 2.0.0
  • Loading branch information
do-i-know-it committed Aug 17, 2022
2 parents ea2d701 + 6505b32 commit 9b84900
Show file tree
Hide file tree
Showing 317 changed files with 8,983 additions and 13,121 deletions.
32 changes: 32 additions & 0 deletions Conduction/Accuracy.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
using YggdrAshill.Nuadha.Signalization;

namespace YggdrAshill.Nuadha.Conduction
{
/// <summary>
/// Implementation of <see cref="ISignal"/> for accuracy of <typeparamref name="TSignal"/>.
/// </summary>
/// <typeparam name="TSignal">
/// Type of <see cref="ISignal"/> for accuracy.
/// </typeparam>
public struct Accuracy<TSignal> :
ISignal
where TSignal : ISignal
{
/// <summary>
/// Original <typeparamref name="TSignal"/>.
/// </summary>
public TSignal Original { get; }

/// <summary>
/// Error of <typeparamref name="TSignal"/> contained in <see cref="Original"/>.
/// </summary>
public TSignal Error { get; }

public Accuracy(TSignal original, TSignal error)
{
Original = original;

Error = error;
}
}
}
47 changes: 47 additions & 0 deletions Conduction/Analysis.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
using YggdrAshill.Nuadha.Signalization;

namespace YggdrAshill.Nuadha.Conduction
{
/// <summary>
/// Implementation of <see cref="ISignal"/> for analysis of <typeparamref name="TSignal"/>.
/// </summary>
/// <typeparam name="TSignal">
/// Type of <see cref="ISignal"/> of analysis.
/// </typeparam>
public struct Analysis<TSignal> :
ISignal
where TSignal : ISignal
{
/// <summary>
/// Expeted <typeparamref name="TSignal"/>.
/// </summary>
public TSignal Expected { get; }

/// <summary>
/// Actual <typeparamref name="TSignal"/>.
/// </summary>
public TSignal Actual { get; }

/// <summary>
/// Constructor.
/// </summary>
/// <param name="expected">
/// <typeparamref name="TSignal"/> for <see cref="Expected"/>.
/// </param>
/// <param name="actual">
/// <typeparamref name="TSignal"/> for <see cref="Actual"/>.
/// </param>
public Analysis(TSignal expected, TSignal actual)
{
Expected = expected;

Actual = actual;
}

/// <inheritdoc/>
public override string ToString()
{
return $"{Expected}/{Actual}";
}
}
}
53 changes: 53 additions & 0 deletions Conduction/Cancel.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
using YggdrAshill.Nuadha.Signalization;
using System;

namespace YggdrAshill.Nuadha.Conduction
{
/// <summary>
/// Defines implementations of <see cref="ICancellation"/>.
/// </summary>
public static class Cancel
{
/// <summary>
/// Cancels with <paramref name="cancellation"/>.
/// </summary>
/// <param name="cancellation">
/// <see cref="Action"/> to cancel.
/// </param>
/// <returns>
/// <see cref="ICancellation"/>.
/// </returns>
/// <exception cref="ArgumentNullException">
/// Thrown if <paramref name="cancellation"/> is null.
/// </exception>
public static ICancellation With(Action cancellation)
{
if (cancellation == null)
{
throw new ArgumentNullException(nameof(cancellation));
}

return new CancelWith(cancellation);
}
private sealed class CancelWith :
ICancellation
{
private readonly Action onCancelled;

public CancelWith(Action onCancelled)
{
this.onCancelled = onCancelled;
}

public void Cancel()
{
onCancelled.Invoke();
}
}

/// <summary>
/// Cancels none.
/// </summary>
public static ICancellation None { get; } = With(() => { });
}
}
81 changes: 0 additions & 81 deletions Conduction/CancellationSource.cs

This file was deleted.

69 changes: 0 additions & 69 deletions Conduction/ConductSignalTo.cs

This file was deleted.

1 change: 0 additions & 1 deletion Conduction/Conduction.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
<ItemGroup>
<ProjectReference Include="..\Signalization\Signalization.csproj" />
<ProjectReference Include="..\Transformation\Transformation.csproj" />
<ProjectReference Include="..\Unitization\Unitization.csproj" />
</ItemGroup>

</Project>
52 changes: 52 additions & 0 deletions Conduction/Consume.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
using YggdrAshill.Nuadha.Signalization;
using System;

namespace YggdrAshill.Nuadha.Conduction
{
/// <summary>
/// Defines implementations of <see cref="IConsumption{TSignal}"/> for <typeparamref name="TSignal"/>.
/// </summary>
/// <typeparam name="TSignal">
/// Type of <see cref="ISignal"/> to consume.
/// </typeparam>
public static class Consume<TSignal>
where TSignal : ISignal
{
/// <summary>
/// Consumes <typeparamref name="TSignal"/> like <paramref name="consumption"/>.
/// </summary>
/// <param name="consumption">
/// <see cref="Action{T}"/> to consume <typeparamref name="TSignal"/>.
/// </param>
/// <returns>
/// <see cref="IConsumption{TSignal}"/> for <typeparamref name="TSignal"/>.
/// </returns>
/// <exception cref="ArgumentNullException">
/// Thrown if <paramref name="consumption"/> is null.
/// </exception>
public static IConsumption<TSignal> Like(Action<TSignal> consumption)
{
if (consumption == null)
{
throw new ArgumentNullException(nameof(consumption));
}

return new ConsumeSignalLike(consumption);
}
private sealed class ConsumeSignalLike :
IConsumption<TSignal>
{
private readonly Action<TSignal> onConsumed;

public ConsumeSignalLike(Action<TSignal> onConsumed)
{
this.onConsumed = onConsumed;
}

public void Consume(TSignal signal)
{
onConsumed.Invoke(signal);
}
}
}
}
42 changes: 42 additions & 0 deletions Conduction/ConsumePulse.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
using YggdrAshill.Nuadha.Signalization;
using YggdrAshill.Nuadha.Transformation;
using System;

namespace YggdrAshill.Nuadha.Conduction
{
/// <summary>
/// Defines implementations of <see cref="IConsumption{TSignal}"/> for <see cref="Pulse"/>.
/// </summary>
public static class ConsumePulse
{
/// <summary>
/// Receives <see cref="Pulse"/> to consume like <paramref name="consumption"/>.
/// </summary>
/// <param name="consumption">
/// <see cref="Action"/> to consume <see cref="Pulse"/>.
/// </param>
/// <returns>
/// <see cref="IConsumption{TSignal}"/> for <see cref="Pulse"/>.
/// </returns>
/// <exception cref="ArgumentNullException">
/// Thrown if <paramref name="consumption"/> is null.
/// </exception>
public static IConsumption<Pulse> Like(Action consumption)
{
if (consumption == null)
{
throw new ArgumentNullException(nameof(consumption));
}

return Consume<Pulse>.Like(_ =>
{
consumption.Invoke();
});
}

/// <summary>
/// Receives <see cref="Pulse"/> to do nothing.
/// </summary>
public static IConsumption<Pulse> None { get; } = Like(() => { });
}
}
Loading

0 comments on commit 9b84900

Please sign in to comment.