daily update on 20250214 by nitload youmu, building syntax analysor, tough!

This commit is contained in:
Nitload
2025-02-14 13:30:17 +08:00
parent c23b640cae
commit ccef0de6f6
68 changed files with 2594 additions and 913 deletions
@@ -52,22 +52,22 @@ namespace StgSharp.Commom.Collections
{
private ConcurrentDictionary<int, T> _cache;
private Func<T> _defaultCreater;
private Func<T> _defaultCreator;
public CacheIndexPool( Func<T> defaultCreater )
public CacheIndexPool( Func<T> defaultCreator )
{
_cache = new ConcurrentDictionary<int, T>();
_defaultCreater = defaultCreater;
_defaultCreator = defaultCreator;
}
public T this[ int index ]
{
get
{
if( _cache.TryGetValue( index, out T value ) ) {
if( _cache.TryGetValue( index, out T? value ) ) {
return value;
}
T newValue = _defaultCreater();
T newValue = _defaultCreator();
_cache.TryAdd( index, newValue );
return newValue;
}
@@ -75,7 +75,7 @@ namespace StgSharp.Commom.Collections
public T CreateObject()
{
T _new = _defaultCreater();
T _new = _defaultCreator();
_cache.AddOrUpdate( 1, _new, static( _, origin ) => origin );
throw new NotImplementedException();
return _new;