daily update on 20250210 by nitload youmu

This commit is contained in:
Nitload
2025-02-10 12:48:02 +08:00
parent ae94c265ae
commit c23b640cae
70 changed files with 2135 additions and 805 deletions
@@ -39,26 +39,30 @@ namespace StgSharp.Script.Express
{
public abstract class ExpCollectionBase : IExpElementSource, IEnumerable<ExpElementInstanceBase>
{
protected internal string _accurateType;
protected ExpCollectionBase(
string accurateType )
protected ExpCollectionBase( string accurateType )
{
_accurateType = accurateType;
}
public ExpElementType ElementType => ExpElementType.Collection;
public abstract int Count
{
get;
}
public string MemberType
{
get => _accurateType;
}
public abstract int Count { get; }
public ExpElementType ElementType => ExpElementType.Collection;
IScriptSourceProvider IExpElementSource.SourceProvider => null!;
public abstract string Name { get; }
public abstract string Name
{
get;
}
public void Analyse()
{
@@ -72,6 +76,8 @@ namespace StgSharp.Script.Express
return GetEnumerator();
}
IScriptSourceProvider IExpElementSource.SourceProvider => null!;
}
public class ExpArray : ExpCollectionBase
@@ -79,8 +85,7 @@ namespace StgSharp.Script.Express
private ExpElementInstanceBase[] _collection;
public ExpArray( string accurateType )
: base( accurateType ) { }
public ExpArray( string accurateType ) : base( accurateType ) { }
public ExpElementInstanceBase this[ int index ]
{
@@ -97,12 +102,12 @@ namespace StgSharp.Script.Express
public override int Count => _collection.Length;
public override string Name => ExpCompile.AddOrGetString("ARRAY");
public override string Name => ExpCompile.AddOrGetString( "ARRAY" );
public override IEnumerator<ExpElementInstanceBase> GetEnumerator()
{
return ( ( IEnumerable<ExpElementInstanceBase> )_collection )
.GetEnumerator( );
.GetEnumerator();
}
}
@@ -113,12 +118,11 @@ namespace StgSharp.Script.Express
private ConcurrentBag<ExpElementInstanceBase> _collection = new ConcurrentBag<ExpElementInstanceBase>(
);
public ExpBag( string accurateType )
: base( accurateType ) { }
public ExpBag( string accurateType ) : base( accurateType ) { }
public override int Count => _collection.Count;
public override string Name => ExpCompile.AddOrGetString("BAG");
public override string Name => ExpCompile.AddOrGetString( "BAG" );
public override IEnumerator<ExpElementInstanceBase> GetEnumerator()
{
@@ -126,23 +130,24 @@ namespace StgSharp.Script.Express
}
}
public sealed class ExpList : ExpCollectionBase
{
public ExpList(string accurateType ):base(accurateType)
{
}
private List<ExpElementInstanceBase> _collection = new List<ExpElementInstanceBase>();
private List<ExpElementInstanceBase> _collection = new List<ExpElementInstanceBase>(
);
public ExpList( string accurateType ) : base( accurateType ) { }
public override int Count => _collection.Count;
public override string Name => ExpCompile.AddOrGetString("LIST");
public override string Name => ExpCompile.AddOrGetString( "LIST" );
public override IEnumerator<ExpElementInstanceBase> GetEnumerator()
{
return _collection.GetEnumerator();
}
}
public class ExpSet : ExpCollectionBase
@@ -150,8 +155,11 @@ namespace StgSharp.Script.Express
private HashSet<ExpElementInstanceBase> _collection = new();
public ExpSet( string accurateType )
: base( accurateType ) { }
public ExpSet( string accurateType ) : base( accurateType ) { }
public override int Count => _collection.Count;
public override string Name => ExpCompile.AddOrGetString( "SET" );
public void Add( ExpElementInstanceBase token )
{
@@ -162,16 +170,12 @@ namespace StgSharp.Script.Express
_collection.Add( token );
}
public override int Count => _collection.Count;
public override string Name => ExpCompile.AddOrGetString("SET");
public override sealed IEnumerator<ExpElementInstanceBase> GetEnumerator()
public override sealed IEnumerator<ExpElementInstanceBase> GetEnumerator(
)
{
return ( ( IEnumerable<ExpElementInstanceBase> )_collection )
.GetEnumerator( );
.GetEnumerator();
}
}
}