diff --git a/Bts.Spark.Sdk.sln b/Bts.Spark.Sdk.sln index d45e27654..a40f66515 100644 --- a/Bts.Spark.Sdk.sln +++ b/Bts.Spark.Sdk.sln @@ -17,6 +17,14 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Bts.Spark.Sdk", "src\cs\Bts EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Bts.Spark.Sdk.Demo", "src\cs\Bts.Spark.Sdk.Demo\Bts.Spark.Sdk.Demo.csproj", "{FCFDBDBE-74B0-41C4-9011-C651B21056D4}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Bts.Collections", "src\cs\Bts.Collections\Bts.Collections.csproj", "{3BF4DF96-5AFF-4674-866A-71A8090627FF}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Bts.Core", "src\cs\Bts.Core\Bts.Core.csproj", "{CD0A3EEF-303A-44EE-85F2-76F4CE632A3B}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Bts.Disposables", "src\cs\Bts.Disposables\Bts.Disposables.csproj", "{62067659-AA2E-4CB5-B7CE-0B38EAA92080}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Bts.Numerics", "src\cs\Bts.Numerics\Bts.Numerics.csproj", "{2FE1E5D0-168A-4D83-9B18-0D48250B4BFE}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -87,6 +95,54 @@ Global {FCFDBDBE-74B0-41C4-9011-C651B21056D4}.Release|x64.Build.0 = Release|Any CPU {FCFDBDBE-74B0-41C4-9011-C651B21056D4}.Release|x86.ActiveCfg = Release|Any CPU {FCFDBDBE-74B0-41C4-9011-C651B21056D4}.Release|x86.Build.0 = Release|Any CPU + {3BF4DF96-5AFF-4674-866A-71A8090627FF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {3BF4DF96-5AFF-4674-866A-71A8090627FF}.Debug|Any CPU.Build.0 = Debug|Any CPU + {3BF4DF96-5AFF-4674-866A-71A8090627FF}.Debug|x64.ActiveCfg = Debug|Any CPU + {3BF4DF96-5AFF-4674-866A-71A8090627FF}.Debug|x64.Build.0 = Debug|Any CPU + {3BF4DF96-5AFF-4674-866A-71A8090627FF}.Debug|x86.ActiveCfg = Debug|Any CPU + {3BF4DF96-5AFF-4674-866A-71A8090627FF}.Debug|x86.Build.0 = Debug|Any CPU + {3BF4DF96-5AFF-4674-866A-71A8090627FF}.Release|Any CPU.ActiveCfg = Release|Any CPU + {3BF4DF96-5AFF-4674-866A-71A8090627FF}.Release|Any CPU.Build.0 = Release|Any CPU + {3BF4DF96-5AFF-4674-866A-71A8090627FF}.Release|x64.ActiveCfg = Release|Any CPU + {3BF4DF96-5AFF-4674-866A-71A8090627FF}.Release|x64.Build.0 = Release|Any CPU + {3BF4DF96-5AFF-4674-866A-71A8090627FF}.Release|x86.ActiveCfg = Release|Any CPU + {3BF4DF96-5AFF-4674-866A-71A8090627FF}.Release|x86.Build.0 = Release|Any CPU + {CD0A3EEF-303A-44EE-85F2-76F4CE632A3B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {CD0A3EEF-303A-44EE-85F2-76F4CE632A3B}.Debug|Any CPU.Build.0 = Debug|Any CPU + {CD0A3EEF-303A-44EE-85F2-76F4CE632A3B}.Debug|x64.ActiveCfg = Debug|Any CPU + {CD0A3EEF-303A-44EE-85F2-76F4CE632A3B}.Debug|x64.Build.0 = Debug|Any CPU + {CD0A3EEF-303A-44EE-85F2-76F4CE632A3B}.Debug|x86.ActiveCfg = Debug|Any CPU + {CD0A3EEF-303A-44EE-85F2-76F4CE632A3B}.Debug|x86.Build.0 = Debug|Any CPU + {CD0A3EEF-303A-44EE-85F2-76F4CE632A3B}.Release|Any CPU.ActiveCfg = Release|Any CPU + {CD0A3EEF-303A-44EE-85F2-76F4CE632A3B}.Release|Any CPU.Build.0 = Release|Any CPU + {CD0A3EEF-303A-44EE-85F2-76F4CE632A3B}.Release|x64.ActiveCfg = Release|Any CPU + {CD0A3EEF-303A-44EE-85F2-76F4CE632A3B}.Release|x64.Build.0 = Release|Any CPU + {CD0A3EEF-303A-44EE-85F2-76F4CE632A3B}.Release|x86.ActiveCfg = Release|Any CPU + {CD0A3EEF-303A-44EE-85F2-76F4CE632A3B}.Release|x86.Build.0 = Release|Any CPU + {62067659-AA2E-4CB5-B7CE-0B38EAA92080}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {62067659-AA2E-4CB5-B7CE-0B38EAA92080}.Debug|Any CPU.Build.0 = Debug|Any CPU + {62067659-AA2E-4CB5-B7CE-0B38EAA92080}.Debug|x64.ActiveCfg = Debug|Any CPU + {62067659-AA2E-4CB5-B7CE-0B38EAA92080}.Debug|x64.Build.0 = Debug|Any CPU + {62067659-AA2E-4CB5-B7CE-0B38EAA92080}.Debug|x86.ActiveCfg = Debug|Any CPU + {62067659-AA2E-4CB5-B7CE-0B38EAA92080}.Debug|x86.Build.0 = Debug|Any CPU + {62067659-AA2E-4CB5-B7CE-0B38EAA92080}.Release|Any CPU.ActiveCfg = Release|Any CPU + {62067659-AA2E-4CB5-B7CE-0B38EAA92080}.Release|Any CPU.Build.0 = Release|Any CPU + {62067659-AA2E-4CB5-B7CE-0B38EAA92080}.Release|x64.ActiveCfg = Release|Any CPU + {62067659-AA2E-4CB5-B7CE-0B38EAA92080}.Release|x64.Build.0 = Release|Any CPU + {62067659-AA2E-4CB5-B7CE-0B38EAA92080}.Release|x86.ActiveCfg = Release|Any CPU + {62067659-AA2E-4CB5-B7CE-0B38EAA92080}.Release|x86.Build.0 = Release|Any CPU + {2FE1E5D0-168A-4D83-9B18-0D48250B4BFE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {2FE1E5D0-168A-4D83-9B18-0D48250B4BFE}.Debug|Any CPU.Build.0 = Debug|Any CPU + {2FE1E5D0-168A-4D83-9B18-0D48250B4BFE}.Debug|x64.ActiveCfg = Debug|Any CPU + {2FE1E5D0-168A-4D83-9B18-0D48250B4BFE}.Debug|x64.Build.0 = Debug|Any CPU + {2FE1E5D0-168A-4D83-9B18-0D48250B4BFE}.Debug|x86.ActiveCfg = Debug|Any CPU + {2FE1E5D0-168A-4D83-9B18-0D48250B4BFE}.Debug|x86.Build.0 = Debug|Any CPU + {2FE1E5D0-168A-4D83-9B18-0D48250B4BFE}.Release|Any CPU.ActiveCfg = Release|Any CPU + {2FE1E5D0-168A-4D83-9B18-0D48250B4BFE}.Release|Any CPU.Build.0 = Release|Any CPU + {2FE1E5D0-168A-4D83-9B18-0D48250B4BFE}.Release|x64.ActiveCfg = Release|Any CPU + {2FE1E5D0-168A-4D83-9B18-0D48250B4BFE}.Release|x64.Build.0 = Release|Any CPU + {2FE1E5D0-168A-4D83-9B18-0D48250B4BFE}.Release|x86.ActiveCfg = Release|Any CPU + {2FE1E5D0-168A-4D83-9B18-0D48250B4BFE}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -98,5 +154,9 @@ Global {37E4E890-D025-4729-90F9-6F95862F47BC} = {C5A3B5EA-BE9F-76E5-E9B8-8A22B289B295} {A5FF3FAF-43CB-496B-AF4B-F61EFD645579} = {C5A3B5EA-BE9F-76E5-E9B8-8A22B289B295} {FCFDBDBE-74B0-41C4-9011-C651B21056D4} = {C5A3B5EA-BE9F-76E5-E9B8-8A22B289B295} + {3BF4DF96-5AFF-4674-866A-71A8090627FF} = {C5A3B5EA-BE9F-76E5-E9B8-8A22B289B295} + {CD0A3EEF-303A-44EE-85F2-76F4CE632A3B} = {C5A3B5EA-BE9F-76E5-E9B8-8A22B289B295} + {62067659-AA2E-4CB5-B7CE-0B38EAA92080} = {C5A3B5EA-BE9F-76E5-E9B8-8A22B289B295} + {2FE1E5D0-168A-4D83-9B18-0D48250B4BFE} = {C5A3B5EA-BE9F-76E5-E9B8-8A22B289B295} EndGlobalSection EndGlobal diff --git a/Spark.Api.Server.sln b/Spark.Api.Server.sln index 1daf24b75..4406168f2 100644 --- a/Spark.Api.Server.sln +++ b/Spark.Api.Server.sln @@ -51,6 +51,14 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Bts.Net", "src\cs\Bts.Net\B EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Bts.IO.Compression", "src\cs\Bts.IO.Compression\Bts.IO.Compression.csproj", "{BC277499-8215-4F9F-B9AB-07B6391110BF}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Bts.Collections", "src\cs\Bts.Collections\Bts.Collections.csproj", "{C42F4CCB-9E65-4370-939A-527ACDBC4DA6}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Bts.Core", "src\cs\Bts.Core\Bts.Core.csproj", "{802ECF0B-7264-4168-95D1-158E47FB65CC}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Bts.Disposables", "src\cs\Bts.Disposables\Bts.Disposables.csproj", "{95C5F6C0-88E5-4338-9A4F-614CF6C03CC0}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Bts.Numerics", "src\cs\Bts.Numerics\Bts.Numerics.csproj", "{0354655D-2394-42BB-B1D4-2D75B9BCABF1}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|x64 = Debug|x64 @@ -571,6 +579,102 @@ Global {BC277499-8215-4F9F-B9AB-07B6391110BF}.RelWithDebInfo|Any CPU.Build.0 = Debug|Any CPU {BC277499-8215-4F9F-B9AB-07B6391110BF}.RelWithDebInfo|x86.ActiveCfg = Debug|Any CPU {BC277499-8215-4F9F-B9AB-07B6391110BF}.RelWithDebInfo|x86.Build.0 = Debug|Any CPU + {C42F4CCB-9E65-4370-939A-527ACDBC4DA6}.Debug|x64.ActiveCfg = Debug|Any CPU + {C42F4CCB-9E65-4370-939A-527ACDBC4DA6}.Debug|x64.Build.0 = Debug|Any CPU + {C42F4CCB-9E65-4370-939A-527ACDBC4DA6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {C42F4CCB-9E65-4370-939A-527ACDBC4DA6}.Debug|Any CPU.Build.0 = Debug|Any CPU + {C42F4CCB-9E65-4370-939A-527ACDBC4DA6}.Debug|x86.ActiveCfg = Debug|Any CPU + {C42F4CCB-9E65-4370-939A-527ACDBC4DA6}.Debug|x86.Build.0 = Debug|Any CPU + {C42F4CCB-9E65-4370-939A-527ACDBC4DA6}.MinSizeRel|x64.ActiveCfg = Debug|Any CPU + {C42F4CCB-9E65-4370-939A-527ACDBC4DA6}.MinSizeRel|x64.Build.0 = Debug|Any CPU + {C42F4CCB-9E65-4370-939A-527ACDBC4DA6}.MinSizeRel|Any CPU.ActiveCfg = Debug|Any CPU + {C42F4CCB-9E65-4370-939A-527ACDBC4DA6}.MinSizeRel|Any CPU.Build.0 = Debug|Any CPU + {C42F4CCB-9E65-4370-939A-527ACDBC4DA6}.MinSizeRel|x86.ActiveCfg = Debug|Any CPU + {C42F4CCB-9E65-4370-939A-527ACDBC4DA6}.MinSizeRel|x86.Build.0 = Debug|Any CPU + {C42F4CCB-9E65-4370-939A-527ACDBC4DA6}.Release|x64.ActiveCfg = Release|Any CPU + {C42F4CCB-9E65-4370-939A-527ACDBC4DA6}.Release|x64.Build.0 = Release|Any CPU + {C42F4CCB-9E65-4370-939A-527ACDBC4DA6}.Release|Any CPU.ActiveCfg = Release|Any CPU + {C42F4CCB-9E65-4370-939A-527ACDBC4DA6}.Release|Any CPU.Build.0 = Release|Any CPU + {C42F4CCB-9E65-4370-939A-527ACDBC4DA6}.Release|x86.ActiveCfg = Release|Any CPU + {C42F4CCB-9E65-4370-939A-527ACDBC4DA6}.Release|x86.Build.0 = Release|Any CPU + {C42F4CCB-9E65-4370-939A-527ACDBC4DA6}.RelWithDebInfo|x64.ActiveCfg = Debug|Any CPU + {C42F4CCB-9E65-4370-939A-527ACDBC4DA6}.RelWithDebInfo|x64.Build.0 = Debug|Any CPU + {C42F4CCB-9E65-4370-939A-527ACDBC4DA6}.RelWithDebInfo|Any CPU.ActiveCfg = Debug|Any CPU + {C42F4CCB-9E65-4370-939A-527ACDBC4DA6}.RelWithDebInfo|Any CPU.Build.0 = Debug|Any CPU + {C42F4CCB-9E65-4370-939A-527ACDBC4DA6}.RelWithDebInfo|x86.ActiveCfg = Debug|Any CPU + {C42F4CCB-9E65-4370-939A-527ACDBC4DA6}.RelWithDebInfo|x86.Build.0 = Debug|Any CPU + {802ECF0B-7264-4168-95D1-158E47FB65CC}.Debug|x64.ActiveCfg = Debug|Any CPU + {802ECF0B-7264-4168-95D1-158E47FB65CC}.Debug|x64.Build.0 = Debug|Any CPU + {802ECF0B-7264-4168-95D1-158E47FB65CC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {802ECF0B-7264-4168-95D1-158E47FB65CC}.Debug|Any CPU.Build.0 = Debug|Any CPU + {802ECF0B-7264-4168-95D1-158E47FB65CC}.Debug|x86.ActiveCfg = Debug|Any CPU + {802ECF0B-7264-4168-95D1-158E47FB65CC}.Debug|x86.Build.0 = Debug|Any CPU + {802ECF0B-7264-4168-95D1-158E47FB65CC}.MinSizeRel|x64.ActiveCfg = Debug|Any CPU + {802ECF0B-7264-4168-95D1-158E47FB65CC}.MinSizeRel|x64.Build.0 = Debug|Any CPU + {802ECF0B-7264-4168-95D1-158E47FB65CC}.MinSizeRel|Any CPU.ActiveCfg = Debug|Any CPU + {802ECF0B-7264-4168-95D1-158E47FB65CC}.MinSizeRel|Any CPU.Build.0 = Debug|Any CPU + {802ECF0B-7264-4168-95D1-158E47FB65CC}.MinSizeRel|x86.ActiveCfg = Debug|Any CPU + {802ECF0B-7264-4168-95D1-158E47FB65CC}.MinSizeRel|x86.Build.0 = Debug|Any CPU + {802ECF0B-7264-4168-95D1-158E47FB65CC}.Release|x64.ActiveCfg = Release|Any CPU + {802ECF0B-7264-4168-95D1-158E47FB65CC}.Release|x64.Build.0 = Release|Any CPU + {802ECF0B-7264-4168-95D1-158E47FB65CC}.Release|Any CPU.ActiveCfg = Release|Any CPU + {802ECF0B-7264-4168-95D1-158E47FB65CC}.Release|Any CPU.Build.0 = Release|Any CPU + {802ECF0B-7264-4168-95D1-158E47FB65CC}.Release|x86.ActiveCfg = Release|Any CPU + {802ECF0B-7264-4168-95D1-158E47FB65CC}.Release|x86.Build.0 = Release|Any CPU + {802ECF0B-7264-4168-95D1-158E47FB65CC}.RelWithDebInfo|x64.ActiveCfg = Debug|Any CPU + {802ECF0B-7264-4168-95D1-158E47FB65CC}.RelWithDebInfo|x64.Build.0 = Debug|Any CPU + {802ECF0B-7264-4168-95D1-158E47FB65CC}.RelWithDebInfo|Any CPU.ActiveCfg = Debug|Any CPU + {802ECF0B-7264-4168-95D1-158E47FB65CC}.RelWithDebInfo|Any CPU.Build.0 = Debug|Any CPU + {802ECF0B-7264-4168-95D1-158E47FB65CC}.RelWithDebInfo|x86.ActiveCfg = Debug|Any CPU + {802ECF0B-7264-4168-95D1-158E47FB65CC}.RelWithDebInfo|x86.Build.0 = Debug|Any CPU + {95C5F6C0-88E5-4338-9A4F-614CF6C03CC0}.Debug|x64.ActiveCfg = Debug|Any CPU + {95C5F6C0-88E5-4338-9A4F-614CF6C03CC0}.Debug|x64.Build.0 = Debug|Any CPU + {95C5F6C0-88E5-4338-9A4F-614CF6C03CC0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {95C5F6C0-88E5-4338-9A4F-614CF6C03CC0}.Debug|Any CPU.Build.0 = Debug|Any CPU + {95C5F6C0-88E5-4338-9A4F-614CF6C03CC0}.Debug|x86.ActiveCfg = Debug|Any CPU + {95C5F6C0-88E5-4338-9A4F-614CF6C03CC0}.Debug|x86.Build.0 = Debug|Any CPU + {95C5F6C0-88E5-4338-9A4F-614CF6C03CC0}.MinSizeRel|x64.ActiveCfg = Debug|Any CPU + {95C5F6C0-88E5-4338-9A4F-614CF6C03CC0}.MinSizeRel|x64.Build.0 = Debug|Any CPU + {95C5F6C0-88E5-4338-9A4F-614CF6C03CC0}.MinSizeRel|Any CPU.ActiveCfg = Debug|Any CPU + {95C5F6C0-88E5-4338-9A4F-614CF6C03CC0}.MinSizeRel|Any CPU.Build.0 = Debug|Any CPU + {95C5F6C0-88E5-4338-9A4F-614CF6C03CC0}.MinSizeRel|x86.ActiveCfg = Debug|Any CPU + {95C5F6C0-88E5-4338-9A4F-614CF6C03CC0}.MinSizeRel|x86.Build.0 = Debug|Any CPU + {95C5F6C0-88E5-4338-9A4F-614CF6C03CC0}.Release|x64.ActiveCfg = Release|Any CPU + {95C5F6C0-88E5-4338-9A4F-614CF6C03CC0}.Release|x64.Build.0 = Release|Any CPU + {95C5F6C0-88E5-4338-9A4F-614CF6C03CC0}.Release|Any CPU.ActiveCfg = Release|Any CPU + {95C5F6C0-88E5-4338-9A4F-614CF6C03CC0}.Release|Any CPU.Build.0 = Release|Any CPU + {95C5F6C0-88E5-4338-9A4F-614CF6C03CC0}.Release|x86.ActiveCfg = Release|Any CPU + {95C5F6C0-88E5-4338-9A4F-614CF6C03CC0}.Release|x86.Build.0 = Release|Any CPU + {95C5F6C0-88E5-4338-9A4F-614CF6C03CC0}.RelWithDebInfo|x64.ActiveCfg = Debug|Any CPU + {95C5F6C0-88E5-4338-9A4F-614CF6C03CC0}.RelWithDebInfo|x64.Build.0 = Debug|Any CPU + {95C5F6C0-88E5-4338-9A4F-614CF6C03CC0}.RelWithDebInfo|Any CPU.ActiveCfg = Debug|Any CPU + {95C5F6C0-88E5-4338-9A4F-614CF6C03CC0}.RelWithDebInfo|Any CPU.Build.0 = Debug|Any CPU + {95C5F6C0-88E5-4338-9A4F-614CF6C03CC0}.RelWithDebInfo|x86.ActiveCfg = Debug|Any CPU + {95C5F6C0-88E5-4338-9A4F-614CF6C03CC0}.RelWithDebInfo|x86.Build.0 = Debug|Any CPU + {0354655D-2394-42BB-B1D4-2D75B9BCABF1}.Debug|x64.ActiveCfg = Debug|Any CPU + {0354655D-2394-42BB-B1D4-2D75B9BCABF1}.Debug|x64.Build.0 = Debug|Any CPU + {0354655D-2394-42BB-B1D4-2D75B9BCABF1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {0354655D-2394-42BB-B1D4-2D75B9BCABF1}.Debug|Any CPU.Build.0 = Debug|Any CPU + {0354655D-2394-42BB-B1D4-2D75B9BCABF1}.Debug|x86.ActiveCfg = Debug|Any CPU + {0354655D-2394-42BB-B1D4-2D75B9BCABF1}.Debug|x86.Build.0 = Debug|Any CPU + {0354655D-2394-42BB-B1D4-2D75B9BCABF1}.MinSizeRel|x64.ActiveCfg = Debug|Any CPU + {0354655D-2394-42BB-B1D4-2D75B9BCABF1}.MinSizeRel|x64.Build.0 = Debug|Any CPU + {0354655D-2394-42BB-B1D4-2D75B9BCABF1}.MinSizeRel|Any CPU.ActiveCfg = Debug|Any CPU + {0354655D-2394-42BB-B1D4-2D75B9BCABF1}.MinSizeRel|Any CPU.Build.0 = Debug|Any CPU + {0354655D-2394-42BB-B1D4-2D75B9BCABF1}.MinSizeRel|x86.ActiveCfg = Debug|Any CPU + {0354655D-2394-42BB-B1D4-2D75B9BCABF1}.MinSizeRel|x86.Build.0 = Debug|Any CPU + {0354655D-2394-42BB-B1D4-2D75B9BCABF1}.Release|x64.ActiveCfg = Release|Any CPU + {0354655D-2394-42BB-B1D4-2D75B9BCABF1}.Release|x64.Build.0 = Release|Any CPU + {0354655D-2394-42BB-B1D4-2D75B9BCABF1}.Release|Any CPU.ActiveCfg = Release|Any CPU + {0354655D-2394-42BB-B1D4-2D75B9BCABF1}.Release|Any CPU.Build.0 = Release|Any CPU + {0354655D-2394-42BB-B1D4-2D75B9BCABF1}.Release|x86.ActiveCfg = Release|Any CPU + {0354655D-2394-42BB-B1D4-2D75B9BCABF1}.Release|x86.Build.0 = Release|Any CPU + {0354655D-2394-42BB-B1D4-2D75B9BCABF1}.RelWithDebInfo|x64.ActiveCfg = Debug|Any CPU + {0354655D-2394-42BB-B1D4-2D75B9BCABF1}.RelWithDebInfo|x64.Build.0 = Debug|Any CPU + {0354655D-2394-42BB-B1D4-2D75B9BCABF1}.RelWithDebInfo|Any CPU.ActiveCfg = Debug|Any CPU + {0354655D-2394-42BB-B1D4-2D75B9BCABF1}.RelWithDebInfo|Any CPU.Build.0 = Debug|Any CPU + {0354655D-2394-42BB-B1D4-2D75B9BCABF1}.RelWithDebInfo|x86.ActiveCfg = Debug|Any CPU + {0354655D-2394-42BB-B1D4-2D75B9BCABF1}.RelWithDebInfo|x86.Build.0 = Debug|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -592,6 +696,10 @@ Global {385C4948-E080-56A6-E29E-8B0F4913175C} = {267F81EF-A8AB-49FD-9F56-D7EC3C1F7C7C} {43FB297B-7A4D-4835-A878-E6DF345B580C} = {385C4948-E080-56A6-E29E-8B0F4913175C} {BC277499-8215-4F9F-B9AB-07B6391110BF} = {385C4948-E080-56A6-E29E-8B0F4913175C} + {C42F4CCB-9E65-4370-939A-527ACDBC4DA6} = {385C4948-E080-56A6-E29E-8B0F4913175C} + {802ECF0B-7264-4168-95D1-158E47FB65CC} = {385C4948-E080-56A6-E29E-8B0F4913175C} + {95C5F6C0-88E5-4338-9A4F-614CF6C03CC0} = {385C4948-E080-56A6-E29E-8B0F4913175C} + {0354655D-2394-42BB-B1D4-2D75B9BCABF1} = {385C4948-E080-56A6-E29E-8B0F4913175C} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {422D1620-0166-4C26-9A81-CA8A2EB1AB58} diff --git a/spark_client.sln b/spark_client.sln index ebcd48db5..4cc614794 100644 --- a/spark_client.sln +++ b/spark_client.sln @@ -49,6 +49,14 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "spark_test", "src\client\sp EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Spark.Console", "src\client\Spark.Console\Spark.Console.csproj", "{2B8243FF-60C6-4607-8AAE-7762D29B0A48}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Bts.Collections", "src\cs\Bts.Collections\Bts.Collections.csproj", "{00D21F82-61F4-467F-B125-268018A185E5}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Bts.Core", "src\cs\Bts.Core\Bts.Core.csproj", "{513A3F0D-46B5-4AC2-B700-8671933F6347}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Bts.Disposables", "src\cs\Bts.Disposables\Bts.Disposables.csproj", "{D419D996-9870-4FF5-82AD-08370D1C945F}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Bts.Numerics", "src\cs\Bts.Numerics\Bts.Numerics.csproj", "{697BC3A3-1A98-43D3-A6E8-BB39A05EA049}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -275,6 +283,102 @@ Global {2B8243FF-60C6-4607-8AAE-7762D29B0A48}.Release|x64.Build.0 = Release|x64 {2B8243FF-60C6-4607-8AAE-7762D29B0A48}.Release|x86.ActiveCfg = Release|x64 {2B8243FF-60C6-4607-8AAE-7762D29B0A48}.Release|x86.Build.0 = Release|x64 + {00D21F82-61F4-467F-B125-268018A185E5}.Debug|x64.ActiveCfg = Debug|Any CPU + {00D21F82-61F4-467F-B125-268018A185E5}.Debug|x64.Build.0 = Debug|Any CPU + {00D21F82-61F4-467F-B125-268018A185E5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {00D21F82-61F4-467F-B125-268018A185E5}.Debug|Any CPU.Build.0 = Debug|Any CPU + {00D21F82-61F4-467F-B125-268018A185E5}.Debug|x86.ActiveCfg = Debug|Any CPU + {00D21F82-61F4-467F-B125-268018A185E5}.Debug|x86.Build.0 = Debug|Any CPU + {00D21F82-61F4-467F-B125-268018A185E5}.MinSizeRel|x64.ActiveCfg = Debug|Any CPU + {00D21F82-61F4-467F-B125-268018A185E5}.MinSizeRel|x64.Build.0 = Debug|Any CPU + {00D21F82-61F4-467F-B125-268018A185E5}.MinSizeRel|Any CPU.ActiveCfg = Debug|Any CPU + {00D21F82-61F4-467F-B125-268018A185E5}.MinSizeRel|Any CPU.Build.0 = Debug|Any CPU + {00D21F82-61F4-467F-B125-268018A185E5}.MinSizeRel|x86.ActiveCfg = Debug|Any CPU + {00D21F82-61F4-467F-B125-268018A185E5}.MinSizeRel|x86.Build.0 = Debug|Any CPU + {00D21F82-61F4-467F-B125-268018A185E5}.Release|x64.ActiveCfg = Release|Any CPU + {00D21F82-61F4-467F-B125-268018A185E5}.Release|x64.Build.0 = Release|Any CPU + {00D21F82-61F4-467F-B125-268018A185E5}.Release|Any CPU.ActiveCfg = Release|Any CPU + {00D21F82-61F4-467F-B125-268018A185E5}.Release|Any CPU.Build.0 = Release|Any CPU + {00D21F82-61F4-467F-B125-268018A185E5}.Release|x86.ActiveCfg = Release|Any CPU + {00D21F82-61F4-467F-B125-268018A185E5}.Release|x86.Build.0 = Release|Any CPU + {00D21F82-61F4-467F-B125-268018A185E5}.RelWithDebInfo|x64.ActiveCfg = Debug|Any CPU + {00D21F82-61F4-467F-B125-268018A185E5}.RelWithDebInfo|x64.Build.0 = Debug|Any CPU + {00D21F82-61F4-467F-B125-268018A185E5}.RelWithDebInfo|Any CPU.ActiveCfg = Debug|Any CPU + {00D21F82-61F4-467F-B125-268018A185E5}.RelWithDebInfo|Any CPU.Build.0 = Debug|Any CPU + {00D21F82-61F4-467F-B125-268018A185E5}.RelWithDebInfo|x86.ActiveCfg = Debug|Any CPU + {00D21F82-61F4-467F-B125-268018A185E5}.RelWithDebInfo|x86.Build.0 = Debug|Any CPU + {513A3F0D-46B5-4AC2-B700-8671933F6347}.Debug|x64.ActiveCfg = Debug|Any CPU + {513A3F0D-46B5-4AC2-B700-8671933F6347}.Debug|x64.Build.0 = Debug|Any CPU + {513A3F0D-46B5-4AC2-B700-8671933F6347}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {513A3F0D-46B5-4AC2-B700-8671933F6347}.Debug|Any CPU.Build.0 = Debug|Any CPU + {513A3F0D-46B5-4AC2-B700-8671933F6347}.Debug|x86.ActiveCfg = Debug|Any CPU + {513A3F0D-46B5-4AC2-B700-8671933F6347}.Debug|x86.Build.0 = Debug|Any CPU + {513A3F0D-46B5-4AC2-B700-8671933F6347}.MinSizeRel|x64.ActiveCfg = Debug|Any CPU + {513A3F0D-46B5-4AC2-B700-8671933F6347}.MinSizeRel|x64.Build.0 = Debug|Any CPU + {513A3F0D-46B5-4AC2-B700-8671933F6347}.MinSizeRel|Any CPU.ActiveCfg = Debug|Any CPU + {513A3F0D-46B5-4AC2-B700-8671933F6347}.MinSizeRel|Any CPU.Build.0 = Debug|Any CPU + {513A3F0D-46B5-4AC2-B700-8671933F6347}.MinSizeRel|x86.ActiveCfg = Debug|Any CPU + {513A3F0D-46B5-4AC2-B700-8671933F6347}.MinSizeRel|x86.Build.0 = Debug|Any CPU + {513A3F0D-46B5-4AC2-B700-8671933F6347}.Release|x64.ActiveCfg = Release|Any CPU + {513A3F0D-46B5-4AC2-B700-8671933F6347}.Release|x64.Build.0 = Release|Any CPU + {513A3F0D-46B5-4AC2-B700-8671933F6347}.Release|Any CPU.ActiveCfg = Release|Any CPU + {513A3F0D-46B5-4AC2-B700-8671933F6347}.Release|Any CPU.Build.0 = Release|Any CPU + {513A3F0D-46B5-4AC2-B700-8671933F6347}.Release|x86.ActiveCfg = Release|Any CPU + {513A3F0D-46B5-4AC2-B700-8671933F6347}.Release|x86.Build.0 = Release|Any CPU + {513A3F0D-46B5-4AC2-B700-8671933F6347}.RelWithDebInfo|x64.ActiveCfg = Debug|Any CPU + {513A3F0D-46B5-4AC2-B700-8671933F6347}.RelWithDebInfo|x64.Build.0 = Debug|Any CPU + {513A3F0D-46B5-4AC2-B700-8671933F6347}.RelWithDebInfo|Any CPU.ActiveCfg = Debug|Any CPU + {513A3F0D-46B5-4AC2-B700-8671933F6347}.RelWithDebInfo|Any CPU.Build.0 = Debug|Any CPU + {513A3F0D-46B5-4AC2-B700-8671933F6347}.RelWithDebInfo|x86.ActiveCfg = Debug|Any CPU + {513A3F0D-46B5-4AC2-B700-8671933F6347}.RelWithDebInfo|x86.Build.0 = Debug|Any CPU + {D419D996-9870-4FF5-82AD-08370D1C945F}.Debug|x64.ActiveCfg = Debug|Any CPU + {D419D996-9870-4FF5-82AD-08370D1C945F}.Debug|x64.Build.0 = Debug|Any CPU + {D419D996-9870-4FF5-82AD-08370D1C945F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D419D996-9870-4FF5-82AD-08370D1C945F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D419D996-9870-4FF5-82AD-08370D1C945F}.Debug|x86.ActiveCfg = Debug|Any CPU + {D419D996-9870-4FF5-82AD-08370D1C945F}.Debug|x86.Build.0 = Debug|Any CPU + {D419D996-9870-4FF5-82AD-08370D1C945F}.MinSizeRel|x64.ActiveCfg = Debug|Any CPU + {D419D996-9870-4FF5-82AD-08370D1C945F}.MinSizeRel|x64.Build.0 = Debug|Any CPU + {D419D996-9870-4FF5-82AD-08370D1C945F}.MinSizeRel|Any CPU.ActiveCfg = Debug|Any CPU + {D419D996-9870-4FF5-82AD-08370D1C945F}.MinSizeRel|Any CPU.Build.0 = Debug|Any CPU + {D419D996-9870-4FF5-82AD-08370D1C945F}.MinSizeRel|x86.ActiveCfg = Debug|Any CPU + {D419D996-9870-4FF5-82AD-08370D1C945F}.MinSizeRel|x86.Build.0 = Debug|Any CPU + {D419D996-9870-4FF5-82AD-08370D1C945F}.Release|x64.ActiveCfg = Release|Any CPU + {D419D996-9870-4FF5-82AD-08370D1C945F}.Release|x64.Build.0 = Release|Any CPU + {D419D996-9870-4FF5-82AD-08370D1C945F}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D419D996-9870-4FF5-82AD-08370D1C945F}.Release|Any CPU.Build.0 = Release|Any CPU + {D419D996-9870-4FF5-82AD-08370D1C945F}.Release|x86.ActiveCfg = Release|Any CPU + {D419D996-9870-4FF5-82AD-08370D1C945F}.Release|x86.Build.0 = Release|Any CPU + {D419D996-9870-4FF5-82AD-08370D1C945F}.RelWithDebInfo|x64.ActiveCfg = Debug|Any CPU + {D419D996-9870-4FF5-82AD-08370D1C945F}.RelWithDebInfo|x64.Build.0 = Debug|Any CPU + {D419D996-9870-4FF5-82AD-08370D1C945F}.RelWithDebInfo|Any CPU.ActiveCfg = Debug|Any CPU + {D419D996-9870-4FF5-82AD-08370D1C945F}.RelWithDebInfo|Any CPU.Build.0 = Debug|Any CPU + {D419D996-9870-4FF5-82AD-08370D1C945F}.RelWithDebInfo|x86.ActiveCfg = Debug|Any CPU + {D419D996-9870-4FF5-82AD-08370D1C945F}.RelWithDebInfo|x86.Build.0 = Debug|Any CPU + {697BC3A3-1A98-43D3-A6E8-BB39A05EA049}.Debug|x64.ActiveCfg = Debug|Any CPU + {697BC3A3-1A98-43D3-A6E8-BB39A05EA049}.Debug|x64.Build.0 = Debug|Any CPU + {697BC3A3-1A98-43D3-A6E8-BB39A05EA049}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {697BC3A3-1A98-43D3-A6E8-BB39A05EA049}.Debug|Any CPU.Build.0 = Debug|Any CPU + {697BC3A3-1A98-43D3-A6E8-BB39A05EA049}.Debug|x86.ActiveCfg = Debug|Any CPU + {697BC3A3-1A98-43D3-A6E8-BB39A05EA049}.Debug|x86.Build.0 = Debug|Any CPU + {697BC3A3-1A98-43D3-A6E8-BB39A05EA049}.MinSizeRel|x64.ActiveCfg = Debug|Any CPU + {697BC3A3-1A98-43D3-A6E8-BB39A05EA049}.MinSizeRel|x64.Build.0 = Debug|Any CPU + {697BC3A3-1A98-43D3-A6E8-BB39A05EA049}.MinSizeRel|Any CPU.ActiveCfg = Debug|Any CPU + {697BC3A3-1A98-43D3-A6E8-BB39A05EA049}.MinSizeRel|Any CPU.Build.0 = Debug|Any CPU + {697BC3A3-1A98-43D3-A6E8-BB39A05EA049}.MinSizeRel|x86.ActiveCfg = Debug|Any CPU + {697BC3A3-1A98-43D3-A6E8-BB39A05EA049}.MinSizeRel|x86.Build.0 = Debug|Any CPU + {697BC3A3-1A98-43D3-A6E8-BB39A05EA049}.Release|x64.ActiveCfg = Release|Any CPU + {697BC3A3-1A98-43D3-A6E8-BB39A05EA049}.Release|x64.Build.0 = Release|Any CPU + {697BC3A3-1A98-43D3-A6E8-BB39A05EA049}.Release|Any CPU.ActiveCfg = Release|Any CPU + {697BC3A3-1A98-43D3-A6E8-BB39A05EA049}.Release|Any CPU.Build.0 = Release|Any CPU + {697BC3A3-1A98-43D3-A6E8-BB39A05EA049}.Release|x86.ActiveCfg = Release|Any CPU + {697BC3A3-1A98-43D3-A6E8-BB39A05EA049}.Release|x86.Build.0 = Release|Any CPU + {697BC3A3-1A98-43D3-A6E8-BB39A05EA049}.RelWithDebInfo|x64.ActiveCfg = Debug|Any CPU + {697BC3A3-1A98-43D3-A6E8-BB39A05EA049}.RelWithDebInfo|x64.Build.0 = Debug|Any CPU + {697BC3A3-1A98-43D3-A6E8-BB39A05EA049}.RelWithDebInfo|Any CPU.ActiveCfg = Debug|Any CPU + {697BC3A3-1A98-43D3-A6E8-BB39A05EA049}.RelWithDebInfo|Any CPU.Build.0 = Debug|Any CPU + {697BC3A3-1A98-43D3-A6E8-BB39A05EA049}.RelWithDebInfo|x86.ActiveCfg = Debug|Any CPU + {697BC3A3-1A98-43D3-A6E8-BB39A05EA049}.RelWithDebInfo|x86.Build.0 = Debug|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -302,5 +406,9 @@ Global {D432F3E9-3D2F-4623-B7B9-CEBA6701FFC3} = {42C014A0-00C5-0620-8552-38912E891A7F} {DD00F5D5-6C2F-4FDA-AE3D-25CF01A9A224} = {C5A3B5EA-BE9F-76E5-E9B8-8A22B289B295} {2B8243FF-60C6-4607-8AAE-7762D29B0A48} = {C5A3B5EA-BE9F-76E5-E9B8-8A22B289B295} + {00D21F82-61F4-467F-B125-268018A185E5} = {D7C6B9C7-1058-B1EA-FEE6-34C56B05AEDB} + {513A3F0D-46B5-4AC2-B700-8671933F6347} = {D7C6B9C7-1058-B1EA-FEE6-34C56B05AEDB} + {D419D996-9870-4FF5-82AD-08370D1C945F} = {D7C6B9C7-1058-B1EA-FEE6-34C56B05AEDB} + {697BC3A3-1A98-43D3-A6E8-BB39A05EA049} = {D7C6B9C7-1058-B1EA-FEE6-34C56B05AEDB} EndGlobalSection EndGlobal diff --git a/src/DataStreamSuite/DataStreamSuite.sln b/src/DataStreamSuite/DataStreamSuite.sln index caa78099b..8cbdb8b7e 100644 --- a/src/DataStreamSuite/DataStreamSuite.sln +++ b/src/DataStreamSuite/DataStreamSuite.sln @@ -43,6 +43,14 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Bts.Net", "..\cs\Bts.Net\Bt EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Bts.IO.Compression", "..\cs\Bts.IO.Compression\Bts.IO.Compression.csproj", "{3BF059B0-51C0-44A8-8297-9B7464DC5BA3}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Bts.Collections", "..\cs\Bts.Collections\Bts.Collections.csproj", "{ADBEBCB3-5367-431B-AFC8-F57CAF9F029D}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Bts.Core", "..\cs\Bts.Core\Bts.Core.csproj", "{4E3D817D-9A0A-40F4-A1A1-4865375F40DD}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Bts.Disposables", "..\cs\Bts.Disposables\Bts.Disposables.csproj", "{ED034E82-07F4-473D-9C3A-F5EF9C961CFD}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Bts.Numerics", "..\cs\Bts.Numerics\Bts.Numerics.csproj", "{9A3E289A-3A88-4A76-AD0B-32C12EBA1B8B}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -293,6 +301,54 @@ Global {3BF059B0-51C0-44A8-8297-9B7464DC5BA3}.Release|x64.Build.0 = Release|Any CPU {3BF059B0-51C0-44A8-8297-9B7464DC5BA3}.Release|x86.ActiveCfg = Release|Any CPU {3BF059B0-51C0-44A8-8297-9B7464DC5BA3}.Release|x86.Build.0 = Release|Any CPU + {ADBEBCB3-5367-431B-AFC8-F57CAF9F029D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {ADBEBCB3-5367-431B-AFC8-F57CAF9F029D}.Debug|Any CPU.Build.0 = Debug|Any CPU + {ADBEBCB3-5367-431B-AFC8-F57CAF9F029D}.Debug|x64.ActiveCfg = Debug|Any CPU + {ADBEBCB3-5367-431B-AFC8-F57CAF9F029D}.Debug|x64.Build.0 = Debug|Any CPU + {ADBEBCB3-5367-431B-AFC8-F57CAF9F029D}.Debug|x86.ActiveCfg = Debug|Any CPU + {ADBEBCB3-5367-431B-AFC8-F57CAF9F029D}.Debug|x86.Build.0 = Debug|Any CPU + {ADBEBCB3-5367-431B-AFC8-F57CAF9F029D}.Release|Any CPU.ActiveCfg = Release|Any CPU + {ADBEBCB3-5367-431B-AFC8-F57CAF9F029D}.Release|Any CPU.Build.0 = Release|Any CPU + {ADBEBCB3-5367-431B-AFC8-F57CAF9F029D}.Release|x64.ActiveCfg = Release|Any CPU + {ADBEBCB3-5367-431B-AFC8-F57CAF9F029D}.Release|x64.Build.0 = Release|Any CPU + {ADBEBCB3-5367-431B-AFC8-F57CAF9F029D}.Release|x86.ActiveCfg = Release|Any CPU + {ADBEBCB3-5367-431B-AFC8-F57CAF9F029D}.Release|x86.Build.0 = Release|Any CPU + {4E3D817D-9A0A-40F4-A1A1-4865375F40DD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {4E3D817D-9A0A-40F4-A1A1-4865375F40DD}.Debug|Any CPU.Build.0 = Debug|Any CPU + {4E3D817D-9A0A-40F4-A1A1-4865375F40DD}.Debug|x64.ActiveCfg = Debug|Any CPU + {4E3D817D-9A0A-40F4-A1A1-4865375F40DD}.Debug|x64.Build.0 = Debug|Any CPU + {4E3D817D-9A0A-40F4-A1A1-4865375F40DD}.Debug|x86.ActiveCfg = Debug|Any CPU + {4E3D817D-9A0A-40F4-A1A1-4865375F40DD}.Debug|x86.Build.0 = Debug|Any CPU + {4E3D817D-9A0A-40F4-A1A1-4865375F40DD}.Release|Any CPU.ActiveCfg = Release|Any CPU + {4E3D817D-9A0A-40F4-A1A1-4865375F40DD}.Release|Any CPU.Build.0 = Release|Any CPU + {4E3D817D-9A0A-40F4-A1A1-4865375F40DD}.Release|x64.ActiveCfg = Release|Any CPU + {4E3D817D-9A0A-40F4-A1A1-4865375F40DD}.Release|x64.Build.0 = Release|Any CPU + {4E3D817D-9A0A-40F4-A1A1-4865375F40DD}.Release|x86.ActiveCfg = Release|Any CPU + {4E3D817D-9A0A-40F4-A1A1-4865375F40DD}.Release|x86.Build.0 = Release|Any CPU + {ED034E82-07F4-473D-9C3A-F5EF9C961CFD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {ED034E82-07F4-473D-9C3A-F5EF9C961CFD}.Debug|Any CPU.Build.0 = Debug|Any CPU + {ED034E82-07F4-473D-9C3A-F5EF9C961CFD}.Debug|x64.ActiveCfg = Debug|Any CPU + {ED034E82-07F4-473D-9C3A-F5EF9C961CFD}.Debug|x64.Build.0 = Debug|Any CPU + {ED034E82-07F4-473D-9C3A-F5EF9C961CFD}.Debug|x86.ActiveCfg = Debug|Any CPU + {ED034E82-07F4-473D-9C3A-F5EF9C961CFD}.Debug|x86.Build.0 = Debug|Any CPU + {ED034E82-07F4-473D-9C3A-F5EF9C961CFD}.Release|Any CPU.ActiveCfg = Release|Any CPU + {ED034E82-07F4-473D-9C3A-F5EF9C961CFD}.Release|Any CPU.Build.0 = Release|Any CPU + {ED034E82-07F4-473D-9C3A-F5EF9C961CFD}.Release|x64.ActiveCfg = Release|Any CPU + {ED034E82-07F4-473D-9C3A-F5EF9C961CFD}.Release|x64.Build.0 = Release|Any CPU + {ED034E82-07F4-473D-9C3A-F5EF9C961CFD}.Release|x86.ActiveCfg = Release|Any CPU + {ED034E82-07F4-473D-9C3A-F5EF9C961CFD}.Release|x86.Build.0 = Release|Any CPU + {9A3E289A-3A88-4A76-AD0B-32C12EBA1B8B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {9A3E289A-3A88-4A76-AD0B-32C12EBA1B8B}.Debug|Any CPU.Build.0 = Debug|Any CPU + {9A3E289A-3A88-4A76-AD0B-32C12EBA1B8B}.Debug|x64.ActiveCfg = Debug|Any CPU + {9A3E289A-3A88-4A76-AD0B-32C12EBA1B8B}.Debug|x64.Build.0 = Debug|Any CPU + {9A3E289A-3A88-4A76-AD0B-32C12EBA1B8B}.Debug|x86.ActiveCfg = Debug|Any CPU + {9A3E289A-3A88-4A76-AD0B-32C12EBA1B8B}.Debug|x86.Build.0 = Debug|Any CPU + {9A3E289A-3A88-4A76-AD0B-32C12EBA1B8B}.Release|Any CPU.ActiveCfg = Release|Any CPU + {9A3E289A-3A88-4A76-AD0B-32C12EBA1B8B}.Release|Any CPU.Build.0 = Release|Any CPU + {9A3E289A-3A88-4A76-AD0B-32C12EBA1B8B}.Release|x64.ActiveCfg = Release|Any CPU + {9A3E289A-3A88-4A76-AD0B-32C12EBA1B8B}.Release|x64.Build.0 = Release|Any CPU + {9A3E289A-3A88-4A76-AD0B-32C12EBA1B8B}.Release|x86.ActiveCfg = Release|Any CPU + {9A3E289A-3A88-4A76-AD0B-32C12EBA1B8B}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/src/client/spark/Controller/KeyedTemplateSelector.cs b/src/client/spark/Controller/KeyedTemplateSelector.cs index f29f9f78b..529608c32 100644 --- a/src/client/spark/Controller/KeyedTemplateSelector.cs +++ b/src/client/spark/Controller/KeyedTemplateSelector.cs @@ -2,6 +2,8 @@ namespace mbts.ui { using bts.collections; + using Spark.Core; + using System.Collections; using System.Windows; using System.Windows.Controls; @@ -9,7 +11,7 @@ namespace mbts.ui { [ContentProperty(nameof(Map))] class KeyedTemplateSelector : DataTemplateSelector { - readonly KeyedCollection _map = new(kv => kv.Key); + readonly KeyedCollection _map = new(kv => kv.Key ?? Optional.Empty); public IList Map => _map; public DataTemplate? Default { get; set; } diff --git a/src/client/spark/Modules/Trading/AlgoStudio/VM/AlgoDefinitionVM.cs b/src/client/spark/Modules/Trading/AlgoStudio/VM/AlgoDefinitionVM.cs index 74184dd08..0e9aeea9b 100644 --- a/src/client/spark/Modules/Trading/AlgoStudio/VM/AlgoDefinitionVM.cs +++ b/src/client/spark/Modules/Trading/AlgoStudio/VM/AlgoDefinitionVM.cs @@ -4,6 +4,8 @@ using bts.collections; using bts.proto; using bts.utils; +using Bts.Collections; + using mbts.collections; using mbts.spark.utilities; using mbts.ui; diff --git a/src/client/spark/Modules/Trading/OrderBook/OrderBookVM.cs b/src/client/spark/Modules/Trading/OrderBook/OrderBookVM.cs index 8525e531c..4b1c01052 100644 --- a/src/client/spark/Modules/Trading/OrderBook/OrderBookVM.cs +++ b/src/client/spark/Modules/Trading/OrderBook/OrderBookVM.cs @@ -41,6 +41,7 @@ using System.Windows.Controls; using System.Windows.Input; using Columns = mbts.spark.OrderBookGridView.ColumnKeys; +using NumericExceptionAssert = Bts.Numerics.Diagnostics.ExceptionAssert; namespace mbts.spark { partial class OrderBookVM : DisposableViewModelBase, IHandleRowSelection, IHandleGridSorting, IRequestRowSelection { @@ -791,7 +792,7 @@ namespace mbts.spark { double validate_price() { if (price.HasValue) { - ExceptionAssert.NumericArgument.is_real(price.Value, nameof(price)); + NumericExceptionAssert.Argument.is_real(price.Value, nameof(price)); return price.Value; } return row.price; @@ -799,7 +800,7 @@ namespace mbts.spark { double validate_quantity() { if (quantity.HasValue) { - ExceptionAssert.NumericArgument.is_real_non_zero(quantity.Value, nameof(quantity)); + NumericExceptionAssert.Argument.is_real_non_zero(quantity.Value, nameof(quantity)); return quantity.Value; } return row.quantity; diff --git a/src/cs/Bts.Spark.Core/Collections/AggregateCollection.cs b/src/cs/Bts.Collections/AggregateCollection.cs similarity index 100% rename from src/cs/Bts.Spark.Core/Collections/AggregateCollection.cs rename to src/cs/Bts.Collections/AggregateCollection.cs diff --git a/src/cs/Bts.Spark.Core/Collections/AggregateDictionary.cs b/src/cs/Bts.Collections/AggregateDictionary.cs similarity index 100% rename from src/cs/Bts.Spark.Core/Collections/AggregateDictionary.cs rename to src/cs/Bts.Collections/AggregateDictionary.cs diff --git a/src/cs/Bts.Spark.Core/Collections/AggregateDictionaryEnumerator.cs b/src/cs/Bts.Collections/AggregateDictionaryEnumerator.cs similarity index 100% rename from src/cs/Bts.Spark.Core/Collections/AggregateDictionaryEnumerator.cs rename to src/cs/Bts.Collections/AggregateDictionaryEnumerator.cs diff --git a/src/cs/Bts.Spark.Core/Collections/AggregateEnumerator.cs b/src/cs/Bts.Collections/AggregateEnumerator.cs similarity index 100% rename from src/cs/Bts.Spark.Core/Collections/AggregateEnumerator.cs rename to src/cs/Bts.Collections/AggregateEnumerator.cs diff --git a/src/cs/Bts.Spark.Core/Collections/AggregateList.cs b/src/cs/Bts.Collections/AggregateList.cs similarity index 100% rename from src/cs/Bts.Spark.Core/Collections/AggregateList.cs rename to src/cs/Bts.Collections/AggregateList.cs diff --git a/src/cs/Bts.Spark.Core/Collections/ArrayFactory.cs b/src/cs/Bts.Collections/ArrayFactory.cs similarity index 100% rename from src/cs/Bts.Spark.Core/Collections/ArrayFactory.cs rename to src/cs/Bts.Collections/ArrayFactory.cs diff --git a/src/cs/Bts.Spark.Core/utils/ArrayUtils.cs b/src/cs/Bts.Collections/ArrayUtils.cs similarity index 89% rename from src/cs/Bts.Spark.Core/utils/ArrayUtils.cs rename to src/cs/Bts.Collections/ArrayUtils.cs index 664eed1e3..264a14a19 100644 --- a/src/cs/Bts.Spark.Core/utils/ArrayUtils.cs +++ b/src/cs/Bts.Collections/ArrayUtils.cs @@ -1,8 +1,4 @@ -using Spark.Core.Diagnostics; - -using System; using System.Collections; -using System.Collections.Generic; namespace bts.utils { public static class ArrayHelper { @@ -95,14 +91,10 @@ namespace bts.utils { public static void insert(ref T[] array, int index, T value, ref int size) { // validate size/index - if (size < 0) - throw ExceptionBuilder.ArgumentOutOfRange.lt_zero(nameof(size)); - if (size > array.Length) - throw ExceptionBuilder.ArgumentOutOfRange.gt_length(nameof(size)); - if (index < 0) - throw ExceptionBuilder.IndexOutOfRange.lt_zero(); - if (index > size) - throw ExceptionBuilder.IndexOutOfRange.gt_length(); + ArgumentOutOfRangeException.ThrowIfLessThan(size, 0); + ArgumentOutOfRangeException.ThrowIfGreaterThan(size, array.Length); + ArgumentOutOfRangeException.ThrowIfLessThan(index, 0); + ArgumentOutOfRangeException.ThrowIfGreaterThan(index, size); T[] old_array = array; checked { if (size == array.Length) { @@ -123,14 +115,10 @@ namespace bts.utils { public static void remove_at(ref T[] array, ref int size, int index) { // validate size/index - if (size < 0) - throw ExceptionBuilder.ArgumentOutOfRange.lt_zero(nameof(size)); - if (size > array.Length) - throw ExceptionBuilder.ArgumentOutOfRange.gte_length(nameof(size)); - if (index < 0) - throw ExceptionBuilder.IndexOutOfRange.lt_zero(); - if (index >= size) - throw ExceptionBuilder.IndexOutOfRange.gte_length(); + ArgumentOutOfRangeException.ThrowIfLessThan(size, 0); + ArgumentOutOfRangeException.ThrowIfGreaterThan(size, array.Length); + ArgumentOutOfRangeException.ThrowIfLessThan(index, 0); + ArgumentOutOfRangeException.ThrowIfGreaterThanOrEqual(index, size); // shift [any]items right of 'index' left 1 pos. if (index < size - 1) { Array.Copy(array, index + 1, array, index, size - index - 1); diff --git a/src/cs/Bts.Spark.Core/Collections/AtomicDictionaryWrapper.cs b/src/cs/Bts.Collections/AtomicDictionaryWrapper.cs similarity index 100% rename from src/cs/Bts.Spark.Core/Collections/AtomicDictionaryWrapper.cs rename to src/cs/Bts.Collections/AtomicDictionaryWrapper.cs diff --git a/src/cs/Bts.Spark.Core/Collections/BlockTransaction.cs b/src/cs/Bts.Collections/BlockTransaction.cs similarity index 100% rename from src/cs/Bts.Spark.Core/Collections/BlockTransaction.cs rename to src/cs/Bts.Collections/BlockTransaction.cs diff --git a/src/cs/Bts.Spark.Core/Collections/BlockTransactionEnumerable.cs b/src/cs/Bts.Collections/BlockTransactionEnumerable.cs similarity index 96% rename from src/cs/Bts.Spark.Core/Collections/BlockTransactionEnumerable.cs rename to src/cs/Bts.Collections/BlockTransactionEnumerable.cs index 6e95e1f26..6c65263da 100644 --- a/src/cs/Bts.Spark.Core/Collections/BlockTransactionEnumerable.cs +++ b/src/cs/Bts.Collections/BlockTransactionEnumerable.cs @@ -145,8 +145,8 @@ public static class BlockTransactionEnumerable { return; } - Log.assert(srcStartIdx >= 0); - Log.assert(dstStartIdx >= 0); + ArgumentOutOfRangeException.ThrowIfLessThan(srcStartIdx, 0); + ArgumentOutOfRangeException.ThrowIfLessThan(dstStartIdx, 0); var sourceSliceLength = srcStopIdx - srcStartIdx; var destSliceLength = dstStopIdx - dstStartIdx; var lengthChange = destSliceLength - sourceSliceLength; @@ -154,7 +154,9 @@ public static class BlockTransactionEnumerable { var removes = new List(); using var en = blocks.GetEnumerator(); if (!en.MoveNext() || en.Current.DestIndex >= dstStopIdx) { - Log.assert(destSliceLength == sourceSliceLength); + if (destSliceLength != sourceSliceLength) { + throw new ArgumentException("BlockTransactions didn't yield expected result (newValues)", nameof(newValues)); + } for (int i = 0; i < -lengthChange; i++) { removes.Add(srcStopIdx + lengthChange + i); } @@ -224,13 +226,13 @@ public class BlockTransactionEnumerable : IEnumerable> { while (true) { int? del = delCursor < sortedDeletes.Count ? sortedDeletes[delCursor] : null; if (del.HasValue && delCursor > lastDelCursor) { - Log.assert(del.Value > lastDel); + ArgumentOutOfRangeException.ThrowIfLessThanOrEqual(del.Value, lastDel); lastDel = del.Value; lastDelCursor = delCursor; } (int Index, T Value)? add = addCursor < sortedAdds.Count ? sortedAdds[addCursor] : null; if (add.HasValue && addCursor > lastAddCursor) { - Log.assert(add.Value.Index >= lastAddIndex); + ArgumentOutOfRangeException.ThrowIfLessThan(add.Value.Index, lastAddIndex); lastAddIndex = add.Value.Index; lastAddCursor = addCursor; } diff --git a/src/cs/Bts.Spark.Core/Collections/BlockTransactionMetadata.cs b/src/cs/Bts.Collections/BlockTransactionMetadata.cs similarity index 100% rename from src/cs/Bts.Spark.Core/Collections/BlockTransactionMetadata.cs rename to src/cs/Bts.Collections/BlockTransactionMetadata.cs diff --git a/src/cs/Bts.Collections/Bts.Collections.csproj b/src/cs/Bts.Collections/Bts.Collections.csproj new file mode 100644 index 000000000..8aaa50c36 --- /dev/null +++ b/src/cs/Bts.Collections/Bts.Collections.csproj @@ -0,0 +1,24 @@ + + + + net8.0 + enable + enable + + + + + + + + + + + + + + + + + + diff --git a/src/cs/Bts.Spark.Core/utils/CallbackBuffer.cs b/src/cs/Bts.Collections/CallbackBuffer.cs similarity index 100% rename from src/cs/Bts.Spark.Core/utils/CallbackBuffer.cs rename to src/cs/Bts.Collections/CallbackBuffer.cs diff --git a/src/cs/Bts.Spark.Core/Collections/CircularBuffer.cs b/src/cs/Bts.Collections/CircularBuffer.cs similarity index 94% rename from src/cs/Bts.Spark.Core/Collections/CircularBuffer.cs rename to src/cs/Bts.Collections/CircularBuffer.cs index 5313fc1a0..5fd51f3ff 100644 --- a/src/cs/Bts.Spark.Core/Collections/CircularBuffer.cs +++ b/src/cs/Bts.Collections/CircularBuffer.cs @@ -2,11 +2,9 @@ namespace Spark.Core.Collections; -using bts; -using bts.collections; using bts.utils; -using Spark.Core.Diagnostics; +using Bts.Collections.Diagnostics; using System; using System.Collections; @@ -24,8 +22,10 @@ public class CircularBuffer : IList, IReadOnlyList { public CircularBuffer(int capacity, int initialCapacity) { this.capacity = capacity; - ExceptionAssert.Argument.GreaterThanEqualTo(capacity, 0); - items = new T[initialCapacity.within_range(0, capacity)]; + ArgumentOutOfRangeException.ThrowIfLessThan(capacity, 0); + ArgumentOutOfRangeException.ThrowIfLessThan(initialCapacity, 0); + initialCapacity = Math.Min(initialCapacity, 0); + items = new T[initialCapacity]; } public T this[int index] { @@ -109,8 +109,13 @@ public class CircularBuffer : IList, IReadOnlyList { public void AddRange(IList itemList) { int count = itemList.Count; int nFree = capacity - this.count; + if (nFree < 0) { + throw new InvalidOperationException("Invalid internal state, Count exceeds Capacity"); + } if (nFree > 0) { - Log.assert(origin == 0); + if (origin != 0) { + throw new InvalidOperationException("Origin index must be zero when there are free elements"); + } if (nFree > count) { for (int i = 0; i < nFree; i++) { items[i + this.count] = itemList[i]; @@ -127,7 +132,6 @@ public class CircularBuffer : IList, IReadOnlyList { this.count += count; } } else { - Log.assert(nFree == 0); if (count < capacity) { int start = origin - count; if (start < 0) { diff --git a/src/cs/Bts.Spark.Core/Collections/Extensions/CollectionExtensions.cs b/src/cs/Bts.Collections/CollectionExtensions.cs similarity index 100% rename from src/cs/Bts.Spark.Core/Collections/Extensions/CollectionExtensions.cs rename to src/cs/Bts.Collections/CollectionExtensions.cs diff --git a/src/cs/Bts.Spark.Core/utils/CollectionHelper.cs b/src/cs/Bts.Collections/CollectionHelper.cs similarity index 98% rename from src/cs/Bts.Spark.Core/utils/CollectionHelper.cs rename to src/cs/Bts.Collections/CollectionHelper.cs index 758201c7e..13ef6efc4 100644 --- a/src/cs/Bts.Spark.Core/utils/CollectionHelper.cs +++ b/src/cs/Bts.Collections/CollectionHelper.cs @@ -1,7 +1,7 @@ namespace bts.utils { using bts.collections; - using Spark.Core; + using Spark.Core.Collections; using Spark.Core.Disposables; using System; @@ -11,7 +11,7 @@ namespace bts.utils { using System.Linq; using System.Threading.Tasks; - static class CollectionHelper { + public static class CollectionHelper { public const string indexer_name = "Item[]"; public static int binary_search(IList items, T value) => @@ -44,7 +44,7 @@ namespace bts.utils { binary_search(items, value, 0, items.Count, comparer, key_selector); public static int binary_search(IList items, TKey key, int index, int length, IComparer comparer, Func key_selector) => - binary_search(items.WrapSelector(key_selector, null), key, index, length, comparer); + binary_search(new SelectorList(items, key_selector, null), key, index, length, comparer); /// /// Like , but doesn't require deterministic sort @@ -131,7 +131,8 @@ namespace bts.utils { _ => $"Unknown-action {e.Action}" }; - static string fmt_items(IList items) => ", ".join(items.Cast()); + static string fmt_items(IList items) => + string.Join(", ", items.Cast()); } public static void reflect_change(IList target, IEnumerable source, Func create_item, Action on_removed, NotifyCollectionChangedEventArgs e) { diff --git a/src/cs/Bts.Spark.Core/utils/CompareUtils.cs b/src/cs/Bts.Collections/CompareUtils.cs similarity index 100% rename from src/cs/Bts.Spark.Core/utils/CompareUtils.cs rename to src/cs/Bts.Collections/CompareUtils.cs diff --git a/src/cs/Bts.Spark.Core/utils/ComparerBuilder.cs b/src/cs/Bts.Collections/ComparerBuilder.cs similarity index 100% rename from src/cs/Bts.Spark.Core/utils/ComparerBuilder.cs rename to src/cs/Bts.Collections/ComparerBuilder.cs diff --git a/src/cs/Bts.Spark.Core/Collections/ComparerExtensions.cs b/src/cs/Bts.Collections/ComparerExtensions.cs similarity index 100% rename from src/cs/Bts.Spark.Core/Collections/ComparerExtensions.cs rename to src/cs/Bts.Collections/ComparerExtensions.cs diff --git a/src/cs/Bts.Spark.Core/Collections/ComparerWrapper.cs b/src/cs/Bts.Collections/ComparerWrapper.cs similarity index 100% rename from src/cs/Bts.Spark.Core/Collections/ComparerWrapper.cs rename to src/cs/Bts.Collections/ComparerWrapper.cs diff --git a/src/cs/Bts.Spark.Core/Collections/ConcurrentFactory.cs b/src/cs/Bts.Collections/ConcurrentFactory.cs similarity index 100% rename from src/cs/Bts.Spark.Core/Collections/ConcurrentFactory.cs rename to src/cs/Bts.Collections/ConcurrentFactory.cs diff --git a/src/cs/Bts.Spark.Core/utils/CovariantBox.cs b/src/cs/Bts.Collections/CovariantBox.cs similarity index 100% rename from src/cs/Bts.Spark.Core/utils/CovariantBox.cs rename to src/cs/Bts.Collections/CovariantBox.cs diff --git a/src/cs/Bts.Spark.Core/Collections/DeltaList.cs b/src/cs/Bts.Collections/DeltaList.cs similarity index 100% rename from src/cs/Bts.Spark.Core/Collections/DeltaList.cs rename to src/cs/Bts.Collections/DeltaList.cs diff --git a/src/cs/Bts.Spark.Core/Collections/Extensions/DictionaryExtensions.cs b/src/cs/Bts.Collections/DictionaryExtensions.cs similarity index 99% rename from src/cs/Bts.Spark.Core/Collections/Extensions/DictionaryExtensions.cs rename to src/cs/Bts.Collections/DictionaryExtensions.cs index 7fad737af..c9cdeb2e3 100644 --- a/src/cs/Bts.Spark.Core/Collections/Extensions/DictionaryExtensions.cs +++ b/src/cs/Bts.Collections/DictionaryExtensions.cs @@ -324,7 +324,7 @@ namespace System.Collections.Generic { var source_lookup = source.ToLookup(key_selector); HashSet changes = new HashSet(), removes = new HashSet(); foreach (var kv in dictionary) { - if (source_lookup.TryGetValue(kv.Key, out IEnumerable> result)) { + if (source_lookup.TryGetValue(kv.Key, out var result)) { update(kv, result); changes.Add(kv.Key); } else { diff --git a/src/cs/Bts.Spark.Core/Collections/DictionaryKeySet.cs b/src/cs/Bts.Collections/DictionaryKeySet.cs similarity index 100% rename from src/cs/Bts.Spark.Core/Collections/DictionaryKeySet.cs rename to src/cs/Bts.Collections/DictionaryKeySet.cs diff --git a/src/cs/Bts.Spark.Core/utils/Diff.cs b/src/cs/Bts.Collections/Diff.cs similarity index 98% rename from src/cs/Bts.Spark.Core/utils/Diff.cs rename to src/cs/Bts.Collections/Diff.cs index 0ba40dcc6..277c4f15a 100644 --- a/src/cs/Bts.Spark.Core/utils/Diff.cs +++ b/src/cs/Bts.Collections/Diff.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Linq; - -namespace bts.utils { +namespace bts.utils { // See http://xmailserver.org/diff2.pdf public static class Diff { diff --git a/src/cs/Bts.Spark.Core/Collections/EnumerableComparer.cs b/src/cs/Bts.Collections/EnumerableComparer.cs similarity index 100% rename from src/cs/Bts.Spark.Core/Collections/EnumerableComparer.cs rename to src/cs/Bts.Collections/EnumerableComparer.cs diff --git a/src/cs/Bts.Spark.Core/Collections/Extensions/EnumerableExtensions.cs b/src/cs/Bts.Collections/EnumerableExtensions.cs similarity index 98% rename from src/cs/Bts.Spark.Core/Collections/Extensions/EnumerableExtensions.cs rename to src/cs/Bts.Collections/EnumerableExtensions.cs index 2adaa90e5..72cb95d23 100644 --- a/src/cs/Bts.Spark.Core/Collections/Extensions/EnumerableExtensions.cs +++ b/src/cs/Bts.Collections/EnumerableExtensions.cs @@ -2,9 +2,9 @@ namespace System.Collections.Generic { using bts.utils; - using Spark.Core; + using Bts.Collections; + using Spark.Core.Collections; - using Spark.Core.Diagnostics; using System.Collections.Generic; using System.Collections.Immutable; @@ -13,8 +13,6 @@ namespace System.Collections.Generic { using System.Diagnostics.Contracts; using System.Linq; using System.Numerics; - using System.Reactive.Linq; - using System.Runtime.Versioning; public static class EnumerableExtensions { public static IEnumerable AggregateEach(this IEnumerable source, TAccumulate seed, Func accumulate) { @@ -110,16 +108,13 @@ namespace System.Collections.Generic { /// The easiest/most effective solution is to make a wrapper around the System.Linq fn /// (esp since the manner in which is used to construct a predicate /// with which to filter items from is unspecified). - /// - /// (as used here) provides a means to support both value and - /// reference types. source - .Select(item => (item: new Optional(item), result: selector(item))) + .Select(item => (item, selector(item))) .Except( - values.Select(result => (item: Optional.Empty, result)), - EqualityComparerWrapper<(Optional item, TResult result)>.wrap( + values.Select(result => (item: default(T)!, result)), + EqualityComparerWrapper<(T item, TResult result)>.wrap( t => t.result, comparer)) - .Select(tup => tup.item.value); + .Select(tup => tup.item!); public static IEnumerable Except(this IEnumerable enumerable, IEnumerable second, Func key_selector) => enumerable.Where(t => !second.Contains(key_selector(t))); @@ -191,8 +186,7 @@ namespace System.Collections.Generic { } public static bool CountAtLeast(this IEnumerable source, int count) { - if (count < 0) - throw new ArgumentException(ExceptionBuilder.Format.LessThan(0), nameof(count)); + ArgumentOutOfRangeException.ThrowIfLessThan(count, 0); if (count == 0) return true; foreach (var v in source) { @@ -203,8 +197,7 @@ namespace System.Collections.Generic { } public static bool CountAtMost(this IEnumerable source, int count) { - if (count < 0) - throw new ArgumentException(ExceptionBuilder.Format.LessThan(0), nameof(count)); + ArgumentOutOfRangeException.ThrowIfLessThan(count, 0); foreach (var v in source) { if (--count == -1) return false; @@ -213,9 +206,7 @@ namespace System.Collections.Generic { } public static bool CountExact(this IEnumerable source, int count) { - if (count < 0) { - throw new ArgumentException(ExceptionBuilder.Format.LessThan(0), nameof(count)); - } + ArgumentOutOfRangeException.ThrowIfLessThan(count, 0); foreach (var v in source) { if (--count == -1) { return false; @@ -1030,7 +1021,7 @@ namespace System.Collections.Generic { /// An that contains each element of the source sequence cast to the specified type. /// is null. public static IEnumerable convert(this IEnumerable source) { - ExceptionAssert.Argument.NotNull(source, nameof(source)); + ArgumentNullException.ThrowIfNull(source); foreach (object obj in source) yield return ConvertUtils.try_convert(obj); } diff --git a/src/cs/Bts.Spark.Core/utils_api/EqualityComparer.cs b/src/cs/Bts.Collections/EqualityComparer.cs similarity index 98% rename from src/cs/Bts.Spark.Core/utils_api/EqualityComparer.cs rename to src/cs/Bts.Collections/EqualityComparer.cs index 55f16e4b8..f2e352c3a 100644 --- a/src/cs/Bts.Spark.Core/utils_api/EqualityComparer.cs +++ b/src/cs/Bts.Collections/EqualityComparer.cs @@ -102,7 +102,8 @@ namespace bts.utils { auto_phase(items.Take(_max_auto_phase_buckets).ToList()); public static int auto_phase(IReadOnlyList hash_codes, int bit_span = 32) { - Log.assert(bit_span > 0 && bit_span <= 32); + ArgumentOutOfRangeException.ThrowIfLessThanOrEqual(bit_span, 0); + ArgumentOutOfRangeException.ThrowIfGreaterThan(bit_span, 32); // don't divide by zero if (hash_codes.Count == 0) return 0; diff --git a/src/cs/Bts.Spark.Core/Collections/EqualityComparerWrapper.cs b/src/cs/Bts.Collections/EqualityComparerWrapper.cs similarity index 100% rename from src/cs/Bts.Spark.Core/Collections/EqualityComparerWrapper.cs rename to src/cs/Bts.Collections/EqualityComparerWrapper.cs diff --git a/src/cs/Bts.Collections/ExceptionAssert.cs b/src/cs/Bts.Collections/ExceptionAssert.cs new file mode 100644 index 000000000..841287b55 --- /dev/null +++ b/src/cs/Bts.Collections/ExceptionAssert.cs @@ -0,0 +1,18 @@ +namespace Bts.Collections.Diagnostics { + public static class ExceptionAssert { + public static class Index { + public static void IsValid(int index, int length, bool canInsert = false) { + if (canInsert) { + if (index > length) { + throw ExceptionBuilder.IndexOutOfRange.gt_length(); + } + } else if (index >= length) { + throw ExceptionBuilder.IndexOutOfRange.gte_length(); + } + if (index < 0) { + throw ExceptionBuilder.IndexOutOfRange.lt_zero(); + } + } + } + } +} diff --git a/src/cs/Bts.Collections/ExceptionBuilder.cs b/src/cs/Bts.Collections/ExceptionBuilder.cs new file mode 100644 index 000000000..d2be9b704 --- /dev/null +++ b/src/cs/Bts.Collections/ExceptionBuilder.cs @@ -0,0 +1,14 @@ +namespace Bts.Collections.Diagnostics { + public static class ExceptionBuilder { + public static class IndexOutOfRange { + public static IndexOutOfRangeException lt_zero() => + new IndexOutOfRangeException("Index is less than 0"); + + public static IndexOutOfRangeException gt_length() => + new IndexOutOfRangeException("Index is greater than the number of elements."); + + public static IndexOutOfRangeException gte_length() => + new IndexOutOfRangeException("Index is greater than or equal to the number of elements."); + } + } +} diff --git a/src/cs/Bts.Spark.Core/Collections/GenericCollectionWrapper.cs b/src/cs/Bts.Collections/GenericCollectionWrapper.cs similarity index 97% rename from src/cs/Bts.Spark.Core/Collections/GenericCollectionWrapper.cs rename to src/cs/Bts.Collections/GenericCollectionWrapper.cs index a68b959a0..b659c61b9 100644 --- a/src/cs/Bts.Spark.Core/Collections/GenericCollectionWrapper.cs +++ b/src/cs/Bts.Collections/GenericCollectionWrapper.cs @@ -18,7 +18,7 @@ namespace Spark.DataStream { public GenericCollectionWrapper(ICollection source, Func? cast = null) { this.source = source; - this.cast = cast ?? ConvertUtils.try_convert; + this.cast = cast ?? new(obj => (T)obj); genericSource = source as ICollection; listSource = source as IList; } diff --git a/src/cs/Bts.Spark.Core/Collections/GenericDictionaryWrapper.cs b/src/cs/Bts.Collections/GenericDictionaryWrapper.cs similarity index 100% rename from src/cs/Bts.Spark.Core/Collections/GenericDictionaryWrapper.cs rename to src/cs/Bts.Collections/GenericDictionaryWrapper.cs diff --git a/src/cs/Bts.Spark.Core/Collections/HashSet.cs b/src/cs/Bts.Collections/HashSet.cs similarity index 100% rename from src/cs/Bts.Spark.Core/Collections/HashSet.cs rename to src/cs/Bts.Collections/HashSet.cs diff --git a/src/cs/Bts.Spark.Core/Collections/HierarchicalDictionary.cs b/src/cs/Bts.Collections/HierarchicalDictionary.cs similarity index 93% rename from src/cs/Bts.Spark.Core/Collections/HierarchicalDictionary.cs rename to src/cs/Bts.Collections/HierarchicalDictionary.cs index 59cb5dff7..c947b5f17 100644 --- a/src/cs/Bts.Spark.Core/Collections/HierarchicalDictionary.cs +++ b/src/cs/Bts.Collections/HierarchicalDictionary.cs @@ -1,9 +1,5 @@ #nullable enable namespace Spark.Core.Collections { - using bts.utils; - - using Spark.Core.Disposables; - using System; using System.Collections; using System.Collections.Generic; @@ -74,10 +70,10 @@ namespace Spark.Core.Collections { } public ICollection Keys => - _node?.Keys ?? CollectionHelper.empty(); + _node?.Keys as ICollection ?? Array.Empty(); public ICollection Values => - _node?.Values ?? CollectionHelper.empty(); + _node?.Values as ICollection ?? Array.Empty(); public int Count => _node?.Count ?? 0; @@ -94,8 +90,12 @@ namespace Spark.Core.Collections { public void Add(TKey2 key, TValue value) { var n = _node ?? new(); - using var _ = _begin_mutation(n); - n.Add(key, value); + var end = beginMutation(n); + try { + n.Add(key, value); + } finally { + end(); + } } public TValue this[TKey2 key] { @@ -108,8 +108,9 @@ namespace Spark.Core.Collections { } set { var n = _node ?? new(); - using var _ = _begin_mutation(n); + var end = beginMutation(n); n[key] = value; + end(); } } @@ -118,12 +119,13 @@ namespace Spark.Core.Collections { public void Clear() { var n = _node; - using var _ = _begin_mutation(n); if (n is null) { return; } + var end = beginMutation(n); _value_count -= n.Count; n.Clear(); + end(); } public bool Contains(KeyValuePair item) { @@ -152,8 +154,10 @@ namespace Spark.Core.Collections { if (n is null) { return false; } - using var _ = _begin_mutation(n); - return n.Remove(key); + var end = beginMutation(n); + bool rv = n.Remove(key); + end(); + return rv; } public bool Remove(KeyValuePair item) { @@ -161,8 +165,10 @@ namespace Spark.Core.Collections { if (n is null) { return false; } - using var _ = _begin_mutation(n); - return ((IDictionary)n).Remove(item); + var end = beginMutation(n); + var rv = ((IDictionary)n).Remove(item); + end(); + return rv; } public bool TryGetValue(TKey2 key, [MaybeNullWhen(false)] out TValue value) { @@ -181,19 +187,18 @@ namespace Spark.Core.Collections { /// Gets an that synchronizes this node with /// when it is disposed /// - IDisposable _begin_mutation(Dictionary? node) { - if (node is null) { - return Disposable.empty; - } + Action beginMutation(Dictionary node) { var orig_count = node.Count; - return Disposable.Create(() => { + return End; + + void End() { if (node.Count == 0) { _source._data.Remove(_node_key); } else if (node.Count > 0 && !_source._data.ContainsKey(_node_key)) { _source._data.Add(_node_key, node); } _value_count += node.Count - orig_count; - }); + } } } diff --git a/src/cs/Bts.Collections/IDualComparer.cs b/src/cs/Bts.Collections/IDualComparer.cs new file mode 100644 index 000000000..0dec3fb1c --- /dev/null +++ b/src/cs/Bts.Collections/IDualComparer.cs @@ -0,0 +1,9 @@ +namespace Spark.Core.Collections; + +using System.Collections; +using System.Collections.Generic; + +public interface IDualComparer : IComparer, IComparer { + int IComparer.Compare(object? x, object? y) => + Compare((T)x, (T)y); +} diff --git a/src/cs/Bts.Spark.Core/Collections/Extensions/ILookupExtensions.cs b/src/cs/Bts.Collections/ILookupExtensions.cs similarity index 80% rename from src/cs/Bts.Spark.Core/Collections/Extensions/ILookupExtensions.cs rename to src/cs/Bts.Collections/ILookupExtensions.cs index 3171c587e..76910e956 100644 --- a/src/cs/Bts.Spark.Core/Collections/Extensions/ILookupExtensions.cs +++ b/src/cs/Bts.Collections/ILookupExtensions.cs @@ -1,7 +1,4 @@ -using System.Collections.Generic; -using System.Linq; - -namespace bts.collections { +namespace bts.collections { public static class ILookupExtensions { public static bool TryGetValue(this ILookup self, TKey key, out IEnumerable value) { bool has_value = self.Contains(key); @@ -11,4 +8,4 @@ namespace bts.collections { return has_value; } } -} \ No newline at end of file +} diff --git a/src/cs/Bts.Spark.Core/Collections/IMutableCollectionFacade.cs b/src/cs/Bts.Collections/IMutableCollectionFacade.cs similarity index 100% rename from src/cs/Bts.Spark.Core/Collections/IMutableCollectionFacade.cs rename to src/cs/Bts.Collections/IMutableCollectionFacade.cs diff --git a/src/cs/Bts.Spark.Core/Collections/IMutableDictionaryFacade.cs b/src/cs/Bts.Collections/IMutableDictionaryFacade.cs similarity index 100% rename from src/cs/Bts.Spark.Core/Collections/IMutableDictionaryFacade.cs rename to src/cs/Bts.Collections/IMutableDictionaryFacade.cs diff --git a/src/cs/Bts.Spark.Core/Collections/IMutableListFacade.cs b/src/cs/Bts.Collections/IMutableListFacade.cs similarity index 100% rename from src/cs/Bts.Spark.Core/Collections/IMutableListFacade.cs rename to src/cs/Bts.Collections/IMutableListFacade.cs diff --git a/src/cs/Bts.Spark.Core/Collections/IObservableCollection.cs b/src/cs/Bts.Collections/IObservableCollection.cs similarity index 100% rename from src/cs/Bts.Spark.Core/Collections/IObservableCollection.cs rename to src/cs/Bts.Collections/IObservableCollection.cs diff --git a/src/cs/Bts.Spark.Core/Collections/IObservableCollectionAddRemoveOnly.cs b/src/cs/Bts.Collections/IObservableCollectionAddRemoveOnly.cs similarity index 100% rename from src/cs/Bts.Spark.Core/Collections/IObservableCollectionAddRemoveOnly.cs rename to src/cs/Bts.Collections/IObservableCollectionAddRemoveOnly.cs diff --git a/src/cs/Bts.Spark.Core/Collections/IReadOnlyObservableCollection.cs b/src/cs/Bts.Collections/IReadOnlyObservableCollection.cs similarity index 100% rename from src/cs/Bts.Spark.Core/Collections/IReadOnlyObservableCollection.cs rename to src/cs/Bts.Collections/IReadOnlyObservableCollection.cs diff --git a/src/cs/Bts.Spark.Core/Collections/Extensions/ImmutableDictionaryExtensions.cs b/src/cs/Bts.Collections/ImmutableDictionaryExtensions.cs similarity index 100% rename from src/cs/Bts.Spark.Core/Collections/Extensions/ImmutableDictionaryExtensions.cs rename to src/cs/Bts.Collections/ImmutableDictionaryExtensions.cs diff --git a/src/cs/Bts.Spark.Core/Collections/ImmutableDictionaryKeyCollection.cs b/src/cs/Bts.Collections/ImmutableDictionaryKeyCollection.cs similarity index 100% rename from src/cs/Bts.Spark.Core/Collections/ImmutableDictionaryKeyCollection.cs rename to src/cs/Bts.Collections/ImmutableDictionaryKeyCollection.cs diff --git a/src/cs/Bts.Spark.Core/Collections/ImmutableDictionaryValueCollection.cs b/src/cs/Bts.Collections/ImmutableDictionaryValueCollection.cs similarity index 100% rename from src/cs/Bts.Spark.Core/Collections/ImmutableDictionaryValueCollection.cs rename to src/cs/Bts.Collections/ImmutableDictionaryValueCollection.cs diff --git a/src/cs/Bts.Spark.Core/Collections/ImmutableInterlockedEx.cs b/src/cs/Bts.Collections/ImmutableInterlockedEx.cs similarity index 100% rename from src/cs/Bts.Spark.Core/Collections/ImmutableInterlockedEx.cs rename to src/cs/Bts.Collections/ImmutableInterlockedEx.cs diff --git a/src/cs/Bts.Spark.Core/Collections/Extensions/ImmutableListExtensions.cs b/src/cs/Bts.Collections/ImmutableListExtensions.cs similarity index 97% rename from src/cs/Bts.Spark.Core/Collections/Extensions/ImmutableListExtensions.cs rename to src/cs/Bts.Collections/ImmutableListExtensions.cs index e3844ec0f..58c54b46e 100644 --- a/src/cs/Bts.Spark.Core/Collections/Extensions/ImmutableListExtensions.cs +++ b/src/cs/Bts.Collections/ImmutableListExtensions.cs @@ -1,9 +1,8 @@ -#nullable enable namespace bts.collections { using System.Collections.Generic; using System.Collections.Immutable; - static class ImmutableListExtensions { + public static class ImmutableListExtensions { public static ImmutableList add_range(this ImmutableList list, IEnumerable items) { var bd = list.ToBuilder(); bd.AddRange(items); diff --git a/src/cs/Bts.Spark.Core/Collections/ImmutableOrderedDictionary.cs b/src/cs/Bts.Collections/ImmutableOrderedDictionary.cs similarity index 99% rename from src/cs/Bts.Spark.Core/Collections/ImmutableOrderedDictionary.cs rename to src/cs/Bts.Collections/ImmutableOrderedDictionary.cs index 302312edc..882662887 100644 --- a/src/cs/Bts.Spark.Core/Collections/ImmutableOrderedDictionary.cs +++ b/src/cs/Bts.Collections/ImmutableOrderedDictionary.cs @@ -370,7 +370,7 @@ public class ImmutableOrderedDictionary : IDictionary 0); + ArgumentOutOfRangeException.ThrowIfLessThanOrEqual(step, 0UL); var dataBd = data.Clear().ToBuilder(); var ordinalKeysBd = ordinalKeys.Clear().ToBuilder(); var ord = step * (1UL << 7); @@ -602,7 +602,7 @@ public class ImmutableOrderedDictionary : IDictionary 0); + ArgumentOutOfRangeException.ThrowIfLessThanOrEqual(step, 0UL); data.Clear(); ordinalKeys.Clear(); var ord = step * 1UL << 7; diff --git a/src/cs/Bts.Spark.Core/Collections/ImmutableOrderedSet.cs b/src/cs/Bts.Collections/ImmutableOrderedSet.cs similarity index 99% rename from src/cs/Bts.Spark.Core/Collections/ImmutableOrderedSet.cs rename to src/cs/Bts.Collections/ImmutableOrderedSet.cs index 67515e418..4005766c9 100644 --- a/src/cs/Bts.Spark.Core/Collections/ImmutableOrderedSet.cs +++ b/src/cs/Bts.Collections/ImmutableOrderedSet.cs @@ -332,7 +332,7 @@ public class ImmutableOrderedSet : IReadOnlySet, IList where T : notnul return Clear(); } var step = getStep(ulong.MaxValue, itemCountUL + 1UL << 8); - Log.assert(step > 0); + ArgumentOutOfRangeException.ThrowIfLessThanOrEqual(step, 0UL); var dataBd = data.Clear().ToBuilder(); var ordinalKeysBd = ordinalKeys.Clear().ToBuilder(); var ord = step * 1UL << 7; @@ -633,7 +633,7 @@ public class ImmutableOrderedSet : IReadOnlySet, IList where T : notnul return; } var step = getStep(ulong.MaxValue, itemCountUL + 1UL << 8); - Log.assert(step > 0); + ArgumentOutOfRangeException.ThrowIfLessThanOrEqual(step, 0UL); data.Clear(); ordinalKeys.Clear(); var ord = step * 1UL << 7; diff --git a/src/cs/Bts.Spark.Core/Collections/Extensions/ImmutableSetExtensions.cs b/src/cs/Bts.Collections/ImmutableSetExtensions.cs similarity index 100% rename from src/cs/Bts.Spark.Core/Collections/Extensions/ImmutableSetExtensions.cs rename to src/cs/Bts.Collections/ImmutableSetExtensions.cs diff --git a/src/cs/Bts.Spark.Core/Collections/IndexDependentSelectorList.cs b/src/cs/Bts.Collections/IndexDependentSelectorList.cs similarity index 100% rename from src/cs/Bts.Spark.Core/Collections/IndexDependentSelectorList.cs rename to src/cs/Bts.Collections/IndexDependentSelectorList.cs diff --git a/src/cs/Bts.Spark.Core/Collections/KeyValuePairComparer.cs b/src/cs/Bts.Collections/KeyValuePairComparer.cs similarity index 100% rename from src/cs/Bts.Spark.Core/Collections/KeyValuePairComparer.cs rename to src/cs/Bts.Collections/KeyValuePairComparer.cs diff --git a/src/cs/Bts.Spark.Core/Collections/KeyValuePairEqualityComparer.cs b/src/cs/Bts.Collections/KeyValuePairEqualityComparer.cs similarity index 100% rename from src/cs/Bts.Spark.Core/Collections/KeyValuePairEqualityComparer.cs rename to src/cs/Bts.Collections/KeyValuePairEqualityComparer.cs diff --git a/src/cs/Bts.Spark.Core/Collections/KeyedCollection.cs b/src/cs/Bts.Collections/KeyedCollection.cs similarity index 86% rename from src/cs/Bts.Spark.Core/Collections/KeyedCollection.cs rename to src/cs/Bts.Collections/KeyedCollection.cs index 0bb54df6d..c819f9af4 100644 --- a/src/cs/Bts.Spark.Core/Collections/KeyedCollection.cs +++ b/src/cs/Bts.Collections/KeyedCollection.cs @@ -1,11 +1,7 @@ -using Spark.Core.Diagnostics; - -using System; -using System.Collections; -using System.Collections.Generic; +using System.Collections; namespace bts.collections { - class KeyedCollection : IList, IList, IDictionary { + public class KeyedCollection : IList, IList, IDictionary { readonly Dictionary _dictionary; readonly List _list = new List(); readonly Func _key; @@ -74,19 +70,19 @@ namespace bts.collections { } #region IList (non-generic) members - object IList.this[int index] { + object? IList.this[int index] { get => this[index]; - set => this[index] = ExceptionAssert.Argument.Is(value, nameof(value)); + set => this[index] = (T)value; } - int IList.Add(object value) { - Add(ExceptionAssert.Argument.Is(value, nameof(value))); + int IList.Add(object? value) { + Add((T)value); return Count - 1; } - bool IList.Contains(object value) => Contains(ExceptionAssert.Argument.Is(value, nameof(value))); - int IList.IndexOf(object value) => IndexOf(ExceptionAssert.Argument.Is(value, nameof(value))); - void IList.Insert(int index, object value) => Insert(index, ExceptionAssert.Argument.Is(value, nameof(value))); + bool IList.Contains(object? value) => Contains((T)value); + int IList.IndexOf(object? value) => IndexOf((T)value); + void IList.Insert(int index, object? value) => Insert(index, (T)value); bool IList.IsFixedSize => false; - void IList.Remove(object value) => Remove(ExceptionAssert.Argument.Is(value, nameof(value))); + void IList.Remove(object? value) => Remove((T)value); IEnumerator IEnumerable.GetEnumerator() => _list.GetEnumerator(); #endregion diff --git a/src/cs/Bts.Spark.Core/Collections/KeyedValueCollection.cs b/src/cs/Bts.Collections/KeyedValueCollection.cs similarity index 92% rename from src/cs/Bts.Spark.Core/Collections/KeyedValueCollection.cs rename to src/cs/Bts.Collections/KeyedValueCollection.cs index be6c5c23b..29f3e0f26 100644 --- a/src/cs/Bts.Spark.Core/Collections/KeyedValueCollection.cs +++ b/src/cs/Bts.Collections/KeyedValueCollection.cs @@ -12,7 +12,7 @@ namespace bts.api.core { /// Unlike , the keys /// aren't functions of the corresponding values, they are orthogonal. /// - class KeyedValueCollection : IEnumerable where TKey : notnull { + public class KeyedValueCollection : IEnumerable where TKey : notnull { readonly Dictionary _cache = new(); public KeyedValueCollection(IEnumerable value, Func key) { diff --git a/src/cs/Bts.Spark.Core/Collections/Extensions/ListExtensions.cs b/src/cs/Bts.Collections/ListExtensions.cs similarity index 98% rename from src/cs/Bts.Spark.Core/Collections/Extensions/ListExtensions.cs rename to src/cs/Bts.Collections/ListExtensions.cs index f6d5731bc..3fb9d322f 100644 --- a/src/cs/Bts.Spark.Core/Collections/Extensions/ListExtensions.cs +++ b/src/cs/Bts.Collections/ListExtensions.cs @@ -1,8 +1,9 @@ namespace bts.collections { using bts.utils; + using Bts.Collections.Diagnostics; + using Spark.Core.Collections; - using Spark.Core.Diagnostics; using System; using System.Collections; @@ -31,7 +32,7 @@ namespace bts.collections { public static IReadOnlyList as_immutable(this IList list) => new ReadOnlyListWrapper(list); - public static List empty_if_null(this List source) => + public static List empty_if_null(this List? source) => source ?? new(0); public static int BinarySearch(this IList source, T item) where T : IComparable => @@ -290,7 +291,7 @@ namespace bts.collections { IEqualityComparer comparer = null, bool allow_duplicates = true ) { - Log.notnull(list); + ArgumentNullException.ThrowIfNull(list); if (source is null) { list.Clear(); return; @@ -614,10 +615,10 @@ namespace bts.collections { IEnumerator IEnumerable.GetEnumerator() => GetEnumerator(); // Validates the index before reversing it, so any inevitable 'IndexOutOfRange' exception isn't incidentally reversed too. - int _check_reverse(int index) => - index < 0 ? throw ExceptionBuilder.IndexOutOfRange.lt_zero() : - index >= Count ? throw ExceptionBuilder.IndexOutOfRange.gte_length() : - _reverse(index); + int _check_reverse(int index) { + ExceptionAssert.Index.IsValid(index, Count); + return _reverse(index); + } int _reverse(int index) => Count - index - 1; diff --git a/src/cs/Bts.Spark.Core/utils/MappedDictionary.cs b/src/cs/Bts.Collections/MappedDictionary.cs similarity index 99% rename from src/cs/Bts.Spark.Core/utils/MappedDictionary.cs rename to src/cs/Bts.Collections/MappedDictionary.cs index 9d332a740..c4e9f34cd 100644 --- a/src/cs/Bts.Spark.Core/utils/MappedDictionary.cs +++ b/src/cs/Bts.Collections/MappedDictionary.cs @@ -177,7 +177,7 @@ namespace bts.collections { } } - internal class MappedDictionary : IReadOnlyDictionary { + public class MappedDictionary : IReadOnlyDictionary { readonly IReadOnlyDictionary _dict; readonly Func _map; diff --git a/src/cs/Bts.Spark.Core/Collections/MergedSortedList.cs b/src/cs/Bts.Collections/MergedSortedList.cs similarity index 100% rename from src/cs/Bts.Spark.Core/Collections/MergedSortedList.cs rename to src/cs/Bts.Collections/MergedSortedList.cs diff --git a/src/cs/Bts.Spark.Core/Collections/MutableDictionaryFacade.cs b/src/cs/Bts.Collections/MutableDictionaryFacade.cs similarity index 100% rename from src/cs/Bts.Spark.Core/Collections/MutableDictionaryFacade.cs rename to src/cs/Bts.Collections/MutableDictionaryFacade.cs diff --git a/src/cs/Bts.Spark.Core/Collections/NonGenericListWrapper.cs b/src/cs/Bts.Collections/NonGenericListWrapper.cs similarity index 100% rename from src/cs/Bts.Spark.Core/Collections/NonGenericListWrapper.cs rename to src/cs/Bts.Collections/NonGenericListWrapper.cs diff --git a/src/cs/Bts.Spark.Core/Collections/NonNullCollectionWrapper.cs b/src/cs/Bts.Collections/NonNullCollectionWrapper.cs similarity index 100% rename from src/cs/Bts.Spark.Core/Collections/NonNullCollectionWrapper.cs rename to src/cs/Bts.Collections/NonNullCollectionWrapper.cs diff --git a/src/cs/Bts.Spark.Core/Collections/NullCheckComparer.cs b/src/cs/Bts.Collections/NullCheckComparer.cs similarity index 100% rename from src/cs/Bts.Spark.Core/Collections/NullCheckComparer.cs rename to src/cs/Bts.Collections/NullCheckComparer.cs diff --git a/src/cs/Bts.Spark.Core/Collections/NullCheckEqualityComparer.cs b/src/cs/Bts.Collections/NullCheckEqualityComparer.cs similarity index 100% rename from src/cs/Bts.Spark.Core/Collections/NullCheckEqualityComparer.cs rename to src/cs/Bts.Collections/NullCheckEqualityComparer.cs diff --git a/src/cs/Bts.Spark.Core/Collections/NullableEqualityComparer.cs b/src/cs/Bts.Collections/NullableEqualityComparer.cs similarity index 100% rename from src/cs/Bts.Spark.Core/Collections/NullableEqualityComparer.cs rename to src/cs/Bts.Collections/NullableEqualityComparer.cs diff --git a/src/cs/Bts.Spark.Core/Collections/ObservableSortedCollection.cs b/src/cs/Bts.Collections/ObservableSortedCollection.cs similarity index 97% rename from src/cs/Bts.Spark.Core/Collections/ObservableSortedCollection.cs rename to src/cs/Bts.Collections/ObservableSortedCollection.cs index a829e5369..e61adc52f 100644 --- a/src/cs/Bts.Spark.Core/Collections/ObservableSortedCollection.cs +++ b/src/cs/Bts.Collections/ObservableSortedCollection.cs @@ -5,8 +5,6 @@ namespace Spark.Core.Collections { using mbts; - using Spark.Core.Diagnostics; - using System; using System.Collections; using System.Collections.Generic; @@ -32,9 +30,7 @@ namespace Spark.Core.Collections { int capacity = 4) { _comparer = comparer ?? Comparer.Default; _eq_comparer = eq_comparer ?? EqualityComparer.Default; - if (capacity <= 0) { - throw ExceptionBuilder.ArgumentOutOfRange.lte_zero(nameof(capacity)); - } + ArgumentOutOfRangeException.ThrowIfLessThanOrEqual(capacity, 0); _values = new T[capacity]; } diff --git a/src/cs/Bts.Spark.Core/Collections/OffsetList.cs b/src/cs/Bts.Collections/OffsetList.cs similarity index 98% rename from src/cs/Bts.Spark.Core/Collections/OffsetList.cs rename to src/cs/Bts.Collections/OffsetList.cs index 2ee5d7125..bacfedf4c 100644 --- a/src/cs/Bts.Spark.Core/Collections/OffsetList.cs +++ b/src/cs/Bts.Collections/OffsetList.cs @@ -1,7 +1,7 @@ #nullable enable namespace Spark.Core.Collections; -using Spark.Core.Diagnostics; +using Bts.Collections.Diagnostics; using System.Collections; using System.Collections.Generic; diff --git a/src/cs/Bts.Spark.Core/Collections/OrderedDictionary.cs b/src/cs/Bts.Collections/OrderedDictionary.cs similarity index 96% rename from src/cs/Bts.Spark.Core/Collections/OrderedDictionary.cs rename to src/cs/Bts.Collections/OrderedDictionary.cs index e2c992112..70ad32f2e 100644 --- a/src/cs/Bts.Spark.Core/Collections/OrderedDictionary.cs +++ b/src/cs/Bts.Collections/OrderedDictionary.cs @@ -88,7 +88,9 @@ public class OrderedDictionary : IDictionary, IList< throw new ArgumentException("The same key is already present at another index", nameof(value)); } } else { - Log.assert(data.Remove(currKeyAtIndex)); + if (!data.Remove(currKeyAtIndex)) { + throw new InvalidOperationException("Failed to remove existing key"); + } ordinalKeys[index] = (currOrdinalAtIndex, value.Key); } data[value.Key] = (value.Value, currOrdinalAtIndex); @@ -240,7 +242,9 @@ public class OrderedDictionary : IDictionary, IList< public bool Remove(TKey key) { if (data.TryGetValue(key, out var v)) { - Log.assert(data.Remove(key)); + if (!data.Remove(key)) { + throw new InvalidOperationException("Failed to remove existing key"); + } ordinalKeys.RemoveSorted((v.Ordinal, key), ordinalKeyComparer); return true; } @@ -249,7 +253,9 @@ public class OrderedDictionary : IDictionary, IList< public bool Remove(KeyValuePair item) { if (data.TryGetValue(item.Key, out var v) && EqualityComparer.Default.Equals(v.Value, item.Value)) { - Log.assert(data.Remove(item.Key)); + if (!data.Remove(item.Key)) { + throw new InvalidOperationException("Failed to remove existing key"); + } ordinalKeys.RemoveSorted((v.Ordinal, item.Key), ordinalKeyComparer); return true; } @@ -385,7 +391,9 @@ public class OrderedDictionary : IDictionary, IList< data[k] = (v, ord); ord += step; } - Log.assert(Count == origCount + insertedItemCount); + if (Count != origCount + insertedItemCount) { + throw new InvalidOperationException("Count was not incremented by insertedItemCount"); + } } /// WARNING: should already be unique (this fn does NOT check) diff --git a/src/cs/Bts.Spark.Core/Collections/ReadOnlyDictionaryKeyCollection.cs b/src/cs/Bts.Collections/ReadOnlyDictionaryKeyCollection.cs similarity index 100% rename from src/cs/Bts.Spark.Core/Collections/ReadOnlyDictionaryKeyCollection.cs rename to src/cs/Bts.Collections/ReadOnlyDictionaryKeyCollection.cs diff --git a/src/cs/Bts.Spark.Core/Collections/ReadOnlyDictionaryValueCollection.cs b/src/cs/Bts.Collections/ReadOnlyDictionaryValueCollection.cs similarity index 100% rename from src/cs/Bts.Spark.Core/Collections/ReadOnlyDictionaryValueCollection.cs rename to src/cs/Bts.Collections/ReadOnlyDictionaryValueCollection.cs diff --git a/src/cs/Bts.Spark.Core/Collections/ReadOnlyListSubRangeWrapper.cs b/src/cs/Bts.Collections/ReadOnlyListSubRangeWrapper.cs similarity index 66% rename from src/cs/Bts.Spark.Core/Collections/ReadOnlyListSubRangeWrapper.cs rename to src/cs/Bts.Collections/ReadOnlyListSubRangeWrapper.cs index 3fcf9e335..61d69979f 100644 --- a/src/cs/Bts.Spark.Core/Collections/ReadOnlyListSubRangeWrapper.cs +++ b/src/cs/Bts.Collections/ReadOnlyListSubRangeWrapper.cs @@ -1,23 +1,21 @@ -using Spark.Core.Diagnostics; - -using System; -using System.Collections; -using System.Collections.Generic; +using System.Collections; namespace bts.collections { - static class ReadOnlyListSubRangeWrapper { + public static class ReadOnlyListSubRangeWrapper { public static IReadOnlyList Create(IReadOnlyList source, int start, int length) => new ReadOnlyListSubRangeWrapper(source, start, length); } - class ReadOnlyListSubRangeWrapper : IReadOnlyList { + public class ReadOnlyListSubRangeWrapper : IReadOnlyList { readonly IReadOnlyList _source; readonly int _start, _length; public ReadOnlyListSubRangeWrapper(IReadOnlyList source, int start, int length) { _source = source ?? throw new ArgumentNullException(nameof(source)); - _start = start < 0 ? throw ExceptionBuilder.ArgumentOutOfRange.lt_zero(nameof(start)) : start; - _length = length < 0 ? throw ExceptionBuilder.ArgumentOutOfRange.lt_zero(nameof(length)) : length; + ArgumentOutOfRangeException.ThrowIfLessThan(start, 0); + ArgumentOutOfRangeException.ThrowIfLessThan(length, 0); + _start = start; + _length = length; } public T this[int index] => _source[_start + index]; diff --git a/src/cs/Bts.Spark.Core/Collections/ReadOnlyListWrapper.cs b/src/cs/Bts.Collections/ReadOnlyListWrapper.cs similarity index 100% rename from src/cs/Bts.Spark.Core/Collections/ReadOnlyListWrapper.cs rename to src/cs/Bts.Collections/ReadOnlyListWrapper.cs diff --git a/src/cs/Bts.Spark.Core/Collections/ReadOnlySelectorList.cs b/src/cs/Bts.Collections/ReadOnlySelectorList.cs similarity index 100% rename from src/cs/Bts.Spark.Core/Collections/ReadOnlySelectorList.cs rename to src/cs/Bts.Collections/ReadOnlySelectorList.cs diff --git a/src/cs/Bts.Spark.Core/Collections/ReverseArrayList.cs b/src/cs/Bts.Collections/ReverseArrayList.cs similarity index 100% rename from src/cs/Bts.Spark.Core/Collections/ReverseArrayList.cs rename to src/cs/Bts.Collections/ReverseArrayList.cs diff --git a/src/cs/Bts.Spark.Core/Collections/ReverseComparer.cs b/src/cs/Bts.Collections/ReverseComparer.cs similarity index 100% rename from src/cs/Bts.Spark.Core/Collections/ReverseComparer.cs rename to src/cs/Bts.Collections/ReverseComparer.cs diff --git a/src/cs/Bts.Spark.Core/Collections/SelectorEqualityComparer.cs b/src/cs/Bts.Collections/SelectorEqualityComparer.cs similarity index 100% rename from src/cs/Bts.Spark.Core/Collections/SelectorEqualityComparer.cs rename to src/cs/Bts.Collections/SelectorEqualityComparer.cs diff --git a/src/cs/Bts.Spark.Core/Collections/SelectorList.cs b/src/cs/Bts.Collections/SelectorList.cs similarity index 100% rename from src/cs/Bts.Spark.Core/Collections/SelectorList.cs rename to src/cs/Bts.Collections/SelectorList.cs diff --git a/src/cs/Bts.Spark.Core/Collections/SetMap.cs b/src/cs/Bts.Collections/SetMap.cs similarity index 100% rename from src/cs/Bts.Spark.Core/Collections/SetMap.cs rename to src/cs/Bts.Collections/SetMap.cs diff --git a/src/cs/Bts.Spark.Core/Collections/SetStack.cs b/src/cs/Bts.Collections/SetStack.cs similarity index 98% rename from src/cs/Bts.Spark.Core/Collections/SetStack.cs rename to src/cs/Bts.Collections/SetStack.cs index 52850b462..d9100e56e 100644 --- a/src/cs/Bts.Spark.Core/Collections/SetStack.cs +++ b/src/cs/Bts.Collections/SetStack.cs @@ -3,7 +3,7 @@ using System.Collections; using System.Collections.Generic; namespace bts.collections { - class SetStack : ISet { + public class SetStack : ISet { readonly SortedList _stack = new SortedList(Comparer.Default); readonly Dictionary _index; /// Note: is never reset (that is why a 'long' is used instead of an 'int'). @@ -216,7 +216,7 @@ namespace bts.collections { } } - static class SetStackExtensions { + public static class SetStackExtensions { public static bool TryPeek(this SetStack set_stack, out T result) { if (set_stack.Count > 0) { result = set_stack.Peek(); @@ -235,4 +235,4 @@ namespace bts.collections { return false; } } -} \ No newline at end of file +} diff --git a/src/cs/Bts.Spark.Core/Collections/SingleValueList.cs b/src/cs/Bts.Collections/SingleValueList.cs similarity index 91% rename from src/cs/Bts.Spark.Core/Collections/SingleValueList.cs rename to src/cs/Bts.Collections/SingleValueList.cs index 2073e7472..94f638871 100644 --- a/src/cs/Bts.Spark.Core/Collections/SingleValueList.cs +++ b/src/cs/Bts.Collections/SingleValueList.cs @@ -1,4 +1,3 @@ -#nullable enable namespace Spark.Core.Collections { using System; using System.Collections; @@ -62,8 +61,13 @@ namespace Spark.Core.Collections { public void Dispose() { } - public bool MoveNext() => - _initialized.toggle_to(true); + public bool MoveNext() { + if (_initialized) { + return false; + } + _initialized = true; + return true; + } public void Reset() => _initialized = false; diff --git a/src/cs/Bts.Spark.Core/Collections/SliceList.cs b/src/cs/Bts.Collections/SliceList.cs similarity index 92% rename from src/cs/Bts.Spark.Core/Collections/SliceList.cs rename to src/cs/Bts.Collections/SliceList.cs index ce5b4480e..122c65367 100644 --- a/src/cs/Bts.Spark.Core/Collections/SliceList.cs +++ b/src/cs/Bts.Collections/SliceList.cs @@ -70,12 +70,16 @@ public class SliceList : IMutableListFacade { var indexRowTupleComp = Comparer<(int Index, T Row)>.Create((a, b) => a.Index.CompareTo(b.Index)); foreach (var r in removedItems) { int idx = source.IndexOf(r); - Log.assert(idx >= 0); + if (idx < 0) { + throw new ArgumentException("Item in not found in current items", nameof(removedItems)); + } sortedRemoves.InsertSorted(idx); } foreach (var r in addedItems) { int idx = newItems.IndexOf(r); - Log.assert(idx >= 0); + if (idx < 0) { + throw new ArgumentException("Item not found in new items", nameof(addedItems)); + } sortedInserts.InsertSorted((idx, r), indexRowTupleComp); } sliceRemoves = new(); diff --git a/src/cs/Bts.Spark.Core/Collections/SortedList.cs b/src/cs/Bts.Collections/SortedList.cs similarity index 100% rename from src/cs/Bts.Spark.Core/Collections/SortedList.cs rename to src/cs/Bts.Collections/SortedList.cs diff --git a/src/cs/Bts.Spark.Core/Collections/SortedSetMap.cs b/src/cs/Bts.Collections/SortedSetMap.cs similarity index 97% rename from src/cs/Bts.Spark.Core/Collections/SortedSetMap.cs rename to src/cs/Bts.Collections/SortedSetMap.cs index 08c347454..4c0badd3f 100644 --- a/src/cs/Bts.Spark.Core/Collections/SortedSetMap.cs +++ b/src/cs/Bts.Collections/SortedSetMap.cs @@ -9,7 +9,7 @@ namespace bts.collections { /// /// /// - class SortedSetMap : IEnumerable>, ICollection { + public class SortedSetMap : IEnumerable>, ICollection { readonly IComparer _key_comparer; readonly IEqualityComparer _value_eq_comparer; InternalGroupSet[] _key_values; diff --git a/src/cs/Bts.Spark.Core/Collections/SortedTree.cs b/src/cs/Bts.Collections/SortedTree.cs similarity index 100% rename from src/cs/Bts.Spark.Core/Collections/SortedTree.cs rename to src/cs/Bts.Collections/SortedTree.cs diff --git a/src/cs/Bts.Spark.Core/Collections/SparkObservableCollection.cs b/src/cs/Bts.Collections/SparkObservableCollection.cs similarity index 100% rename from src/cs/Bts.Spark.Core/Collections/SparkObservableCollection.cs rename to src/cs/Bts.Collections/SparkObservableCollection.cs diff --git a/src/cs/Bts.Spark.Core/Collections/StepList.cs b/src/cs/Bts.Collections/StepList.cs similarity index 100% rename from src/cs/Bts.Spark.Core/Collections/StepList.cs rename to src/cs/Bts.Collections/StepList.cs diff --git a/src/cs/Bts.Collections/TryGetValue.cs b/src/cs/Bts.Collections/TryGetValue.cs new file mode 100644 index 000000000..fcc5fde95 --- /dev/null +++ b/src/cs/Bts.Collections/TryGetValue.cs @@ -0,0 +1,4 @@ +namespace Bts.Collections; + +public delegate bool TryGetValue(out T value); +public delegate bool TryGetValue(TKey key, out TValue value); diff --git a/src/cs/Bts.Spark.Core/Collections/TupleComparer.cs b/src/cs/Bts.Collections/TupleComparer.cs similarity index 100% rename from src/cs/Bts.Spark.Core/Collections/TupleComparer.cs rename to src/cs/Bts.Collections/TupleComparer.cs diff --git a/src/cs/Bts.Core/Bts.Core.csproj b/src/cs/Bts.Core/Bts.Core.csproj new file mode 100644 index 000000000..fa71b7ae6 --- /dev/null +++ b/src/cs/Bts.Core/Bts.Core.csproj @@ -0,0 +1,9 @@ + + + + net8.0 + enable + enable + + + diff --git a/src/cs/Bts.Spark.Core/utils/ConvertUtils.cs b/src/cs/Bts.Core/ConvertUtils.cs similarity index 85% rename from src/cs/Bts.Spark.Core/utils/ConvertUtils.cs rename to src/cs/Bts.Core/ConvertUtils.cs index 28369e522..a3a3cb60b 100644 --- a/src/cs/Bts.Spark.Core/utils/ConvertUtils.cs +++ b/src/cs/Bts.Core/ConvertUtils.cs @@ -1,8 +1,6 @@ -namespace System { - using bts; - +#nullable disable +namespace System { using System.Collections.Generic; - using System.Diagnostics.CodeAnalysis; public static class ConvertUtils { public static object try_convert(Type type, object obj) { @@ -10,32 +8,6 @@ return result; } - #nullable enable - public static bool try_convert( - object obj, - [NotNullWhen(true)]out T? result, - LogLevel? log_level = null, - LogSubsystem log_subsystem = LogSubsystem.gen, - string? name = null) { - if (obj is T t) { - result = t; - return true; - } - if (try_convert(typeof(T), obj, out var result_obj)) { - result = (T)result_obj; - return true; - } - if (log_level.HasValue) { - name = name is null ? "obj" : $"'{name}'"; - var msg = $"Expected {name} to be of type '{typeof(T)}', actually " + - $"'{obj?.GetType()?.ToString() ?? "null"}'."; - Log.log(new(log_subsystem, log_level.Value, msg)); - } - result = default; - return false; - } - #nullable disable - public static bool try_convert(Type type, object obj, out object result) { if (obj == null) { result = get_default(type); @@ -68,6 +40,10 @@ try_convert(obj, out T result) ? result : default_value; public static bool try_convert(object obj, out T result) { + if (obj is T t) { + result = t; + return true; + } bool rv = try_convert(typeof(T), obj, out object r_obj); result = (T)r_obj; return rv; diff --git a/src/cs/Bts.Spark.Core/Diagnostics/ExceptionAssert.cs b/src/cs/Bts.Core/Diagnostics/ExceptionAssert.cs similarity index 82% rename from src/cs/Bts.Spark.Core/Diagnostics/ExceptionAssert.cs rename to src/cs/Bts.Core/Diagnostics/ExceptionAssert.cs index a0e1a784a..ccfd1783c 100644 --- a/src/cs/Bts.Spark.Core/Diagnostics/ExceptionAssert.cs +++ b/src/cs/Bts.Core/Diagnostics/ExceptionAssert.cs @@ -1,7 +1,4 @@ -#nullable enable -using bts.utils; - -using System; +using System; using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; using System.Linq; @@ -191,57 +188,6 @@ namespace Spark.Core.Diagnostics { } } - public static class NumericArgument { - public static void is_real(T argument, [CallerArgumentExpression(nameof(argument))] string? name = null) - where T : IFloatingPoint { - if (!argument.is_real()) { - throw ExceptionBuilder.NumericArgument.must_be_real(name); - } - } - - public static void is_real_non_zero(T argument, [CallerArgumentExpression(nameof(argument))] string? name = null) - where T : IFloatingPoint { - if (!argument.is_real_non_zero()) { - throw ExceptionBuilder.NumericArgument.must_be_real_non_zero(name); - } - } - - public static void is_real_negative(T argument, [CallerArgumentExpression(nameof(argument))] string? name = null) - where T : IFloatingPoint { - if (!argument.is_real_negative()) { - throw ExceptionBuilder.NumericArgument.must_be_real_negative(name); - } - } - - public static void is_real_non_negative(T argument, [CallerArgumentExpression(nameof(argument))] string? name = null) - where T : IFloatingPoint { - if (!argument.is_real_non_negative()) { - throw ExceptionBuilder.NumericArgument.must_be_real_non_negative(name); - } - } - - public static void is_real_positive(T argument, [CallerArgumentExpression(nameof(argument))] string? name = null) - where T : IFloatingPoint { - if (!argument.is_real_positive()) { - throw ExceptionBuilder.NumericArgument.must_be_real_positive(name); - } - } - - public static void is_real_non_positive(T argument, [CallerArgumentExpression(nameof(argument))] string? name = null) - where T : IFloatingPoint { - if (!argument.is_real_non_positive()) { - throw ExceptionBuilder.NumericArgument.must_be_real_non_positive(name); - } - } - - public static void not_infinity(T argument, [CallerArgumentExpression(nameof(argument))] string? name = null) - where T : IFloatingPoint { - if (T.IsInfinity(argument)) { - throw ExceptionBuilder.NumericArgument.must_not_be_infinity(name); - } - } - } - public static class InvalidOperation { public static void That(bool condition, string message) { if (!condition) diff --git a/src/cs/Bts.Spark.Core/Diagnostics/ExceptionBuilder.cs b/src/cs/Bts.Core/Diagnostics/ExceptionBuilder.cs similarity index 74% rename from src/cs/Bts.Spark.Core/Diagnostics/ExceptionBuilder.cs rename to src/cs/Bts.Core/Diagnostics/ExceptionBuilder.cs index d4092aadd..98009ed3e 100644 --- a/src/cs/Bts.Spark.Core/Diagnostics/ExceptionBuilder.cs +++ b/src/cs/Bts.Core/Diagnostics/ExceptionBuilder.cs @@ -24,29 +24,6 @@ namespace Spark.Core.Diagnostics { new ArgumentException("Value is null or empty.", name); } - public static class NumericArgument { - public static ArgumentException must_be_real(string name) => - new(Format.MustBe(NumericTerms.real()), name); - - public static ArgumentException must_be_real_non_zero(string name) => - new(Format.MustBe(NumericTerms.real_non_zero()), name); - - public static ArgumentException must_be_real_non_negative(string name) => - new(Format.MustBe(NumericTerms.real_non_negative()), name); - - public static ArgumentException must_be_real_non_positive(string name) => - new(Format.MustBe(NumericTerms.real_non_positive()), name); - - public static ArgumentException must_be_real_negative(string name) => - new(Format.MustBe(NumericTerms.real_negative()), name); - - public static ArgumentException must_be_real_positive(string name) => - new(Format.MustBe(NumericTerms.real_positive()), name); - - public static ArgumentException must_not_be_infinity(string name) => - new(Format.must_not_be(NumericTerms.not_infinity()), name); - } - public static class IndexOutOfRange { public static IndexOutOfRangeException lt_zero() => new IndexOutOfRangeException("Index is less than 0"); @@ -103,15 +80,5 @@ namespace Spark.Core.Diagnostics { GreaterThan = "Greater than", GreaterThanOrEqualTo = "Greater than or equal to"; } - - public static class NumericTerms { - public static string real() => "real"; - public static string real_non_zero() => "real non-zero"; - public static string real_non_negative() => "real non-negative"; - public static string real_non_positive() => "real non-positive"; - public static string real_positive() => "real positive"; - public static string real_negative() => "real negative"; - public static string not_infinity() => "not infinity"; - } } } diff --git a/src/cs/Bts.Spark.Core/utils_api/IConverter.cs b/src/cs/Bts.Core/IConverter.cs similarity index 100% rename from src/cs/Bts.Spark.Core/utils_api/IConverter.cs rename to src/cs/Bts.Core/IConverter.cs diff --git a/src/cs/Bts.Spark.Core/utils_api/IdentityConverter.cs b/src/cs/Bts.Core/IdentityConverter.cs similarity index 100% rename from src/cs/Bts.Spark.Core/utils_api/IdentityConverter.cs rename to src/cs/Bts.Core/IdentityConverter.cs diff --git a/src/cs/Bts.Spark.Core/LazyOnce.cs b/src/cs/Bts.Core/LazyOnce.cs similarity index 98% rename from src/cs/Bts.Spark.Core/LazyOnce.cs rename to src/cs/Bts.Core/LazyOnce.cs index 498fc5b9e..04bf609b8 100644 --- a/src/cs/Bts.Spark.Core/LazyOnce.cs +++ b/src/cs/Bts.Core/LazyOnce.cs @@ -1,4 +1,3 @@ -#nullable enable namespace Spark.Core { using System; diff --git a/src/cs/Bts.Spark.Core/Optional.cs b/src/cs/Bts.Core/Optional.cs similarity index 99% rename from src/cs/Bts.Spark.Core/Optional.cs rename to src/cs/Bts.Core/Optional.cs index 8fecc0ff8..02537efd4 100644 --- a/src/cs/Bts.Spark.Core/Optional.cs +++ b/src/cs/Bts.Core/Optional.cs @@ -1,4 +1,3 @@ -#nullable enable namespace Spark.Core { using System; using System.Collections.Generic; diff --git a/src/cs/Bts.Spark.Core/utils/TypeExtensions.cs b/src/cs/Bts.Core/TypeExtensions.cs similarity index 88% rename from src/cs/Bts.Spark.Core/utils/TypeExtensions.cs rename to src/cs/Bts.Core/TypeExtensions.cs index 3f10b9271..ee8192046 100644 --- a/src/cs/Bts.Spark.Core/utils/TypeExtensions.cs +++ b/src/cs/Bts.Core/TypeExtensions.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Reflection; -using System.Text; -using System.Threading.Tasks; +using System.Reflection; namespace System { diff --git a/src/cs/Bts.Spark.Core/Disposables/AnonymousDisposable.cs b/src/cs/Bts.Disposables/AnonymousDisposable.cs similarity index 100% rename from src/cs/Bts.Spark.Core/Disposables/AnonymousDisposable.cs rename to src/cs/Bts.Disposables/AnonymousDisposable.cs diff --git a/src/cs/Bts.Disposables/Bts.Disposables.csproj b/src/cs/Bts.Disposables/Bts.Disposables.csproj new file mode 100644 index 000000000..fa71b7ae6 --- /dev/null +++ b/src/cs/Bts.Disposables/Bts.Disposables.csproj @@ -0,0 +1,9 @@ + + + + net8.0 + enable + enable + + + diff --git a/src/cs/Bts.Spark.Core/Disposables/Disposable.cs b/src/cs/Bts.Disposables/Disposable.cs similarity index 94% rename from src/cs/Bts.Spark.Core/Disposables/Disposable.cs rename to src/cs/Bts.Disposables/Disposable.cs index bd51adf9a..9dc15f890 100644 --- a/src/cs/Bts.Spark.Core/Disposables/Disposable.cs +++ b/src/cs/Bts.Disposables/Disposable.cs @@ -1,4 +1,3 @@ -#nullable enable namespace Spark.Core.Disposables { using System; using System.Collections.Generic; @@ -38,8 +37,15 @@ namespace Spark.Core.Disposables { /// isn't otherwise enumerated until the resultant fn is /// called. /// - public static IDisposable Create(IEnumerable disposables) => - new AnonymousDisposable(disposables.DisposeAll); + public static IDisposable Create(IEnumerable disposables) { + return new AnonymousDisposable(Dispose); + + void Dispose() { + foreach (var d in disposables) { + d.Dispose(); + } + } + } public static IDisposable Create(Func<(T1?, T2?)> get_disposables) where T1 : IDisposable diff --git a/src/cs/Bts.Spark.Core/Disposables/DisposableArray.cs b/src/cs/Bts.Disposables/DisposableArray.cs similarity index 100% rename from src/cs/Bts.Spark.Core/Disposables/DisposableArray.cs rename to src/cs/Bts.Disposables/DisposableArray.cs diff --git a/src/cs/Bts.Spark.Core/Disposables/DisposableBuilder.cs b/src/cs/Bts.Disposables/DisposableBuilder.cs similarity index 72% rename from src/cs/Bts.Spark.Core/Disposables/DisposableBuilder.cs rename to src/cs/Bts.Disposables/DisposableBuilder.cs index d700de5eb..3bc170593 100644 --- a/src/cs/Bts.Spark.Core/Disposables/DisposableBuilder.cs +++ b/src/cs/Bts.Disposables/DisposableBuilder.cs @@ -14,8 +14,14 @@ namespace Spark.Core.Disposables { return disposable; } - public void Dispose() => - Interlocked.Exchange(ref _disposables, null)?.DisposeAll(); + public void Dispose() { + var disposables = Interlocked.Exchange(ref _disposables, null); + if (disposables is not null) { + foreach (var d in disposables) { + d.Dispose(); + } + } + } [MemberNotNull(nameof(_disposables))] void _check_disposed() { diff --git a/src/cs/Bts.Spark.Core/Disposables/DisposableListWrapper.cs b/src/cs/Bts.Disposables/DisposableListWrapper.cs similarity index 100% rename from src/cs/Bts.Spark.Core/Disposables/DisposableListWrapper.cs rename to src/cs/Bts.Disposables/DisposableListWrapper.cs diff --git a/src/cs/Bts.Spark.Core/Disposables/FinalizeableDisposable.cs b/src/cs/Bts.Disposables/FinalizeableDisposable.cs similarity index 100% rename from src/cs/Bts.Spark.Core/Disposables/FinalizeableDisposable.cs rename to src/cs/Bts.Disposables/FinalizeableDisposable.cs diff --git a/src/cs/Bts.Spark.Core/Disposables/ImmutableDisposable.cs b/src/cs/Bts.Disposables/ImmutableDisposable.cs similarity index 100% rename from src/cs/Bts.Spark.Core/Disposables/ImmutableDisposable.cs rename to src/cs/Bts.Disposables/ImmutableDisposable.cs diff --git a/src/cs/Bts.Spark.Core/Disposables/LazySubscription.cs b/src/cs/Bts.Disposables/LazySubscription.cs similarity index 96% rename from src/cs/Bts.Spark.Core/Disposables/LazySubscription.cs rename to src/cs/Bts.Disposables/LazySubscription.cs index a1250e585..6f5448182 100644 --- a/src/cs/Bts.Spark.Core/Disposables/LazySubscription.cs +++ b/src/cs/Bts.Disposables/LazySubscription.cs @@ -1,8 +1,7 @@ -#nullable enable namespace Spark.Core.Disposables { using System; - class LazySubscription : IDisposable { + public class LazySubscription : IDisposable { readonly object _lock = new(); Func? _subscribe; diff --git a/src/cs/Bts.Spark.Core/Disposables/ThreadSafeDisposable.cs b/src/cs/Bts.Disposables/ThreadSafeDisposable.cs similarity index 100% rename from src/cs/Bts.Spark.Core/Disposables/ThreadSafeDisposable.cs rename to src/cs/Bts.Disposables/ThreadSafeDisposable.cs diff --git a/src/cs/Bts.Numerics/Bts.Numerics.csproj b/src/cs/Bts.Numerics/Bts.Numerics.csproj new file mode 100644 index 000000000..f5d3e54d4 --- /dev/null +++ b/src/cs/Bts.Numerics/Bts.Numerics.csproj @@ -0,0 +1,22 @@ + + + + net8.0 + enable + enable + + + + + + + + + + + + + + + + diff --git a/src/cs/Bts.Numerics/Diagnostics/ExceptionAssert.cs b/src/cs/Bts.Numerics/Diagnostics/ExceptionAssert.cs new file mode 100644 index 000000000..f7627e6eb --- /dev/null +++ b/src/cs/Bts.Numerics/Diagnostics/ExceptionAssert.cs @@ -0,0 +1,59 @@ +namespace Bts.Numerics.Diagnostics; + +using bts.utils; + +using System.Numerics; +using System.Runtime.CompilerServices; + +public static class ExceptionAssert { + public static class Argument { + public static void is_real(T argument, [CallerArgumentExpression(nameof(argument))] string? name = null) + where T : IFloatingPoint { + if (!argument.is_real()) { + throw ExceptionBuilder.NumericArgument.must_be_real(name); + } + } + + public static void is_real_non_zero(T argument, [CallerArgumentExpression(nameof(argument))] string? name = null) + where T : IFloatingPoint { + if (!argument.is_real_non_zero()) { + throw ExceptionBuilder.NumericArgument.must_be_real_non_zero(name); + } + } + + public static void is_real_negative(T argument, [CallerArgumentExpression(nameof(argument))] string? name = null) + where T : IFloatingPoint { + if (!argument.is_real_negative()) { + throw ExceptionBuilder.NumericArgument.must_be_real_negative(name); + } + } + + public static void is_real_non_negative(T argument, [CallerArgumentExpression(nameof(argument))] string? name = null) + where T : IFloatingPoint { + if (!argument.is_real_non_negative()) { + throw ExceptionBuilder.NumericArgument.must_be_real_non_negative(name); + } + } + + public static void is_real_positive(T argument, [CallerArgumentExpression(nameof(argument))] string? name = null) + where T : IFloatingPoint { + if (!argument.is_real_positive()) { + throw ExceptionBuilder.NumericArgument.must_be_real_positive(name); + } + } + + public static void is_real_non_positive(T argument, [CallerArgumentExpression(nameof(argument))] string? name = null) + where T : IFloatingPoint { + if (!argument.is_real_non_positive()) { + throw ExceptionBuilder.NumericArgument.must_be_real_non_positive(name); + } + } + + public static void not_infinity(T argument, [CallerArgumentExpression(nameof(argument))] string? name = null) + where T : IFloatingPoint { + if (T.IsInfinity(argument)) { + throw ExceptionBuilder.NumericArgument.must_not_be_infinity(name); + } + } + } +} diff --git a/src/cs/Bts.Numerics/Diagnostics/ExceptionBuilder.cs b/src/cs/Bts.Numerics/Diagnostics/ExceptionBuilder.cs new file mode 100644 index 000000000..51c8670e3 --- /dev/null +++ b/src/cs/Bts.Numerics/Diagnostics/ExceptionBuilder.cs @@ -0,0 +1,36 @@ +namespace Bts.Numerics.Diagnostics; + +public static class ExceptionBuilder { + public static class NumericArgument { + public static ArgumentException must_be_real(string name) => + new(Spark.Core.Diagnostics.ExceptionBuilder.Format.MustBe(NumericTerms.real()), name); + + public static ArgumentException must_be_real_non_zero(string name) => + new(Spark.Core.Diagnostics.ExceptionBuilder.Format.MustBe(NumericTerms.real_non_zero()), name); + + public static ArgumentException must_be_real_non_negative(string name) => + new(Spark.Core.Diagnostics.ExceptionBuilder.Format.MustBe(NumericTerms.real_non_negative()), name); + + public static ArgumentException must_be_real_non_positive(string name) => + new(Spark.Core.Diagnostics.ExceptionBuilder.Format.MustBe(NumericTerms.real_non_positive()), name); + + public static ArgumentException must_be_real_negative(string name) => + new(Spark.Core.Diagnostics.ExceptionBuilder.Format.MustBe(NumericTerms.real_negative()), name); + + public static ArgumentException must_be_real_positive(string name) => + new(Spark.Core.Diagnostics.ExceptionBuilder.Format.MustBe(NumericTerms.real_positive()), name); + + public static ArgumentException must_not_be_infinity(string name) => + new(Spark.Core.Diagnostics.ExceptionBuilder.Format.must_not_be(NumericTerms.not_infinity()), name); + } + + public static class NumericTerms { + public static string real() => "real"; + public static string real_non_zero() => "real non-zero"; + public static string real_non_negative() => "real non-negative"; + public static string real_non_positive() => "real non-positive"; + public static string real_positive() => "real positive"; + public static string real_negative() => "real negative"; + public static string not_infinity() => "not infinity"; + } +} diff --git a/src/cs/Bts.Spark.Core/utils_api/MathUtils.cs b/src/cs/Bts.Numerics/MathUtils.cs similarity index 99% rename from src/cs/Bts.Spark.Core/utils_api/MathUtils.cs rename to src/cs/Bts.Numerics/MathUtils.cs index 1bb2dcf7a..55df91741 100644 --- a/src/cs/Bts.Spark.Core/utils_api/MathUtils.cs +++ b/src/cs/Bts.Numerics/MathUtils.cs @@ -478,7 +478,8 @@ namespace bts.utils { is_real_non_zero(divisor) && is_real_non_zero(value) ? value / divisor : value); } else { - Log.assert(false, $"Unknown floating point type {typeof(T)}"); + Console.Error.WriteLine($"Unknown floating point type {typeof(T)}"); + Environment.Exit(1); } } else { is_nan = _ => false; @@ -510,8 +511,8 @@ namespace bts.utils { "Error margin must be greater than or equal to zero.", nameof(error_margin)) : error_margin; - public int Compare(T x, T y) { - T diff = x - y; + public int Compare(T? x, T? y) { + T? diff = x - y; if (diff <= _error_margin && diff >= -_error_margin) { return 0; } diff --git a/src/cs/Bts.Spark.Core/utils_api/NumericCastConverter.cs b/src/cs/Bts.Numerics/NumericCastConverter.cs similarity index 98% rename from src/cs/Bts.Spark.Core/utils_api/NumericCastConverter.cs rename to src/cs/Bts.Numerics/NumericCastConverter.cs index 9914b31ea..109c7eaf9 100644 --- a/src/cs/Bts.Spark.Core/utils_api/NumericCastConverter.cs +++ b/src/cs/Bts.Numerics/NumericCastConverter.cs @@ -179,7 +179,8 @@ namespace Spark.Core { _from_single = (Func)(object)new Func(v => (double)v); _from_decimal = (Func)(object)new Func(v => (double)v); } else { - Log.assert(false, $"Numeric conversion from {typeof(T)} not implemented"); + Console.Error.WriteLine($"Numeric conversion from {typeof(T)} not implemented"); + Environment.Exit(1); } } @@ -308,7 +309,8 @@ namespace Spark.Core { _to_single = (Func)(object)new Func(v => (float)v); _to_decimal = (Func)(object)new Func(v => (decimal)v); } else { - Log.assert(false, $"Numeric conversion to {typeof(T)} not implemented"); + Console.Error.WriteLine($"Numeric conversion from {typeof(T)} not implemented"); + Environment.Exit(1); } } @@ -355,8 +357,8 @@ namespace Spark.Core { var convert_prop = impl_t.GetProperty("convert"); _convert = (Func)convert_prop.GetValue(null); } catch (Exception ex) { - Log.assert( - false, $"Failed to initialize {typeof(NumericCastConverter)}: {ex}"); + Console.Error.WriteLine($"Failed to initialize {typeof(NumericCastConverter)}: {ex}"); + Environment.Exit(1); } } diff --git a/src/cs/Bts.Spark.Core/utils_api/NumericExtensions.cs b/src/cs/Bts.Numerics/NumericExtensions.cs similarity index 100% rename from src/cs/Bts.Spark.Core/utils_api/NumericExtensions.cs rename to src/cs/Bts.Numerics/NumericExtensions.cs diff --git a/src/cs/Bts.Spark.Core/Math/NumericOneof.cs b/src/cs/Bts.Numerics/NumericOneof.cs similarity index 100% rename from src/cs/Bts.Spark.Core/Math/NumericOneof.cs rename to src/cs/Bts.Numerics/NumericOneof.cs diff --git a/src/cs/Bts.Spark.Core/Math/RoundingMode.cs b/src/cs/Bts.Numerics/RoundingMode.cs similarity index 100% rename from src/cs/Bts.Spark.Core/Math/RoundingMode.cs rename to src/cs/Bts.Numerics/RoundingMode.cs diff --git a/src/cs/Bts.Spark.Core/Bts.Spark.Core.csproj b/src/cs/Bts.Spark.Core/Bts.Spark.Core.csproj index 47df61b87..7d434c807 100644 --- a/src/cs/Bts.Spark.Core/Bts.Spark.Core.csproj +++ b/src/cs/Bts.Spark.Core/Bts.Spark.Core.csproj @@ -34,6 +34,8 @@ + + PreserveNewest @@ -48,6 +50,8 @@ + + PreserveNewest diff --git a/src/cs/Bts.Spark.Core/Collections/IDualComparer.cs b/src/cs/Bts.Spark.Core/Collections/IDualComparer.cs deleted file mode 100644 index 64ac6963d..000000000 --- a/src/cs/Bts.Spark.Core/Collections/IDualComparer.cs +++ /dev/null @@ -1,18 +0,0 @@ -#nullable enable -namespace Spark.Core.Collections; - -using System; -using System.Collections; -using System.Collections.Generic; - -public interface IDualComparer : IComparer, IComparer { - int IComparer.Compare(object? x, object? y) { - if (x is not T xt && !ConvertUtils.try_convert(x, out xt)) { - throw new ArgumentException($"Unable to convert to type {typeof(T)}", nameof(x)); - } - if (y is not T yt && !ConvertUtils.try_convert(y, out yt)) { - throw new ArgumentException($"Unable to convert to type {typeof(T)}", nameof(y)); - } - return Compare(xt, yt); - } -} diff --git a/src/cs/Bts.Spark.Core/utils/Delegates.cs b/src/cs/Bts.Spark.Core/utils/Delegates.cs index 7fe58208e..2399e1137 100644 --- a/src/cs/Bts.Spark.Core/utils/Delegates.cs +++ b/src/cs/Bts.Spark.Core/utils/Delegates.cs @@ -2,9 +2,6 @@ using System.Globalization; namespace bts.utils { - public delegate bool TryGetValue(out T value); - public delegate bool TryGetValue(TKey key, out TValue value); - public static class LogicalDelegates { public static readonly Func And = (a, b) => a && b, diff --git a/tools/py/pack_spark_sdk.py b/tools/py/pack_spark_sdk.py index de444837b..fba40c4df 100644 --- a/tools/py/pack_spark_sdk.py +++ b/tools/py/pack_spark_sdk.py @@ -165,6 +165,19 @@ def _main(): pack_props["SparkNativeLinuxLib"] = native_linux_lib pack_cmd_base = DotnetCommand("pack").add_opts(pack_opts).add_props(pack_props) if args.cs: + # Build order matters. Dependent projects must be packed first. + # + # Further explanation: + # When packing nugets, internal ProjectReferences are replaced with PackageReferences. + # If missing, these references are resolved differently. When a ProjectReference isn't + # found (in the build dir), dotnet "resolves" it by building the project; if that fails, + # the main build fails. When a PackageReference isn't found (in the local nuget cache + # dir), dotnet "resolves" it by asking the configured package sources to provide it; if + # none do, the build fails. + run(pack_cmd_base.clone().add_positional("src/cs/Bts.Disposables").cmd) + run(pack_cmd_base.clone().add_positional("src/cs/Bts.Runtime").cmd) + run(pack_cmd_base.clone().add_positional("src/cs/Bts.Numerics").cmd) + run(pack_cmd_base.clone().add_positional("src/cs/Bts.Collections").cmd) run(pack_cmd_base.clone().add_positional("src/cs/Bts.Spark.Core").cmd) run(pack_cmd_base.clone().add_positional("src/cs/Bts.Extensions.Hosting").cmd) run(pack_cmd_base.clone().add_positional("src/cs/Bts.Spark.Api").cmd)