-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Started investigating adding support for EverOasis.
- Loading branch information
1 parent
5f638a6
commit 78a8545
Showing
22 changed files
with
369 additions
and
129 deletions.
There are no files selected for viewing
32 changes: 32 additions & 0 deletions
32
FinModelUtility/Fin/Fin/src/data/dictionaries/CaseInvariantStringDictionary.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
using System; | ||
using System.Collections; | ||
using System.Collections.Generic; | ||
|
||
namespace fin.data.dictionaries { | ||
public class CaseInvariantStringDictionary<T> : IFinDictionary<string, T> { | ||
private readonly Dictionary<string, T> impl_ = new(StringComparer.InvariantCultureIgnoreCase); | ||
|
||
public void Clear() => this.impl_.Clear(); | ||
|
||
public int Count => this.impl_.Count; | ||
public IEnumerable<string> Keys => this.impl_.Keys; | ||
public IEnumerable<T> Values => this.impl_.Values; | ||
public bool ContainsKey(string key) => this.impl_.ContainsKey(key); | ||
|
||
public bool TryGetValue(string key, out T value) => this.impl_.TryGetValue(key, out value); | ||
|
||
public T this[string key] { | ||
get => this.impl_[key]; | ||
set => this.impl_[key] = value; | ||
} | ||
|
||
IEnumerator IEnumerable.GetEnumerator() => this.GetEnumerator(); | ||
|
||
public IEnumerator<(string Key, T Value)> GetEnumerator() { | ||
foreach (var (key, value) in this.impl_) { | ||
yield return (key, value); | ||
} | ||
} | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
FinModelUtility/Fin/Fin/src/data/dictionaries/SimpleDictionary.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
using System.Collections; | ||
using System.Collections.Concurrent; | ||
using System.Collections.Generic; | ||
|
||
namespace fin.data.dictionaries { | ||
public class SimpleDictionary<TKey, TValue>(IDictionary<TKey, TValue>? impl = null) | ||
: IFinDictionary<TKey, TValue> { | ||
private readonly IDictionary<TKey, TValue> impl_ = impl ?? new ConcurrentDictionary<TKey, TValue>(); | ||
|
||
public void Clear() => this.impl_.Clear(); | ||
|
||
public int Count => this.impl_.Count; | ||
public IEnumerable<TKey> Keys => this.impl_.Keys; | ||
public IEnumerable<TValue> Values => this.impl_.Values; | ||
public bool ContainsKey(TKey key) => this.impl_.ContainsKey(key); | ||
|
||
public bool TryGetValue(TKey key, out TValue value) => this.impl_.TryGetValue(key, out value); | ||
|
||
public TValue this[TKey key] { | ||
get => this.impl_[key]; | ||
set => this.impl_[key] = value; | ||
} | ||
IEnumerator IEnumerable.GetEnumerator() => this.GetEnumerator(); | ||
|
||
public IEnumerator<(TKey Key, TValue Value)> GetEnumerator() { | ||
foreach (var (key, value) in this.impl_) { | ||
yield return (key, value); | ||
} | ||
} | ||
|
||
} | ||
} |
41 changes: 41 additions & 0 deletions
41
FinModelUtility/Fin/Fin/src/data/lazy/LazyCaseInvariantStringDictionary.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
using System; | ||
using System.Collections; | ||
using System.Collections.Concurrent; | ||
using System.Collections.Generic; | ||
|
||
using fin.data.dictionaries; | ||
|
||
namespace fin.data.lazy { | ||
public class LazyCaseInvariantStringDictionary<TValue> : ILazyDictionary<string, TValue> { | ||
private readonly ILazyDictionary<string, TValue> impl_; | ||
|
||
public LazyCaseInvariantStringDictionary(Func<string, TValue> handler) { | ||
this.impl_ = new LazyDictionary<string, TValue>( | ||
handler, | ||
new SimpleDictionary<string, TValue>(new ConcurrentDictionary<string, TValue>(StringComparer.OrdinalIgnoreCase))); | ||
} | ||
|
||
public LazyCaseInvariantStringDictionary(Func<LazyDictionary<string, TValue>, string, TValue> handler) { | ||
this.impl_ = new LazyDictionary<string, TValue>( | ||
handler, | ||
new SimpleDictionary<string, TValue>(new ConcurrentDictionary<string, TValue>(StringComparer.OrdinalIgnoreCase))); | ||
} | ||
|
||
public void Clear() => this.impl_.Clear(); | ||
|
||
IEnumerator IEnumerable.GetEnumerator() => this.GetEnumerator(); | ||
public IEnumerator<(string Key, TValue Value)> GetEnumerator() => this.impl_.GetEnumerator(); | ||
|
||
public int Count => this.impl_.Count; | ||
public IEnumerable<string> Keys => this.impl_.Keys; | ||
public IEnumerable<TValue> Values => this.impl_.Values; | ||
|
||
public bool ContainsKey(string key) => this.impl_.ContainsKey(key); | ||
public bool TryGetValue(string key, out TValue value) => this.impl_.TryGetValue(key, out value); | ||
|
||
public TValue this[string key] { | ||
get => this.impl_[key]; | ||
set => this.impl_[key] = value; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.