This repository has been archived on 2024-06-04. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
thesis-src/Lookup/Lookup.Memory/WeakReferenceMemoryLookup.cs
2023-08-10 09:04:36 +02:00

80 lines
2.0 KiB
C#

using Lookup.Interface;
using System;
using System.Collections.Generic;
using System.Runtime.Serialization;
namespace Lookup.Memory;
/// <summary>
/// <see cref="ILookup{TKey,TValue}"/>
/// implementation, storing weakly-referenced <typeparamref name="TValue"/>s in <see cref="ICollection{T}"/>s
/// </summary>
/// <typeparam name="TKey">Type of the key referencing the <typeparamref name="TValue"/>s</typeparam>
/// <typeparam name="TValue">Type of the stored values, referenced by <typeparamref name="TKey"/></typeparam>
public class WeakReferenceMemoryLookup<TKey, TValue>
: MemoryLookup<TKey, WeakReference<TValue>>
where TKey : notnull
where TValue : class
{
#region Constructors
/// <inheritdoc />
public WeakReferenceMemoryLookup()
{
}
/// <inheritdoc />
public WeakReferenceMemoryLookup(
IDictionary<TKey, ICollection<WeakReference<TValue>>> dictionary
) : base(dictionary)
{
}
/// <inheritdoc />
public WeakReferenceMemoryLookup(
IDictionary<TKey, ICollection<WeakReference<TValue>>> dictionary,
IEqualityComparer<TKey>? comparer
) : base(dictionary, comparer)
{
}
/// <inheritdoc />
public WeakReferenceMemoryLookup(
IEnumerable<KeyValuePair<TKey, ICollection<WeakReference<TValue>>>> collection
) : base(collection)
{
}
/// <inheritdoc />
public WeakReferenceMemoryLookup(
IEnumerable<KeyValuePair<TKey, ICollection<WeakReference<TValue>>>> collection,
IEqualityComparer<TKey>? comparer
) : base(collection, comparer)
{
}
/// <inheritdoc />
public WeakReferenceMemoryLookup(IEqualityComparer<TKey>? comparer) : base(comparer)
{
}
/// <inheritdoc />
public WeakReferenceMemoryLookup(int capacity) : base(capacity)
{
}
/// <inheritdoc />
public WeakReferenceMemoryLookup(int capacity, IEqualityComparer<TKey>? comparer) : base(capacity,
comparer)
{
}
/// <inheritdoc />
public WeakReferenceMemoryLookup(SerializationInfo info, StreamingContext context) : base(info,
context)
{
}
#endregion
}