Skip to content

Commit

Permalink
feature: Add equality comparer to MRUCache, now uses ValueTuple (#344)
Browse files Browse the repository at this point in the history
  • Loading branch information
glennawatson committed Jun 20, 2019
1 parent a7aa168 commit 161eeda
Show file tree
Hide file tree
Showing 5 changed files with 110 additions and 95 deletions.
68 changes: 42 additions & 26 deletions src/Directory.build.props
@@ -1,62 +1,78 @@
<Project>
<Project>
<PropertyGroup>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<NoWarn>$(NoWarn);1591;1701;1702;1705;VSX1000</NoWarn>
<Platform>AnyCPU</Platform>
<IsTestProject>$(MSBuildProjectName.Contains('Tests'))</IsTestProject>
<DebugType>embedded</DebugType>
<CodeAnalysisRuleSet>$(MSBuildThisFileDirectory)analyzers.ruleset</CodeAnalysisRuleSet>

<Authors>.NET Foundation and Contributors</Authors>
<Copyright>Copyright (c) .NET Foundation and Contributors</Copyright>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<PackageProjectUrl>https://github.com/reactiveui/splat/</PackageProjectUrl>
<PackageIconUrl>http://f.cl.ly/items/1307401C3x2g3F2p2Z36/Logo.png</PackageIconUrl>
<Authors>.NET Foundation and Contributors</Authors>
<PackageDescription>A library to make things cross-platform that should be.</PackageDescription>
<Owners>xanaisbettsx;ghuntley</Owners>
<PackageTags>drawing;colours;geometry;logging;unit test detection;service location;image handling;portable;xamarin;xamarin ios;xamarin mac;android;monodroid;uwp;net45</PackageTags>
<PackageReleaseNotes>https://github.com/reactiveui/splat/releases</PackageReleaseNotes>
<RepositoryUrl>https://github.com/reactiveui/splat</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<CodeAnalysisRuleSet>$(MSBuildThisFileDirectory)analyzers.ruleset</CodeAnalysisRuleSet>
<IsTestProject>$(MSBuildProjectName.Contains('Tests'))</IsTestProject>
<DebugType>Embedded</DebugType>
<!-- Optional: Publish the repository URL in the built .nupkg (in the NuSpec <Repository> element) -->
<PublishRepositoryUrl>true</PublishRepositoryUrl>
<!-- Optional: Embed source files that are not tracked by the source control manager in the PDB -->
<EmbedUntrackedSources>true</EmbedUntrackedSources>
<!-- Optional: Include PDB in the built .nupkg -->
<AllowedOutputExtensionsInPackageBuildOutputFolder>$(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb</AllowedOutputExtensionsInPackageBuildOutputFolder>

<!-- disable sourcelink on mono, to workaround https://github.com/dotnet/sourcelink/issues/155 -->
<EnableSourceLink Condition=" '$(OS)' != 'Windows_NT' AND '$(MSBuildRuntimeType)' != 'Core' ">false</EnableSourceLink>
<EnableSourceControlManagerQueries>$(EnableSourceLink)</EnableSourceControlManagerQueries>
<!-- Publish the repository URL in the built .nupkg (in the NuSpec <Repository> element) -->
<PublishRepositoryUrl>true</PublishRepositoryUrl>
<!-- Embed source files that are not tracked by the source control manager in the PDB -->
<EmbedUntrackedSources>true</EmbedUntrackedSources>
<!-- Include PDB in the built .nupkg -->
<AllowedOutputExtensionsInPackageBuildOutputFolder>$(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb</AllowedOutputExtensionsInPackageBuildOutputFolder>
</PropertyGroup>

<!-- MonoAndroid doesn't seem to want to allow debugging for maintainers -->
<PropertyGroup Condition=" $(TargetFramework.StartsWith('MonoAndroid')) ">
<DebugType>Full</DebugType>
</PropertyGroup>

<ItemGroup Condition="$(IsTestProject)">
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.9.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.1.1" />
<PackageReference Include="xunit" Version="2.4.1" />
<PackageReference Include="xunit.runner.console" Version="2.4.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.1" />
<PackageReference Include="Xunit.StaFact" Version="0.3.18" />
<PackageReference Include="Shouldly" Version=" 3.0.2" />
<PackageReference Include="PublicApiGenerator" Version="8.1.0" />
<PackageReference Include="Shouldly" Version="4.0.0-beta0002" />
<PackageReference Include="Microsoft.Reactive.Testing" Version="4.1.5" />
<PackageReference Include="PublicApiGenerator" Version="9.0.0" />
</ItemGroup>

<ItemGroup Condition="$(IsTestProject)">
<Compile Include="$(MSBuildThisFileDirectory)ApiGeneratorGlobalSuppressions.cs" />
</ItemGroup>

<ItemGroup>
<None Include="$(MSBuildThisFileDirectory)..\LICENSE" Pack="true" PackagePath="LICENSE" />
<ItemGroup Condition="'$(IsTestProject)' != 'true' and '$(SourceLinkEnabled)' != 'false'">
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0-beta2-19270-01" PrivateAssets="All" />
</ItemGroup>

<PropertyGroup>
<SolutionDir Condition="'$(SolutionDir)' == ''">$(MSBuildThisFileDirectory)</SolutionDir>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Nerdbank.GitVersioning" Version="2.3.38" PrivateAssets="all" />
<None Include="$(MSBuildThisFileDirectory)..\LICENSE" Pack="true" PackagePath="LICENSE" />
</ItemGroup>

<ItemGroup Condition="'$(IsTestProject)' != 'true' and '$(SourceLinkEnabled)' != 'false'">
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0-beta2-18618-05" PrivateAssets="All" />
<ItemGroup>
<PackageReference Include="Nerdbank.GitVersioning" Version="2.3.183" PrivateAssets="all" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="stylecop.analyzers" Version="1.1.1-beta.61" PrivateAssets="all" />
<PackageReference Include="stylecop.analyzers" Version="1.1.118" PrivateAssets="all" />
<PackageReference Include="Microsoft.CodeAnalysis.FxCopAnalyzers" Version="2.6.3" PrivateAssets="all" />
<PackageReference Include="Roslynator.Analyzers" Version="2.0.0" PrivateAssets="All" />
<PackageReference Include="Roslynator.Analyzers" Version="2.1.0-rc" PrivateAssets="All" />
<PackageReference Condition="'$(OS)' == 'Windows_NT'" Include="Microsoft.CodeAnalysis.FxCopAnalyzers" Version="2.9.3" PrivateAssets="all" />
</ItemGroup>
<ItemGroup>
<AdditionalFiles Include="$(MSBuildThisFileDirectory)stylecop.json" Link="stylecop.json" />
</ItemGroup>
</Project>

</Project>
Expand Up @@ -421,6 +421,10 @@ namespace Splat
[System.ObsoleteAttribute("Use void Warn(Exception exception, [Localizable(false)] string message)")]
void WarnException([System.ComponentModel.LocalizableAttribute(false)] string message, System.Exception exception);
}
public interface ILogManager
{
Splat.IFullLogger GetLogger(System.Type type);
}
public interface ILogger
{
Splat.LogLevel Level { get; }
Expand All @@ -429,10 +433,6 @@ namespace Splat
void Write([System.ComponentModel.LocalizableAttribute(false)] string message, [System.ComponentModel.LocalizableAttribute(false)] System.Type type, Splat.LogLevel logLevel);
void Write(System.Exception exception, [System.ComponentModel.LocalizableAttribute(false)] string message, [System.ComponentModel.LocalizableAttribute(false)] System.Type type, Splat.LogLevel logLevel);
}
public interface ILogManager
{
Splat.IFullLogger GetLogger(System.Type type);
}
public interface IModeDetector
{
System.Nullable<bool> InDesignMode();
Expand Down Expand Up @@ -636,13 +636,6 @@ namespace Splat
public static void SetLocator(Splat.IDependencyResolver dependencyResolver) { }
public static System.IDisposable SuppressResolverCallbackChangedNotifications() { }
}
public class LoggingException : System.Exception
{
public LoggingException() { }
public LoggingException(string message) { }
public LoggingException(string message, System.Exception innerException) { }
protected LoggingException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
}
public class static LogHost
{
public static Splat.IFullLogger Default { get; }
Expand All @@ -661,9 +654,16 @@ namespace Splat
{
public static Splat.IFullLogger GetLogger<T>(this Splat.ILogManager logManager) { }
}
public class LoggingException : System.Exception
{
public LoggingException() { }
public LoggingException(string message) { }
public LoggingException(string message, System.Exception innerException) { }
protected LoggingException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
}
public sealed class MemoizingMRUCache<TParam, TVal>
{
public MemoizingMRUCache(System.Func<TParam, object, TVal> calculationFunc, int maxSize, System.Action<TVal> onRelease = null) { }
public MemoizingMRUCache(System.Func<TParam, object, TVal> calculationFunc, int maxSize, System.Action<TVal> onRelease = null, System.Collections.Generic.IEqualityComparer<TParam> paramComparer = null) { }

This comment has been minimized.

Copy link
@SimonCropp

SimonCropp Jun 21, 2019

Contributor

Just an FYI this is a breaking runtime change reactiveui/ReactiveUI#2081

public System.Collections.Generic.IEnumerable<TVal> CachedValues() { }
public TVal Get(TParam key) { }
public TVal Get(TParam key, object context = null) { }
Expand Down Expand Up @@ -732,14 +732,6 @@ namespace Splat
public static System.Drawing.PointF ScaledBy(this System.Drawing.PointF value, float factor) { }
public static bool WithinEpsilonOf(this System.Drawing.PointF value, System.Drawing.PointF other, float epsilon) { }
}
public class static RectangleMathExtensions
{
public static System.Drawing.PointF Center(this System.Drawing.RectangleF value) { }
public static System.Drawing.RectangleF Copy(this System.Drawing.RectangleF value, System.Nullable<float> x = null, System.Nullable<float> y = null, System.Nullable<float> width = null, System.Nullable<float> height = null, System.Nullable<float> top = null, System.Nullable<float> bottom = null) { }
public static System.Tuple<System.Drawing.RectangleF, System.Drawing.RectangleF> Divide(this System.Drawing.RectangleF value, float amount, Splat.RectEdge fromEdge) { }
public static System.Tuple<System.Drawing.RectangleF, System.Drawing.RectangleF> DivideWithPadding(this System.Drawing.RectangleF value, float sliceAmount, float padding, Splat.RectEdge fromEdge) { }
public static System.Drawing.RectangleF InvertWithin(this System.Drawing.RectangleF value, System.Drawing.RectangleF containingRect) { }
}
public enum RectEdge
{
Left = 0,
Expand All @@ -753,6 +745,14 @@ namespace Splat
public static System.Windows.Rect ToNative(this System.Drawing.Rectangle value) { }
public static System.Windows.Rect ToNative(this System.Drawing.RectangleF value) { }
}
public class static RectangleMathExtensions
{
public static System.Drawing.PointF Center(this System.Drawing.RectangleF value) { }
public static System.Drawing.RectangleF Copy(this System.Drawing.RectangleF value, System.Nullable<float> x = null, System.Nullable<float> y = null, System.Nullable<float> width = null, System.Nullable<float> height = null, System.Nullable<float> top = null, System.Nullable<float> bottom = null) { }
public static System.Tuple<System.Drawing.RectangleF, System.Drawing.RectangleF> Divide(this System.Drawing.RectangleF value, float amount, Splat.RectEdge fromEdge) { }
public static System.Tuple<System.Drawing.RectangleF, System.Drawing.RectangleF> DivideWithPadding(this System.Drawing.RectangleF value, float sliceAmount, float padding, Splat.RectEdge fromEdge) { }
public static System.Drawing.RectangleF InvertWithin(this System.Drawing.RectangleF value, System.Drawing.RectangleF containingRect) { }
}
public class static SizeExtensions
{
public static System.Drawing.SizeF FromNative(this System.Windows.Size value) { }
Expand Down Expand Up @@ -789,11 +789,11 @@ namespace Splat
public override int GetHashCode() { }
public float GetHue() { }
public float GetSaturation() { }
public static bool ==(Splat.SplatColor left, Splat.SplatColor right) { }
public static bool !=(Splat.SplatColor left, Splat.SplatColor right) { }
public int ToArgb() { }
public Splat.KnownColor ToKnownColor() { }
public override string ToString() { }
public static bool ==(Splat.SplatColor left, Splat.SplatColor right) { }
public static bool !=(Splat.SplatColor left, Splat.SplatColor right) { }
}
public class static SplatColorExtensions
{
Expand Down
Expand Up @@ -410,6 +410,10 @@ namespace Splat
[System.ObsoleteAttribute("Use void Warn(Exception exception, [Localizable(false)] string message)")]
void WarnException([System.ComponentModel.LocalizableAttribute(false)] string message, System.Exception exception);
}
public interface ILogManager
{
Splat.IFullLogger GetLogger(System.Type type);
}
public interface ILogger
{
Splat.LogLevel Level { get; }
Expand All @@ -418,10 +422,6 @@ namespace Splat
void Write([System.ComponentModel.LocalizableAttribute(false)] string message, [System.ComponentModel.LocalizableAttribute(false)] System.Type type, Splat.LogLevel logLevel);
void Write(System.Exception exception, [System.ComponentModel.LocalizableAttribute(false)] string message, [System.ComponentModel.LocalizableAttribute(false)] System.Type type, Splat.LogLevel logLevel);
}
public interface ILogManager
{
Splat.IFullLogger GetLogger(System.Type type);
}
public interface IModeDetector
{
System.Nullable<bool> InDesignMode();
Expand Down Expand Up @@ -625,13 +625,6 @@ namespace Splat
public static void SetLocator(Splat.IDependencyResolver dependencyResolver) { }
public static System.IDisposable SuppressResolverCallbackChangedNotifications() { }
}
public class LoggingException : System.Exception
{
public LoggingException() { }
public LoggingException(string message) { }
public LoggingException(string message, System.Exception innerException) { }
protected LoggingException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
}
public class static LogHost
{
public static Splat.IFullLogger Default { get; }
Expand All @@ -650,9 +643,16 @@ namespace Splat
{
public static Splat.IFullLogger GetLogger<T>(this Splat.ILogManager logManager) { }
}
public class LoggingException : System.Exception
{
public LoggingException() { }
public LoggingException(string message) { }
public LoggingException(string message, System.Exception innerException) { }
protected LoggingException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
}
public sealed class MemoizingMRUCache<TParam, TVal>
{
public MemoizingMRUCache(System.Func<TParam, object, TVal> calculationFunc, int maxSize, System.Action<TVal> onRelease = null) { }
public MemoizingMRUCache(System.Func<TParam, object, TVal> calculationFunc, int maxSize, System.Action<TVal> onRelease = null, System.Collections.Generic.IEqualityComparer<TParam> paramComparer = null) { }
public System.Collections.Generic.IEnumerable<TVal> CachedValues() { }
public TVal Get(TParam key) { }
public TVal Get(TParam key, object context = null) { }
Expand Down Expand Up @@ -702,6 +702,13 @@ namespace Splat
public static System.Drawing.PointF ScaledBy(this System.Drawing.PointF value, float factor) { }
public static bool WithinEpsilonOf(this System.Drawing.PointF value, System.Drawing.PointF other, float epsilon) { }
}
public enum RectEdge
{
Left = 0,
Top = 1,
Right = 2,
Bottom = 3,
}
public class static RectangleMathExtensions
{
public static System.Drawing.PointF Center(this System.Drawing.RectangleF value) { }
Expand All @@ -710,13 +717,6 @@ namespace Splat
public static System.Tuple<System.Drawing.RectangleF, System.Drawing.RectangleF> DivideWithPadding(this System.Drawing.RectangleF value, float sliceAmount, float padding, Splat.RectEdge fromEdge) { }
public static System.Drawing.RectangleF InvertWithin(this System.Drawing.RectangleF value, System.Drawing.RectangleF containingRect) { }
}
public enum RectEdge
{
Left = 0,
Top = 1,
Right = 2,
Bottom = 3,
}
public class static SizeMathExtensions
{
public static System.Drawing.SizeF ScaledBy(this System.Drawing.SizeF value, float factor) { }
Expand Down Expand Up @@ -747,11 +747,11 @@ namespace Splat
public override int GetHashCode() { }
public float GetHue() { }
public float GetSaturation() { }
public static bool ==(Splat.SplatColor left, Splat.SplatColor right) { }
public static bool !=(Splat.SplatColor left, Splat.SplatColor right) { }
public int ToArgb() { }
public Splat.KnownColor ToKnownColor() { }
public override string ToString() { }
public static bool ==(Splat.SplatColor left, Splat.SplatColor right) { }
public static bool !=(Splat.SplatColor left, Splat.SplatColor right) { }
}
public class static TargetFrameworkExtensions
{
Expand Down

0 comments on commit 161eeda

Please sign in to comment.