-
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.
Investigated what's going on with the Bnk keyframe values to try to f…
…igure out what might be going wrong.
- Loading branch information
1 parent
6094e6c
commit 68fd3f6
Showing
4 changed files
with
103 additions
and
12 deletions.
There are no files selected for viewing
4 changes: 3 additions & 1 deletion
4
...ty/Fin/Fin/src/data/lists/CounterArray.cs → ...Fin/Fin/src/data/counters/CounterArray.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
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,20 @@ | ||
using System.Collections; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
|
||
namespace fin.data.counters { | ||
public class CounterSet<T> { | ||
private readonly Dictionary<T, int> impl_ = new(); | ||
|
||
public int Increment(T key) { | ||
if (this.impl_.TryGetValue(key, out var count)) { | ||
count++; | ||
} | ||
|
||
return this.impl_[key] = count; | ||
} | ||
|
||
public void Clear() => this.impl_.Clear(); | ||
public int Count => this.impl_.Count; | ||
} | ||
} |
37 changes: 37 additions & 0 deletions
37
FinModelUtility/Fin/Fin/src/data/dictionaries/SortedSetDictionary.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,37 @@ | ||
using System.Collections; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
|
||
namespace fin.data.dictionaries { | ||
public class SortedSetDictionary<TKey, TValue> | ||
: IFinCollection<(TKey Key, SortedSet<TValue> Value)> { | ||
private readonly NullFriendlyDictionary<TKey, SortedSet<TValue>> impl_ = | ||
new(); | ||
|
||
public void Clear() => this.impl_.Clear(); | ||
public void ClearSet(TKey key) => this.impl_.Remove(key); | ||
|
||
public int Count => this.impl_.Values.Select(list => list.Count).Sum(); | ||
|
||
public bool HasSet(TKey key) => this.impl_.ContainsKey(key); | ||
|
||
public void Add(TKey key, TValue value) { | ||
SortedSet<TValue> set; | ||
if (!this.impl_.TryGetValue(key, out set)) { | ||
this.impl_[key] = set = new SortedSet<TValue>(); | ||
} | ||
|
||
set.Add(value); | ||
} | ||
|
||
public SortedSet<TValue> this[TKey key] => this.impl_[key]; | ||
|
||
public bool TryGetSet(TKey key, out SortedSet<TValue>? set) | ||
=> this.impl_.TryGetValue(key, out set); | ||
|
||
IEnumerator IEnumerable.GetEnumerator() => this.GetEnumerator(); | ||
|
||
public IEnumerator<(TKey Key, SortedSet<TValue> Value)> GetEnumerator() | ||
=> this.impl_.GetEnumerator(); | ||
} | ||
} |
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