Skip to content
This repository was archived by the owner on Jan 5, 2021. It is now read-only.

Commit df3b9f5

Browse files
committed
total rewrite
1 parent 2092d47 commit df3b9f5

20 files changed

Lines changed: 538 additions & 816 deletions

src/Interface/ICachedContainer.cs

Lines changed: 0 additions & 12 deletions
This file was deleted.
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using JetBrains.Annotations;
4+
5+
namespace ProjectCeleste.Misc.Container.Interface
6+
{
7+
public interface IConcurrentContainer<in TKey, TValue> : IContainer<TKey, TValue>
8+
{
9+
[CanBeNull]
10+
[Pure]
11+
TValue Get([NotNull] Func<TValue, bool> criteria, bool useCache = true);
12+
13+
[NotNull]
14+
[ItemNotNull]
15+
[Pure]
16+
IEnumerable<TValue> Gets(bool dirtyRead = true);
17+
18+
[NotNull]
19+
[ItemNotNull]
20+
[Pure]
21+
IEnumerable<TValue> Gets([NotNull] Func<TValue, bool> criteria, bool dirtyRead = true);
22+
}
23+
}

src/Interface/IContainer.cs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
1-
namespace ProjectCeleste.Misc.Container.Interface
1+
using System;
2+
using JetBrains.Annotations;
3+
4+
namespace ProjectCeleste.Misc.Container.Interface
25
{
36
public interface IContainer<in TKey, TValue> : IReadOnlyContainer<TKey, TValue>
47
{
5-
bool Add(TValue value);
8+
bool Add([NotNull] TValue value);
69
void Clear();
7-
bool Remove(TKey key);
8-
bool Remove(TKey key, out TValue value);
10+
bool Remove([NotNull] TKey key);
11+
bool Remove([NotNull] TKey key, out TValue value);
912

10-
bool Update(TValue value);
13+
bool Update([NotNull] TValue value, [CanBeNull] Func<TValue, TValue, bool> equalityComparer = null);
1114
//bool ChangeKey(T1 newKey, T1 oldKey);
1215
}
1316
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
namespace ProjectCeleste.Misc.Container.Interface
2+
{
3+
public interface IObservableConcurrentContainer<in TKey, TValue> : IConcurrentContainer<TKey, TValue>,
4+
IObservableContainer<TKey, TValue>
5+
{
6+
}
7+
}
Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,34 @@
11
using System;
22
using System.Collections.Generic;
3-
using ProjectCeleste.Misc.Container.Misc;
3+
using JetBrains.Annotations;
44

55
namespace ProjectCeleste.Misc.Container.Interface
66
{
7-
public interface IReadOnlyContainer<in TKey, out TValue> : IEnumerable<TValue>, IContainerJsonConverter
7+
public interface IReadOnlyContainer<in TKey, out TValue>
88
{
9-
TValue this[TKey key] { get; }
9+
[NotNull] TValue this[[NotNull] TKey key] { get; }
10+
1011
int Count { get; }
11-
bool ContainsKey(TKey key);
12-
TValue Get(Func<TValue, bool> criteria);
13-
TValue Get(TKey key);
12+
13+
[Pure]
14+
bool ContainsKey([NotNull] TKey key);
15+
16+
[CanBeNull]
17+
[Pure]
18+
TValue Get([NotNull] Func<TValue, bool> criteria);
19+
20+
[CanBeNull]
21+
[Pure]
22+
TValue Get([NotNull] TKey key);
23+
24+
[NotNull]
25+
[ItemNotNull]
26+
[Pure]
1427
IEnumerable<TValue> Gets();
15-
IEnumerable<TValue> Gets(Func<TValue, bool> criteria);
28+
29+
[NotNull]
30+
[ItemNotNull]
31+
[Pure]
32+
IEnumerable<TValue> Gets([NotNull] Func<TValue, bool> criteria);
1633
}
1734
}

src/Misc/ContainerEqualityComparer.cs

Lines changed: 0 additions & 35 deletions
This file was deleted.

src/Misc/ContainerUtils.cs

Lines changed: 0 additions & 41 deletions
This file was deleted.

0 commit comments

Comments
 (0)