diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 1962828..8248a5a 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -24,7 +24,7 @@ jobs: - name: Setup .NET uses: actions/setup-dotnet@v1 with: - dotnet-version: 6.0.x + dotnet-version: 9.x - name: Install dependencies run: dotnet restore @@ -46,7 +46,7 @@ jobs: - name: Setup .NET uses: actions/setup-dotnet@v1 with: - dotnet-version: 6.0.x + dotnet-version: 9.x - name: Install dependencies run: dotnet restore diff --git a/Molecules.Test/MoleculeTest.cs b/Molecules.Test/MoleculeTest.cs index a8004a5..b8852cc 100644 --- a/Molecules.Test/MoleculeTest.cs +++ b/Molecules.Test/MoleculeTest.cs @@ -83,9 +83,9 @@ public void Parse_SingleAtom_ReturnsCorrectMolecule() var frequencies = molecule.ElementFrequencies.Select(x => x.Value).ToList(); // Assert - Assert.Equal(1, molecule.ElementFrequencies.Count); - Assert.Equal(Element.H, frequencies[0].Element); - Assert.Equal(1, frequencies[0].Frequency); + var frequency = Assert.Single(molecule.ElementFrequencies).Value; + Assert.Equal(Element.H, frequency.Element); + Assert.Equal(1, frequency.Frequency); Assert.Equal(1.00794, molecule.Mass); } @@ -100,9 +100,9 @@ public void Parse_SingleAtomWithTwoLetters_ReturnsCorrectMolecule() var frequencies = molecule.ElementFrequencies.Select(x => x.Value).ToList(); // Assert - Assert.Equal(1, molecule.ElementFrequencies.Count); - Assert.Equal(Element.He, frequencies[0].Element); - Assert.Equal(1, frequencies[0].Frequency); + var frequency = Assert.Single(molecule.ElementFrequencies).Value; + Assert.Equal(Element.He, frequency.Element); + Assert.Equal(1, frequency.Frequency); Assert.Equal(4.002602, molecule.Mass); } diff --git a/Molecules.Test/Molecules.Test.csproj b/Molecules.Test/Molecules.Test.csproj index ab9555b..42464bd 100644 --- a/Molecules.Test/Molecules.Test.csproj +++ b/Molecules.Test/Molecules.Test.csproj @@ -1,19 +1,19 @@  - net6.0 + net9.0 false false - - - + + + all runtime; build; native; contentfiles; analyzers; buildtransitive - + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/Molecules.Test/packages.lock.json b/Molecules.Test/packages.lock.json index 8da9c97..a1a894f 100644 --- a/Molecules.Test/packages.lock.json +++ b/Molecules.Test/packages.lock.json @@ -1,1054 +1,72 @@ { "version": 1, "dependencies": { - "net6.0": { + "net9.0": { "coverlet.collector": { "type": "Direct", - "requested": "[3.1.0, )", - "resolved": "3.1.0", - "contentHash": "YzYqSRrjoP5lULBhTDcTOjuM4IDPPi6PhFsl4w8EI4WdZhE6llt7E38Tg4CHyrS+QKwyu1+9OwkdDgluOdoBTw==" + "requested": "[6.0.4, )", + "resolved": "6.0.4", + "contentHash": "lkhqpF8Pu2Y7IiN7OntbsTtdbpR1syMsm2F3IgX6ootA4ffRqWL5jF7XipHuZQTdVuWG/gVAAcf8mjk8Tz0xPg==" }, "Microsoft.NET.Test.Sdk": { "type": "Direct", - "requested": "[17.0.0, )", - "resolved": "17.0.0", - "contentHash": "fJcnMY3jX1MzJvhGvUWauRhU5eQsOaHdwlrcnI3NabBhbi8WLAkMFI8d0YnewA/+b9q/U7vbhp8Xmh1vJ05FYQ==", + "requested": "[17.12.0, )", + "resolved": "17.12.0", + "contentHash": "kt/PKBZ91rFCWxVIJZSgVLk+YR+4KxTuHf799ho8WNiK5ZQpJNAEZCAWX86vcKrs+DiYjiibpYKdGZP6+/N17w==", "dependencies": { - "Microsoft.CodeCoverage": "17.0.0", - "Microsoft.TestPlatform.TestHost": "17.0.0" + "Microsoft.CodeCoverage": "17.12.0", + "Microsoft.TestPlatform.TestHost": "17.12.0" } }, "xunit": { "type": "Direct", - "requested": "[2.4.1, )", - "resolved": "2.4.1", - "contentHash": "XNR3Yz9QTtec16O0aKcO6+baVNpXmOnPUxDkCY97J+8krUYxPvXT1szYYEUdKk4sB8GOI2YbAjRIOm8ZnXRfzQ==", + "requested": "[2.9.3, )", + "resolved": "2.9.3", + "contentHash": "TlXQBinK35LpOPKHAqbLY4xlEen9TBafjs0V5KnA4wZsoQLQJiirCR4CbIXvOH8NzkW4YeJKP5P/Bnrodm0h9Q==", "dependencies": { - "xunit.analyzers": "0.10.0", - "xunit.assert": "[2.4.1]", - "xunit.core": "[2.4.1]" + "xunit.analyzers": "1.18.0", + "xunit.assert": "2.9.3", + "xunit.core": "[2.9.3]" } }, "xunit.runner.visualstudio": { "type": "Direct", - "requested": "[2.4.3, )", - "resolved": "2.4.3", - "contentHash": "kZZSmOmKA8OBlAJaquPXnJJLM9RwQ27H7BMVqfMLUcTi9xHinWGJiWksa3D4NEtz0wZ/nxd2mogObvBgJKCRhQ==" + "requested": "[3.0.1, )", + "resolved": "3.0.1", + "contentHash": "lbyYtsBxA8Pz8kaf5Xn/Mj1mL9z2nlBWdZhqFaj66nxXBa4JwiTDm4eGcpSMet6du9TOWI6bfha+gQR6+IHawg==" }, "Microsoft.CodeCoverage": { "type": "Transitive", - "resolved": "17.0.0", - "contentHash": "+B+09FPYBtf+cXfZOPIgpnP5mzLq5QdlBo+JEFy9CdqBaWHWE/YMY0Mos9uDsZhcgFegJm9GigAgMyqBZyfq+Q==" - }, - "Microsoft.CSharp": { - "type": "Transitive", - "resolved": "4.0.1", - "contentHash": "17h8b5mXa87XYKrrVqdgZ38JefSUqLChUQpXgSnpzsM0nDOhE40FTeNWOJ/YmySGV6tG6T8+hjz6vxbknHJr6A==", - "dependencies": { - "System.Collections": "4.0.11", - "System.Diagnostics.Debug": "4.0.11", - "System.Dynamic.Runtime": "4.0.11", - "System.Globalization": "4.0.11", - "System.Linq": "4.1.0", - "System.Linq.Expressions": "4.1.0", - "System.ObjectModel": "4.0.12", - "System.Reflection": "4.1.0", - "System.Reflection.Extensions": "4.0.1", - "System.Reflection.Primitives": "4.0.1", - "System.Reflection.TypeExtensions": "4.1.0", - "System.Resources.ResourceManager": "4.0.1", - "System.Runtime": "4.1.0", - "System.Runtime.Extensions": "4.1.0", - "System.Runtime.InteropServices": "4.1.0", - "System.Threading": "4.0.11" - } - }, - "Microsoft.NETCore.Platforms": { - "type": "Transitive", - "resolved": "1.1.0", - "contentHash": "kz0PEW2lhqygehI/d6XsPCQzD7ff7gUJaVGPVETX611eadGsA3A877GdSlU0LRVMCTH/+P3o2iDTak+S08V2+A==" - }, - "Microsoft.NETCore.Targets": { - "type": "Transitive", - "resolved": "1.1.0", - "contentHash": "aOZA3BWfz9RXjpzt0sRJJMjAscAUm3Hoa4UWAfceV9UTYxgwZ1lZt5nO2myFf+/jetYQo4uTP7zS8sJY67BBxg==" + "resolved": "17.12.0", + "contentHash": "4svMznBd5JM21JIG2xZKGNanAHNXplxf/kQDFfLHXQ3OnpJkayRK/TjacFjA+EYmoyuNXHo/sOETEfcYtAzIrA==" }, "Microsoft.TestPlatform.ObjectModel": { "type": "Transitive", - "resolved": "17.0.0", - "contentHash": "WMugCdPkA8U/BsSRc+3RN+DXcaYSDvp/s0MofVld08iF1O5fek4iKecygk6NruNf1rgJsv4LK71mrwbyeqhzHA==", + "resolved": "17.12.0", + "contentHash": "TDqkTKLfQuAaPcEb3pDDWnh7b3SyZF+/W9OZvWFp6eJCIiiYFdSB6taE2I6tWrFw5ywhzOb6sreoGJTI6m3rSQ==", "dependencies": { - "NuGet.Frameworks": "5.0.0", "System.Reflection.Metadata": "1.6.0" } }, "Microsoft.TestPlatform.TestHost": { "type": "Transitive", - "resolved": "17.0.0", - "contentHash": "xkKFzm0hylHF0SlDj78ACYMJC/i8fQ3i16sDDNYoKnjTsstGSQfuSBJ+QT4nqRXk/fOiYTh+iY0KIX5N7HTLuQ==", - "dependencies": { - "Microsoft.TestPlatform.ObjectModel": "17.0.0", - "Newtonsoft.Json": "9.0.1" - } - }, - "Microsoft.Win32.Primitives": { - "type": "Transitive", - "resolved": "4.3.0", - "contentHash": "9ZQKCWxH7Ijp9BfahvL2Zyf1cJIk8XYLF6Yjzr2yi0b2cOut/HQ31qf1ThHAgCc3WiZMdnWcfJCgN82/0UunxA==", + "resolved": "17.12.0", + "contentHash": "MiPEJQNyADfwZ4pJNpQex+t9/jOClBGMiCiVVFuELCMSX2nmNfvUor3uFVxNNCg30uxDP8JDYfPnMXQzsfzYyg==", "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Runtime": "4.3.0" - } - }, - "NETStandard.Library": { - "type": "Transitive", - "resolved": "1.6.1", - "contentHash": "WcSp3+vP+yHNgS8EV5J7pZ9IRpeDuARBPN28by8zqff1wJQXm26PVU8L3/fYLBJVU7BtDyqNVWq2KlCVvSSR4A==", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.Win32.Primitives": "4.3.0", - "System.AppContext": "4.3.0", - "System.Collections": "4.3.0", - "System.Collections.Concurrent": "4.3.0", - "System.Console": "4.3.0", - "System.Diagnostics.Debug": "4.3.0", - "System.Diagnostics.Tools": "4.3.0", - "System.Diagnostics.Tracing": "4.3.0", - "System.Globalization": "4.3.0", - "System.Globalization.Calendars": "4.3.0", - "System.IO": "4.3.0", - "System.IO.Compression": "4.3.0", - "System.IO.Compression.ZipFile": "4.3.0", - "System.IO.FileSystem": "4.3.0", - "System.IO.FileSystem.Primitives": "4.3.0", - "System.Linq": "4.3.0", - "System.Linq.Expressions": "4.3.0", - "System.Net.Http": "4.3.0", - "System.Net.Primitives": "4.3.0", - "System.Net.Sockets": "4.3.0", - "System.ObjectModel": "4.3.0", - "System.Reflection": "4.3.0", - "System.Reflection.Extensions": "4.3.0", - "System.Reflection.Primitives": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0", - "System.Runtime.Handles": "4.3.0", - "System.Runtime.InteropServices": "4.3.0", - "System.Runtime.InteropServices.RuntimeInformation": "4.3.0", - "System.Runtime.Numerics": "4.3.0", - "System.Security.Cryptography.Algorithms": "4.3.0", - "System.Security.Cryptography.Encoding": "4.3.0", - "System.Security.Cryptography.Primitives": "4.3.0", - "System.Security.Cryptography.X509Certificates": "4.3.0", - "System.Text.Encoding": "4.3.0", - "System.Text.Encoding.Extensions": "4.3.0", - "System.Text.RegularExpressions": "4.3.0", - "System.Threading": "4.3.0", - "System.Threading.Tasks": "4.3.0", - "System.Threading.Timer": "4.3.0", - "System.Xml.ReaderWriter": "4.3.0", - "System.Xml.XDocument": "4.3.0" + "Microsoft.TestPlatform.ObjectModel": "17.12.0", + "Newtonsoft.Json": "13.0.1" } }, "Newtonsoft.Json": { "type": "Transitive", - "resolved": "9.0.1", - "contentHash": "U82mHQSKaIk+lpSVCbWYKNavmNH1i5xrExDEquU1i6I5pV6UMOqRnJRSlKO3cMPfcpp0RgDY+8jUXHdQ4IfXvw==", - "dependencies": { - "Microsoft.CSharp": "4.0.1", - "System.Collections": "4.0.11", - "System.Diagnostics.Debug": "4.0.11", - "System.Dynamic.Runtime": "4.0.11", - "System.Globalization": "4.0.11", - "System.IO": "4.1.0", - "System.Linq": "4.1.0", - "System.Linq.Expressions": "4.1.0", - "System.ObjectModel": "4.0.12", - "System.Reflection": "4.1.0", - "System.Reflection.Extensions": "4.0.1", - "System.Resources.ResourceManager": "4.0.1", - "System.Runtime": "4.1.0", - "System.Runtime.Extensions": "4.1.0", - "System.Runtime.Serialization.Primitives": "4.1.1", - "System.Text.Encoding": "4.0.11", - "System.Text.Encoding.Extensions": "4.0.11", - "System.Text.RegularExpressions": "4.1.0", - "System.Threading": "4.0.11", - "System.Threading.Tasks": "4.0.11", - "System.Xml.ReaderWriter": "4.0.11", - "System.Xml.XDocument": "4.0.11" - } - }, - "NuGet.Frameworks": { - "type": "Transitive", - "resolved": "5.0.0", - "contentHash": "c5JVjuVAm4f7E9Vj+v09Z9s2ZsqFDjBpcsyS3M9xRo0bEdm/LVZSzLxxNvfvAwRiiE8nwe1h2G4OwiwlzFKXlA==" - }, - "runtime.debian.8-x64.runtime.native.System.Security.Cryptography.OpenSsl": { - "type": "Transitive", - "resolved": "4.3.0", - "contentHash": "HdSSp5MnJSsg08KMfZThpuLPJpPwE5hBXvHwoKWosyHHfe8Mh5WKT0ylEOf6yNzX6Ngjxe4Whkafh5q7Ymac4Q==" - }, - "runtime.fedora.23-x64.runtime.native.System.Security.Cryptography.OpenSsl": { - "type": "Transitive", - "resolved": "4.3.0", - "contentHash": "+yH1a49wJMy8Zt4yx5RhJrxO/DBDByAiCzNwiETI+1S4mPdCu0OY4djdciC7Vssk0l22wQaDLrXxXkp+3+7bVA==" - }, - "runtime.fedora.24-x64.runtime.native.System.Security.Cryptography.OpenSsl": { - "type": "Transitive", - "resolved": "4.3.0", - "contentHash": "c3YNH1GQJbfIPJeCnr4avseugSqPrxwIqzthYyZDN6EuOyNOzq+y2KSUfRcXauya1sF4foESTgwM5e1A8arAKw==" - }, - "runtime.native.System": { - "type": "Transitive", - "resolved": "4.3.0", - "contentHash": "c/qWt2LieNZIj1jGnVNsE2Kl23Ya2aSTBuXMD6V7k9KWr6l16Tqdwq+hJScEpWER9753NWC8h96PaVNY5Ld7Jw==", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0" - } - }, - "runtime.native.System.IO.Compression": { - "type": "Transitive", - "resolved": "4.3.0", - "contentHash": "INBPonS5QPEgn7naufQFXJEp3zX6L4bwHgJ/ZH78aBTpeNfQMtf7C6VrAFhlq2xxWBveIOWyFzQjJ8XzHMhdOQ==", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0" - } - }, - "runtime.native.System.Net.Http": { - "type": "Transitive", - "resolved": "4.3.0", - "contentHash": "ZVuZJqnnegJhd2k/PtAbbIcZ3aZeITq3sj06oKfMBSfphW3HDmk/t4ObvbOk/JA/swGR0LNqMksAh/f7gpTROg==", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0" - } - }, - "runtime.native.System.Security.Cryptography.Apple": { - "type": "Transitive", - "resolved": "4.3.0", - "contentHash": "DloMk88juo0OuOWr56QG7MNchmafTLYWvABy36izkrLI5VledI0rq28KGs1i9wbpeT9NPQrx/wTf8U2vazqQ3Q==", - "dependencies": { - "runtime.osx.10.10-x64.runtime.native.System.Security.Cryptography.Apple": "4.3.0" - } - }, - "runtime.native.System.Security.Cryptography.OpenSsl": { - "type": "Transitive", - "resolved": "4.3.0", - "contentHash": "NS1U+700m4KFRHR5o4vo9DSlTmlCKu/u7dtE5sUHVIPB+xpXxYQvgBgA6wEIeCz6Yfn0Z52/72WYsToCEPJnrw==", - "dependencies": { - "runtime.debian.8-x64.runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0", - "runtime.fedora.23-x64.runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0", - "runtime.fedora.24-x64.runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0", - "runtime.opensuse.13.2-x64.runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0", - "runtime.opensuse.42.1-x64.runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0", - "runtime.osx.10.10-x64.runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0", - "runtime.rhel.7-x64.runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0", - "runtime.ubuntu.14.04-x64.runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0", - "runtime.ubuntu.16.04-x64.runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0", - "runtime.ubuntu.16.10-x64.runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0" - } - }, - "runtime.opensuse.13.2-x64.runtime.native.System.Security.Cryptography.OpenSsl": { - "type": "Transitive", - "resolved": "4.3.0", - "contentHash": "b3pthNgxxFcD+Pc0WSEoC0+md3MyhRS6aCEeenvNE3Fdw1HyJ18ZhRFVJJzIeR/O/jpxPboB805Ho0T3Ul7w8A==" - }, - "runtime.opensuse.42.1-x64.runtime.native.System.Security.Cryptography.OpenSsl": { - "type": "Transitive", - "resolved": "4.3.0", - "contentHash": "KeLz4HClKf+nFS7p/6Fi/CqyLXh81FpiGzcmuS8DGi9lUqSnZ6Es23/gv2O+1XVGfrbNmviF7CckBpavkBoIFQ==" - }, - "runtime.osx.10.10-x64.runtime.native.System.Security.Cryptography.Apple": { - "type": "Transitive", - "resolved": "4.3.0", - "contentHash": "kVXCuMTrTlxq4XOOMAysuNwsXWpYeboGddNGpIgNSZmv1b6r/s/DPk0fYMB7Q5Qo4bY68o48jt4T4y5BVecbCQ==" - }, - "runtime.osx.10.10-x64.runtime.native.System.Security.Cryptography.OpenSsl": { - "type": "Transitive", - "resolved": "4.3.0", - "contentHash": "X7IdhILzr4ROXd8mI1BUCQMSHSQwelUlBjF1JyTKCjXaOGn2fB4EKBxQbCK2VjO3WaWIdlXZL3W6TiIVnrhX4g==" - }, - "runtime.rhel.7-x64.runtime.native.System.Security.Cryptography.OpenSsl": { - "type": "Transitive", - "resolved": "4.3.0", - "contentHash": "nyFNiCk/r+VOiIqreLix8yN+q3Wga9+SE8BCgkf+2BwEKiNx6DyvFjCgkfV743/grxv8jHJ8gUK4XEQw7yzRYg==" - }, - "runtime.ubuntu.14.04-x64.runtime.native.System.Security.Cryptography.OpenSsl": { - "type": "Transitive", - "resolved": "4.3.0", - "contentHash": "ytoewC6wGorL7KoCAvRfsgoJPJbNq+64k2SqW6JcOAebWsFUvCCYgfzQMrnpvPiEl4OrblUlhF2ji+Q1+SVLrQ==" - }, - "runtime.ubuntu.16.04-x64.runtime.native.System.Security.Cryptography.OpenSsl": { - "type": "Transitive", - "resolved": "4.3.0", - "contentHash": "I8bKw2I8k58Wx7fMKQJn2R8lamboCAiHfHeV/pS65ScKWMMI0+wJkLYlEKvgW1D/XvSl/221clBoR2q9QNNM7A==" - }, - "runtime.ubuntu.16.10-x64.runtime.native.System.Security.Cryptography.OpenSsl": { - "type": "Transitive", - "resolved": "4.3.0", - "contentHash": "VB5cn/7OzUfzdnC8tqAIMQciVLiq2epm2NrAm1E9OjNRyG4lVhfR61SMcLizejzQP8R8Uf/0l5qOIbUEi+RdEg==" - }, - "System.AppContext": { - "type": "Transitive", - "resolved": "4.3.0", - "contentHash": "fKC+rmaLfeIzUhagxY17Q9siv/sPrjjKcfNg1Ic8IlQkZLipo8ljcaZQu4VtI4Jqbzjc2VTjzGLF6WmsRXAEgA==", - "dependencies": { - "System.Runtime": "4.3.0" - } - }, - "System.Buffers": { - "type": "Transitive", - "resolved": "4.3.0", - "contentHash": "ratu44uTIHgeBeI0dE8DWvmXVBSo4u7ozRZZHOMmK/JPpYyo0dAfgSiHlpiObMQ5lEtEyIXA40sKRYg5J6A8uQ==", - "dependencies": { - "System.Diagnostics.Debug": "4.3.0", - "System.Diagnostics.Tracing": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Threading": "4.3.0" - } - }, - "System.Collections": { - "type": "Transitive", - "resolved": "4.3.0", - "contentHash": "3Dcj85/TBdVpL5Zr+gEEBUuFe2icOnLalmEh9hfck1PTYbbyWuZgh4fmm2ysCLTrqLQw6t3TgTyJ+VLp+Qb+Lw==", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Runtime": "4.3.0" - } - }, - "System.Collections.Concurrent": { - "type": "Transitive", - "resolved": "4.3.0", - "contentHash": "ztl69Xp0Y/UXCL+3v3tEU+lIy+bvjKNUmopn1wep/a291pVPK7dxBd6T7WnlQqRog+d1a/hSsgRsmFnIBKTPLQ==", - "dependencies": { - "System.Collections": "4.3.0", - "System.Diagnostics.Debug": "4.3.0", - "System.Diagnostics.Tracing": "4.3.0", - "System.Globalization": "4.3.0", - "System.Reflection": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0", - "System.Threading": "4.3.0", - "System.Threading.Tasks": "4.3.0" - } - }, - "System.Console": { - "type": "Transitive", - "resolved": "4.3.0", - "contentHash": "DHDrIxiqk1h03m6khKWV2X8p/uvN79rgSqpilL6uzpmSfxfU5ng8VcPtW4qsDsQDHiTv6IPV9TmD5M/vElPNLg==", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.IO": "4.3.0", - "System.Runtime": "4.3.0", - "System.Text.Encoding": "4.3.0" - } - }, - "System.Diagnostics.Debug": { - "type": "Transitive", - "resolved": "4.3.0", - "contentHash": "ZUhUOdqmaG5Jk3Xdb8xi5kIyQYAA4PnTNlHx1mu9ZY3qv4ELIdKbnL/akbGaKi2RnNUWaZsAs31rvzFdewTj2g==", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Runtime": "4.3.0" - } - }, - "System.Diagnostics.DiagnosticSource": { - "type": "Transitive", - "resolved": "4.3.0", - "contentHash": "tD6kosZnTAGdrEa0tZSuFyunMbt/5KYDnHdndJYGqZoNy00XVXyACd5d6KnE1YgYv3ne2CjtAfNXo/fwEhnKUA==", - "dependencies": { - "System.Collections": "4.3.0", - "System.Diagnostics.Tracing": "4.3.0", - "System.Reflection": "4.3.0", - "System.Runtime": "4.3.0", - "System.Threading": "4.3.0" - } - }, - "System.Diagnostics.Tools": { - "type": "Transitive", - "resolved": "4.3.0", - "contentHash": "UUvkJfSYJMM6x527dJg2VyWPSRqIVB0Z7dbjHst1zmwTXz5CcXSYJFWRpuigfbO1Lf7yfZiIaEUesfnl/g5EyA==", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Runtime": "4.3.0" - } - }, - "System.Diagnostics.Tracing": { - "type": "Transitive", - "resolved": "4.3.0", - "contentHash": "rswfv0f/Cqkh78rA5S8eN8Neocz234+emGCtTF3lxPY96F+mmmUen6tbn0glN6PMvlKQb9bPAY5e9u7fgPTkKw==", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Runtime": "4.3.0" - } - }, - "System.Dynamic.Runtime": { - "type": "Transitive", - "resolved": "4.0.11", - "contentHash": "db34f6LHYM0U0JpE+sOmjar27BnqTVkbLJhgfwMpTdgTigG/Hna3m2MYVwnFzGGKnEJk2UXFuoVTr8WUbU91/A==", - "dependencies": { - "System.Collections": "4.0.11", - "System.Diagnostics.Debug": "4.0.11", - "System.Globalization": "4.0.11", - "System.Linq": "4.1.0", - "System.Linq.Expressions": "4.1.0", - "System.ObjectModel": "4.0.12", - "System.Reflection": "4.1.0", - "System.Reflection.Emit": "4.0.1", - "System.Reflection.Emit.ILGeneration": "4.0.1", - "System.Reflection.Primitives": "4.0.1", - "System.Reflection.TypeExtensions": "4.1.0", - "System.Resources.ResourceManager": "4.0.1", - "System.Runtime": "4.1.0", - "System.Runtime.Extensions": "4.1.0", - "System.Threading": "4.0.11" - } - }, - "System.Globalization": { - "type": "Transitive", - "resolved": "4.3.0", - "contentHash": "kYdVd2f2PAdFGblzFswE4hkNANJBKRmsfa2X5LG2AcWE1c7/4t0pYae1L8vfZ5xvE2nK/R9JprtToA61OSHWIg==", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Runtime": "4.3.0" - } - }, - "System.Globalization.Calendars": { - "type": "Transitive", - "resolved": "4.3.0", - "contentHash": "GUlBtdOWT4LTV3I+9/PJW+56AnnChTaOqqTLFtdmype/L500M2LIyXgmtd9X2P2VOkmJd5c67H5SaC2QcL1bFA==", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Globalization": "4.3.0", - "System.Runtime": "4.3.0" - } - }, - "System.Globalization.Extensions": { - "type": "Transitive", - "resolved": "4.3.0", - "contentHash": "FhKmdR6MPG+pxow6wGtNAWdZh7noIOpdD5TwQ3CprzgIE1bBBoim0vbR1+AWsWjQmU7zXHgQo4TWSP6lCeiWcQ==", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "System.Globalization": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0", - "System.Runtime.InteropServices": "4.3.0" - } - }, - "System.IO": { - "type": "Transitive", - "resolved": "4.3.0", - "contentHash": "3qjaHvxQPDpSOYICjUoTsmoq5u6QJAFRUITgeT/4gqkF1bajbSmb1kwSxEA8AHlofqgcKJcM8udgieRNhaJ5Cg==", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Runtime": "4.3.0", - "System.Text.Encoding": "4.3.0", - "System.Threading.Tasks": "4.3.0" - } - }, - "System.IO.Compression": { - "type": "Transitive", - "resolved": "4.3.0", - "contentHash": "YHndyoiV90iu4iKG115ibkhrG+S3jBm8Ap9OwoUAzO5oPDAWcr0SFwQFm0HjM8WkEZWo0zvLTyLmbvTkW1bXgg==", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "System.Buffers": "4.3.0", - "System.Collections": "4.3.0", - "System.Diagnostics.Debug": "4.3.0", - "System.IO": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0", - "System.Runtime.Handles": "4.3.0", - "System.Runtime.InteropServices": "4.3.0", - "System.Text.Encoding": "4.3.0", - "System.Threading": "4.3.0", - "System.Threading.Tasks": "4.3.0", - "runtime.native.System": "4.3.0", - "runtime.native.System.IO.Compression": "4.3.0" - } - }, - "System.IO.Compression.ZipFile": { - "type": "Transitive", - "resolved": "4.3.0", - "contentHash": "G4HwjEsgIwy3JFBduZ9quBkAu+eUwjIdJleuNSgmUojbH6O3mlvEIme+GHx/cLlTAPcrnnL7GqvB9pTlWRfhOg==", - "dependencies": { - "System.Buffers": "4.3.0", - "System.IO": "4.3.0", - "System.IO.Compression": "4.3.0", - "System.IO.FileSystem": "4.3.0", - "System.IO.FileSystem.Primitives": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0", - "System.Text.Encoding": "4.3.0" - } - }, - "System.IO.FileSystem": { - "type": "Transitive", - "resolved": "4.3.0", - "contentHash": "3wEMARTnuio+ulnvi+hkRNROYwa1kylvYahhcLk4HSoVdl+xxTFVeVlYOfLwrDPImGls0mDqbMhrza8qnWPTdA==", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.IO": "4.3.0", - "System.IO.FileSystem.Primitives": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Handles": "4.3.0", - "System.Text.Encoding": "4.3.0", - "System.Threading.Tasks": "4.3.0" - } - }, - "System.IO.FileSystem.Primitives": { - "type": "Transitive", - "resolved": "4.3.0", - "contentHash": "6QOb2XFLch7bEc4lIcJH49nJN2HV+OC3fHDgsLVsBVBk3Y4hFAnOBGzJ2lUu7CyDDFo9IBWkSsnbkT6IBwwiMw==", - "dependencies": { - "System.Runtime": "4.3.0" - } - }, - "System.Linq": { - "type": "Transitive", - "resolved": "4.3.0", - "contentHash": "5DbqIUpsDp0dFftytzuMmc0oeMdQwjcP/EWxsksIz/w1TcFRkZ3yKKz0PqiYFMmEwPSWw+qNVqD7PJ889JzHbw==", - "dependencies": { - "System.Collections": "4.3.0", - "System.Diagnostics.Debug": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0" - } - }, - "System.Linq.Expressions": { - "type": "Transitive", - "resolved": "4.3.0", - "contentHash": "PGKkrd2khG4CnlyJwxwwaWWiSiWFNBGlgXvJpeO0xCXrZ89ODrQ6tjEWS/kOqZ8GwEOUATtKtzp1eRgmYNfclg==", - "dependencies": { - "System.Collections": "4.3.0", - "System.Diagnostics.Debug": "4.3.0", - "System.Globalization": "4.3.0", - "System.IO": "4.3.0", - "System.Linq": "4.3.0", - "System.ObjectModel": "4.3.0", - "System.Reflection": "4.3.0", - "System.Reflection.Emit": "4.3.0", - "System.Reflection.Emit.ILGeneration": "4.3.0", - "System.Reflection.Emit.Lightweight": "4.3.0", - "System.Reflection.Extensions": "4.3.0", - "System.Reflection.Primitives": "4.3.0", - "System.Reflection.TypeExtensions": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0", - "System.Threading": "4.3.0" - } - }, - "System.Net.Http": { - "type": "Transitive", - "resolved": "4.3.0", - "contentHash": "sYg+FtILtRQuYWSIAuNOELwVuVsxVyJGWQyOnlAzhV4xvhyFnON1bAzYYC+jjRW8JREM45R0R5Dgi8MTC5sEwA==", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "System.Collections": "4.3.0", - "System.Diagnostics.Debug": "4.3.0", - "System.Diagnostics.DiagnosticSource": "4.3.0", - "System.Diagnostics.Tracing": "4.3.0", - "System.Globalization": "4.3.0", - "System.Globalization.Extensions": "4.3.0", - "System.IO": "4.3.0", - "System.IO.FileSystem": "4.3.0", - "System.Net.Primitives": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0", - "System.Runtime.Handles": "4.3.0", - "System.Runtime.InteropServices": "4.3.0", - "System.Security.Cryptography.Algorithms": "4.3.0", - "System.Security.Cryptography.Encoding": "4.3.0", - "System.Security.Cryptography.OpenSsl": "4.3.0", - "System.Security.Cryptography.Primitives": "4.3.0", - "System.Security.Cryptography.X509Certificates": "4.3.0", - "System.Text.Encoding": "4.3.0", - "System.Threading": "4.3.0", - "System.Threading.Tasks": "4.3.0", - "runtime.native.System": "4.3.0", - "runtime.native.System.Net.Http": "4.3.0", - "runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0" - } - }, - "System.Net.Primitives": { - "type": "Transitive", - "resolved": "4.3.0", - "contentHash": "qOu+hDwFwoZPbzPvwut2qATe3ygjeQBDQj91xlsaqGFQUI5i4ZnZb8yyQuLGpDGivEPIt8EJkd1BVzVoP31FXA==", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Runtime": "4.3.0", - "System.Runtime.Handles": "4.3.0" - } - }, - "System.Net.Sockets": { - "type": "Transitive", - "resolved": "4.3.0", - "contentHash": "m6icV6TqQOAdgt5N/9I5KNpjom/5NFtkmGseEH+AK/hny8XrytLH3+b5M8zL/Ycg3fhIocFpUMyl/wpFnVRvdw==", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.IO": "4.3.0", - "System.Net.Primitives": "4.3.0", - "System.Runtime": "4.3.0", - "System.Threading.Tasks": "4.3.0" - } - }, - "System.ObjectModel": { - "type": "Transitive", - "resolved": "4.3.0", - "contentHash": "bdX+80eKv9bN6K4N+d77OankKHGn6CH711a6fcOpMQu2Fckp/Ft4L/kW9WznHpyR0NRAvJutzOMHNNlBGvxQzQ==", - "dependencies": { - "System.Collections": "4.3.0", - "System.Diagnostics.Debug": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Threading": "4.3.0" - } - }, - "System.Reflection": { - "type": "Transitive", - "resolved": "4.3.0", - "contentHash": "KMiAFoW7MfJGa9nDFNcfu+FpEdiHpWgTcS2HdMpDvt9saK3y/G4GwprPyzqjFH9NTaGPQeWNHU+iDlDILj96aQ==", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.IO": "4.3.0", - "System.Reflection.Primitives": "4.3.0", - "System.Runtime": "4.3.0" - } - }, - "System.Reflection.Emit": { - "type": "Transitive", - "resolved": "4.3.0", - "contentHash": "228FG0jLcIwTVJyz8CLFKueVqQK36ANazUManGaJHkO0icjiIypKW7YLWLIWahyIkdh5M7mV2dJepllLyA1SKg==", - "dependencies": { - "System.IO": "4.3.0", - "System.Reflection": "4.3.0", - "System.Reflection.Emit.ILGeneration": "4.3.0", - "System.Reflection.Primitives": "4.3.0", - "System.Runtime": "4.3.0" - } - }, - "System.Reflection.Emit.ILGeneration": { - "type": "Transitive", - "resolved": "4.3.0", - "contentHash": "59tBslAk9733NXLrUJrwNZEzbMAcu8k344OYo+wfSVygcgZ9lgBdGIzH/nrg3LYhXceynyvTc8t5/GD4Ri0/ng==", - "dependencies": { - "System.Reflection": "4.3.0", - "System.Reflection.Primitives": "4.3.0", - "System.Runtime": "4.3.0" - } - }, - "System.Reflection.Emit.Lightweight": { - "type": "Transitive", - "resolved": "4.3.0", - "contentHash": "oadVHGSMsTmZsAF864QYN1t1QzZjIcuKU3l2S9cZOwDdDueNTrqq1yRj7koFfIGEnKpt6NjpL3rOzRhs4ryOgA==", - "dependencies": { - "System.Reflection": "4.3.0", - "System.Reflection.Emit.ILGeneration": "4.3.0", - "System.Reflection.Primitives": "4.3.0", - "System.Runtime": "4.3.0" - } - }, - "System.Reflection.Extensions": { - "type": "Transitive", - "resolved": "4.3.0", - "contentHash": "rJkrJD3kBI5B712aRu4DpSIiHRtr6QlfZSQsb0hYHrDCZORXCFjQfoipo2LaMUHoT9i1B7j7MnfaEKWDFmFQNQ==", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Reflection": "4.3.0", - "System.Runtime": "4.3.0" - } + "resolved": "13.0.1", + "contentHash": "ppPFpBcvxdsfUonNcvITKqLl3bqxWbDCZIzDWHzjpdAHRFfZe0Dw9HmA0+za13IdyrgJwpkDTDA9fHaxOrt20A==" }, "System.Reflection.Metadata": { "type": "Transitive", "resolved": "1.6.0", "contentHash": "COC1aiAJjCoA5GBF+QKL2uLqEBew4JsCkQmoHKbN3TlOZKa2fKLz5CpiRQKDz0RsAOEGsVKqOD5bomsXq/4STQ==" }, - "System.Reflection.Primitives": { - "type": "Transitive", - "resolved": "4.3.0", - "contentHash": "5RXItQz5As4xN2/YUDxdpsEkMhvw3e6aNveFXUn4Hl/udNTCNhnKp8lT9fnc3MhvGKh1baak5CovpuQUXHAlIA==", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Runtime": "4.3.0" - } - }, - "System.Reflection.TypeExtensions": { - "type": "Transitive", - "resolved": "4.3.0", - "contentHash": "7u6ulLcZbyxB5Gq0nMkQttcdBTx57ibzw+4IOXEfR+sXYQoHvjW5LTLyNr8O22UIMrqYbchJQJnos4eooYzYJA==", - "dependencies": { - "System.Reflection": "4.3.0", - "System.Runtime": "4.3.0" - } - }, - "System.Resources.ResourceManager": { - "type": "Transitive", - "resolved": "4.3.0", - "contentHash": "/zrcPkkWdZmI4F92gL/TPumP98AVDu/Wxr3CSJGQQ+XN6wbRZcyfSKVoPo17ilb3iOr0cCRqJInGwNMolqhS8A==", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Globalization": "4.3.0", - "System.Reflection": "4.3.0", - "System.Runtime": "4.3.0" - } - }, - "System.Runtime": { - "type": "Transitive", - "resolved": "4.3.0", - "contentHash": "JufQi0vPQ0xGnAczR13AUFglDyVYt4Kqnz1AZaiKZ5+GICq0/1MH/mO/eAJHt/mHW1zjKBJd7kV26SrxddAhiw==", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0" - } - }, - "System.Runtime.Extensions": { - "type": "Transitive", - "resolved": "4.3.0", - "contentHash": "guW0uK0fn5fcJJ1tJVXYd7/1h5F+pea1r7FLSOz/f8vPEqbR2ZAknuRDvTQ8PzAilDveOxNjSfr0CHfIQfFk8g==", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Runtime": "4.3.0" - } - }, - "System.Runtime.Handles": { - "type": "Transitive", - "resolved": "4.3.0", - "contentHash": "OKiSUN7DmTWeYb3l51A7EYaeNMnvxwE249YtZz7yooT4gOZhmTjIn48KgSsw2k2lYdLgTKNJw/ZIfSElwDRVgg==", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Runtime": "4.3.0" - } - }, - "System.Runtime.InteropServices": { - "type": "Transitive", - "resolved": "4.3.0", - "contentHash": "uv1ynXqiMK8mp1GM3jDqPCFN66eJ5w5XNomaK2XD+TuCroNTLFGeZ+WCmBMcBDyTFKou3P6cR6J/QsaqDp7fGQ==", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Reflection": "4.3.0", - "System.Reflection.Primitives": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Handles": "4.3.0" - } - }, - "System.Runtime.InteropServices.RuntimeInformation": { - "type": "Transitive", - "resolved": "4.3.0", - "contentHash": "cbz4YJMqRDR7oLeMRbdYv7mYzc++17lNhScCX0goO2XpGWdvAt60CGN+FHdePUEHCe/Jy9jUlvNAiNdM+7jsOw==", - "dependencies": { - "System.Reflection": "4.3.0", - "System.Reflection.Extensions": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.InteropServices": "4.3.0", - "System.Threading": "4.3.0", - "runtime.native.System": "4.3.0" - } - }, - "System.Runtime.Numerics": { - "type": "Transitive", - "resolved": "4.3.0", - "contentHash": "yMH+MfdzHjy17l2KESnPiF2dwq7T+xLnSJar7slyimAkUh/gTrS9/UQOtv7xarskJ2/XDSNvfLGOBQPjL7PaHQ==", - "dependencies": { - "System.Globalization": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0" - } - }, - "System.Runtime.Serialization.Primitives": { - "type": "Transitive", - "resolved": "4.1.1", - "contentHash": "HZ6Du5QrTG8MNJbf4e4qMO3JRAkIboGT5Fk804uZtg3Gq516S7hAqTm2UZKUHa7/6HUGdVy3AqMQKbns06G/cg==", - "dependencies": { - "System.Resources.ResourceManager": "4.0.1", - "System.Runtime": "4.1.0" - } - }, - "System.Security.Cryptography.Algorithms": { - "type": "Transitive", - "resolved": "4.3.0", - "contentHash": "W1kd2Y8mYSCgc3ULTAZ0hOP2dSdG5YauTb1089T0/kRcN2MpSAW1izOFROrJgxSlMn3ArsgHXagigyi+ibhevg==", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "System.Collections": "4.3.0", - "System.IO": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0", - "System.Runtime.Handles": "4.3.0", - "System.Runtime.InteropServices": "4.3.0", - "System.Runtime.Numerics": "4.3.0", - "System.Security.Cryptography.Encoding": "4.3.0", - "System.Security.Cryptography.Primitives": "4.3.0", - "System.Text.Encoding": "4.3.0", - "runtime.native.System.Security.Cryptography.Apple": "4.3.0", - "runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0" - } - }, - "System.Security.Cryptography.Cng": { - "type": "Transitive", - "resolved": "4.3.0", - "contentHash": "03idZOqFlsKRL4W+LuCpJ6dBYDUWReug6lZjBa3uJWnk5sPCUXckocevTaUA8iT/MFSrY/2HXkOt753xQ/cf8g==", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "System.IO": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0", - "System.Runtime.Handles": "4.3.0", - "System.Runtime.InteropServices": "4.3.0", - "System.Security.Cryptography.Algorithms": "4.3.0", - "System.Security.Cryptography.Encoding": "4.3.0", - "System.Security.Cryptography.Primitives": "4.3.0", - "System.Text.Encoding": "4.3.0" - } - }, - "System.Security.Cryptography.Csp": { - "type": "Transitive", - "resolved": "4.3.0", - "contentHash": "X4s/FCkEUnRGnwR3aSfVIkldBmtURMhmexALNTwpjklzxWU7yjMk7GHLKOZTNkgnWnE0q7+BCf9N2LVRWxewaA==", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "System.IO": "4.3.0", - "System.Reflection": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0", - "System.Runtime.Handles": "4.3.0", - "System.Runtime.InteropServices": "4.3.0", - "System.Security.Cryptography.Algorithms": "4.3.0", - "System.Security.Cryptography.Encoding": "4.3.0", - "System.Security.Cryptography.Primitives": "4.3.0", - "System.Text.Encoding": "4.3.0", - "System.Threading": "4.3.0" - } - }, - "System.Security.Cryptography.Encoding": { - "type": "Transitive", - "resolved": "4.3.0", - "contentHash": "1DEWjZZly9ae9C79vFwqaO5kaOlI5q+3/55ohmq/7dpDyDfc8lYe7YVxJUZ5MF/NtbkRjwFRo14yM4OEo9EmDw==", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "System.Collections": "4.3.0", - "System.Collections.Concurrent": "4.3.0", - "System.Linq": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0", - "System.Runtime.Handles": "4.3.0", - "System.Runtime.InteropServices": "4.3.0", - "System.Security.Cryptography.Primitives": "4.3.0", - "System.Text.Encoding": "4.3.0", - "runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0" - } - }, - "System.Security.Cryptography.OpenSsl": { - "type": "Transitive", - "resolved": "4.3.0", - "contentHash": "h4CEgOgv5PKVF/HwaHzJRiVboL2THYCou97zpmhjghx5frc7fIvlkY1jL+lnIQyChrJDMNEXS6r7byGif8Cy4w==", - "dependencies": { - "System.Collections": "4.3.0", - "System.IO": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0", - "System.Runtime.Handles": "4.3.0", - "System.Runtime.InteropServices": "4.3.0", - "System.Runtime.Numerics": "4.3.0", - "System.Security.Cryptography.Algorithms": "4.3.0", - "System.Security.Cryptography.Encoding": "4.3.0", - "System.Security.Cryptography.Primitives": "4.3.0", - "System.Text.Encoding": "4.3.0", - "runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0" - } - }, - "System.Security.Cryptography.Primitives": { - "type": "Transitive", - "resolved": "4.3.0", - "contentHash": "7bDIyVFNL/xKeFHjhobUAQqSpJq9YTOpbEs6mR233Et01STBMXNAc/V+BM6dwYGc95gVh/Zf+iVXWzj3mE8DWg==", - "dependencies": { - "System.Diagnostics.Debug": "4.3.0", - "System.Globalization": "4.3.0", - "System.IO": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Threading": "4.3.0", - "System.Threading.Tasks": "4.3.0" - } - }, - "System.Security.Cryptography.X509Certificates": { - "type": "Transitive", - "resolved": "4.3.0", - "contentHash": "t2Tmu6Y2NtJ2um0RtcuhP7ZdNNxXEgUm2JeoA/0NvlMjAhKCnM1NX07TDl3244mVp3QU6LPEhT3HTtH1uF7IYw==", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "System.Collections": "4.3.0", - "System.Diagnostics.Debug": "4.3.0", - "System.Globalization": "4.3.0", - "System.Globalization.Calendars": "4.3.0", - "System.IO": "4.3.0", - "System.IO.FileSystem": "4.3.0", - "System.IO.FileSystem.Primitives": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0", - "System.Runtime.Handles": "4.3.0", - "System.Runtime.InteropServices": "4.3.0", - "System.Runtime.Numerics": "4.3.0", - "System.Security.Cryptography.Algorithms": "4.3.0", - "System.Security.Cryptography.Cng": "4.3.0", - "System.Security.Cryptography.Csp": "4.3.0", - "System.Security.Cryptography.Encoding": "4.3.0", - "System.Security.Cryptography.OpenSsl": "4.3.0", - "System.Security.Cryptography.Primitives": "4.3.0", - "System.Text.Encoding": "4.3.0", - "System.Threading": "4.3.0", - "runtime.native.System": "4.3.0", - "runtime.native.System.Net.Http": "4.3.0", - "runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0" - } - }, - "System.Text.Encoding": { - "type": "Transitive", - "resolved": "4.3.0", - "contentHash": "BiIg+KWaSDOITze6jGQynxg64naAPtqGHBwDrLaCtixsa5bKiR8dpPOHA7ge3C0JJQizJE+sfkz1wV+BAKAYZw==", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Runtime": "4.3.0" - } - }, - "System.Text.Encoding.Extensions": { - "type": "Transitive", - "resolved": "4.3.0", - "contentHash": "YVMK0Bt/A43RmwizJoZ22ei2nmrhobgeiYwFzC4YAN+nue8RF6djXDMog0UCn+brerQoYVyaS+ghy9P/MUVcmw==", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Runtime": "4.3.0", - "System.Text.Encoding": "4.3.0" - } - }, - "System.Text.RegularExpressions": { - "type": "Transitive", - "resolved": "4.3.0", - "contentHash": "RpT2DA+L660cBt1FssIE9CAGpLFdFPuheB7pLpKpn6ZXNby7jDERe8Ua/Ne2xGiwLVG2JOqziiaVCGDon5sKFA==", - "dependencies": { - "System.Runtime": "4.3.0" - } - }, - "System.Threading": { - "type": "Transitive", - "resolved": "4.3.0", - "contentHash": "VkUS0kOBcUf3Wwm0TSbrevDDZ6BlM+b/HRiapRFWjM5O0NS0LviG0glKmFK+hhPDd1XFeSdU1GmlLhb2CoVpIw==", - "dependencies": { - "System.Runtime": "4.3.0", - "System.Threading.Tasks": "4.3.0" - } - }, - "System.Threading.Tasks": { - "type": "Transitive", - "resolved": "4.3.0", - "contentHash": "LbSxKEdOUhVe8BezB/9uOGGppt+nZf6e1VFyw6v3DN6lqitm0OSn2uXMOdtP0M3W4iMcqcivm2J6UgqiwwnXiA==", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Runtime": "4.3.0" - } - }, - "System.Threading.Tasks.Extensions": { - "type": "Transitive", - "resolved": "4.3.0", - "contentHash": "npvJkVKl5rKXrtl1Kkm6OhOUaYGEiF9wFbppFRWSMoApKzt2PiPHT2Bb8a5sAWxprvdOAtvaARS9QYMznEUtug==", - "dependencies": { - "System.Collections": "4.3.0", - "System.Runtime": "4.3.0", - "System.Threading.Tasks": "4.3.0" - } - }, - "System.Threading.Timer": { - "type": "Transitive", - "resolved": "4.3.0", - "contentHash": "Z6YfyYTCg7lOZjJzBjONJTFKGN9/NIYKSxhU5GRd+DTwHSZyvWp1xuI5aR+dLg+ayyC5Xv57KiY4oJ0tMO89fQ==", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Runtime": "4.3.0" - } - }, - "System.Xml.ReaderWriter": { - "type": "Transitive", - "resolved": "4.3.0", - "contentHash": "GrprA+Z0RUXaR4N7/eW71j1rgMnEnEVlgii49GZyAjTH7uliMnrOU3HNFBr6fEDBCJCIdlVNq9hHbaDR621XBA==", - "dependencies": { - "System.Collections": "4.3.0", - "System.Diagnostics.Debug": "4.3.0", - "System.Globalization": "4.3.0", - "System.IO": "4.3.0", - "System.IO.FileSystem": "4.3.0", - "System.IO.FileSystem.Primitives": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0", - "System.Runtime.InteropServices": "4.3.0", - "System.Text.Encoding": "4.3.0", - "System.Text.Encoding.Extensions": "4.3.0", - "System.Text.RegularExpressions": "4.3.0", - "System.Threading.Tasks": "4.3.0", - "System.Threading.Tasks.Extensions": "4.3.0" - } - }, - "System.Xml.XDocument": { - "type": "Transitive", - "resolved": "4.3.0", - "contentHash": "5zJ0XDxAIg8iy+t4aMnQAu0MqVbqyvfoUVl1yDV61xdo3Vth45oA2FoY4pPkxYAH5f8ixpmTqXeEIya95x0aCQ==", - "dependencies": { - "System.Collections": "4.3.0", - "System.Diagnostics.Debug": "4.3.0", - "System.Diagnostics.Tools": "4.3.0", - "System.Globalization": "4.3.0", - "System.IO": "4.3.0", - "System.Reflection": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0", - "System.Text.Encoding": "4.3.0", - "System.Threading": "4.3.0", - "System.Xml.ReaderWriter": "4.3.0" - } - }, "xunit.abstractions": { "type": "Transitive", "resolved": "2.0.3", @@ -1056,42 +74,37 @@ }, "xunit.analyzers": { "type": "Transitive", - "resolved": "0.10.0", - "contentHash": "4/IDFCJfIeg6bix9apmUtIMwvOsiwqdEexeO/R2D4GReIGPLIRODTpId/l4LRSrAJk9lEO3Zx1H0Zx6uohJDNg==" + "resolved": "1.18.0", + "contentHash": "OtFMHN8yqIcYP9wcVIgJrq01AfTxijjAqVDy/WeQVSyrDC1RzBWeQPztL49DN2syXRah8TYnfvk035s7L95EZQ==" }, "xunit.assert": { "type": "Transitive", - "resolved": "2.4.1", - "contentHash": "O/Oe0BS5RmSsM+LQOb041TzuPo5MdH2Rov+qXGS37X+KFG1Hxz7kopYklM5+1Y+tRGeXrOx5+Xne1RuqLFQoyQ==", - "dependencies": { - "NETStandard.Library": "1.6.1" - } + "resolved": "2.9.3", + "contentHash": "/Kq28fCE7MjOV42YLVRAJzRF0WmEqsmflm0cfpMjGtzQ2lR5mYVj1/i0Y8uDAOLczkL3/jArrwehfMD0YogMAA==" }, "xunit.core": { "type": "Transitive", - "resolved": "2.4.1", - "contentHash": "Zsj5OMU6JasNGERXZy8s72+pcheG6Q15atS5XpZXqAtULuyQiQ6XNnUsp1gyfC6WgqScqMvySiEHmHcOG6Eg0Q==", + "resolved": "2.9.3", + "contentHash": "BiAEvqGvyme19wE0wTKdADH+NloYqikiU0mcnmiNyXaF9HyHmE6sr/3DC5vnBkgsWaE6yPyWszKSPSApWdRVeQ==", "dependencies": { - "xunit.extensibility.core": "[2.4.1]", - "xunit.extensibility.execution": "[2.4.1]" + "xunit.extensibility.core": "[2.9.3]", + "xunit.extensibility.execution": "[2.9.3]" } }, "xunit.extensibility.core": { "type": "Transitive", - "resolved": "2.4.1", - "contentHash": "yKZKm/8QNZnBnGZFD9SewkllHBiK0DThybQD/G4PiAmQjKtEZyHi6ET70QPU9KtSMJGRYS6Syk7EyR2EVDU4Kg==", + "resolved": "2.9.3", + "contentHash": "kf3si0YTn2a8J8eZNb+zFpwfoyvIrQ7ivNk5ZYA5yuYk1bEtMe4DxJ2CF/qsRgmEnDr7MnW1mxylBaHTZ4qErA==", "dependencies": { - "NETStandard.Library": "1.6.1", "xunit.abstractions": "2.0.3" } }, "xunit.extensibility.execution": { "type": "Transitive", - "resolved": "2.4.1", - "contentHash": "7e/1jqBpcb7frLkB6XDrHCGXAbKN4Rtdb88epYxCSRQuZDRW8UtTfdTEVpdTl8s4T56e07hOBVd4G0OdCxIY2A==", + "resolved": "2.9.3", + "contentHash": "yMb6vMESlSrE3Wfj7V6cjQ3S4TXdXpRqYeNEI3zsX31uTsGMJjEw6oD5F5u1cHnMptjhEECnmZSsPxB6ChZHDQ==", "dependencies": { - "NETStandard.Library": "1.6.1", - "xunit.extensibility.core": "[2.4.1]" + "xunit.extensibility.core": "[2.9.3]" } }, "molecules": { diff --git a/Molecules/Element.cs b/Molecules/Element.cs index f1a0928..7d882da 100644 --- a/Molecules/Element.cs +++ b/Molecules/Element.cs @@ -1,157 +1,140 @@ -namespace Molecules +namespace Molecules; + +/// +/// Represents an element. +/// +/// The atomic number of the element, this must be unique within an . +/// The full (English) name of the element. +/// The symbol for the element, this must be unique within an . +/// Atomic mass of an element. +public sealed record Element(int AtomicNumber, string Name, string Symbol, double AtomicMass) { /// - /// Represents an element. + /// Overrides the default implementation. /// - public record Element - { - /// - /// The atomic number of the element, this must be unique within an . - /// - public int AtomicNumber { get; set; } - - /// - /// The full (English) name of the element. - /// - public string Name { get; set; } - - /// - /// The symbol for the element, this must be unique within an . - /// - public string Symbol { get; set; } - - /// - /// Atomic mass of an element. - /// - public double AtomicMass { get; set; } - - /// - /// Overrides the default implementation. - /// - /// The atomic number, name and symbol of the element in the format "AtomicNumber Name (Symbol)". - public override string ToString() => $"{AtomicNumber} {Name} ({Symbol})"; + /// The atomic number, name and symbol of the element in the format "AtomicNumber Name (Symbol)". + public override string ToString() => $"{AtomicNumber} {Name} ({Symbol})"; - #region PeriodicTable - public static Element H { get; } = new Element { AtomicNumber = 1, Name = "Hydrogen", Symbol = "H", AtomicMass = 1.00794 }; - public static Element He { get; } = new Element { AtomicNumber = 2, Name = "Helium", Symbol = "He", AtomicMass = 4.002602 }; - public static Element Li { get; } = new Element { AtomicNumber = 3, Name = "Lithium", Symbol = "Li", AtomicMass = 6.941 }; - public static Element Be { get; } = new Element { AtomicNumber = 4, Name = "Beryllium", Symbol = "Be", AtomicMass = 9.012182 }; - public static Element B { get; } = new Element { AtomicNumber = 5, Name = "Boron", Symbol = "B", AtomicMass = 10.811 }; - public static Element C { get; } = new Element { AtomicNumber = 6, Name = "Carbon", Symbol = "C", AtomicMass = 12.0107 }; - public static Element N { get; } = new Element { AtomicNumber = 7, Name = "Nitrogen", Symbol = "N", AtomicMass = 14.0067 }; - public static Element O { get; } = new Element { AtomicNumber = 8, Name = "Oxygen", Symbol = "O", AtomicMass = 15.9994 }; - public static Element F { get; } = new Element { AtomicNumber = 9, Name = "Fluorine", Symbol = "F", AtomicMass = 18.9984032 }; - public static Element Ne { get; } = new Element { AtomicNumber = 10, Name = "Neon", Symbol = "Ne", AtomicMass = 20.1797 }; - public static Element Na { get; } = new Element { AtomicNumber = 11, Name = "Sodium", Symbol = "Na", AtomicMass = 22.98976928 }; - public static Element Mg { get; } = new Element { AtomicNumber = 12, Name = "Magnesium", Symbol = "Mg", AtomicMass = 24.305 }; - public static Element Al { get; } = new Element { AtomicNumber = 13, Name = "Aluminium", Symbol = "Al", AtomicMass = 26.9815386 }; - public static Element Si { get; } = new Element { AtomicNumber = 14, Name = "Silicon", Symbol = "Si", AtomicMass = 28.0855 }; - public static Element P { get; } = new Element { AtomicNumber = 15, Name = "Phosphorus", Symbol = "P", AtomicMass = 30.973762 }; - public static Element S { get; } = new Element { AtomicNumber = 16, Name = "Sulfur", Symbol = "S", AtomicMass = 32.065 }; - public static Element Cl { get; } = new Element { AtomicNumber = 17, Name = "Chlorine", Symbol = "Cl", AtomicMass = 35.453 }; - public static Element Ar { get; } = new Element { AtomicNumber = 18, Name = "Argon", Symbol = "Ar", AtomicMass = 39.948 }; - public static Element K { get; } = new Element { AtomicNumber = 19, Name = "Potassium", Symbol = "K", AtomicMass = 39.0983 }; - public static Element Ca { get; } = new Element { AtomicNumber = 20, Name = "Calcium", Symbol = "Ca", AtomicMass = 40.078 }; - public static Element Sc { get; } = new Element { AtomicNumber = 21, Name = "Scandium", Symbol = "Sc", AtomicMass = 44.955912 }; - public static Element Ti { get; } = new Element { AtomicNumber = 22, Name = "Titanium", Symbol = "Ti", AtomicMass = 47.867 }; - public static Element V { get; } = new Element { AtomicNumber = 23, Name = "Vanadium", Symbol = "V", AtomicMass = 50.9415 }; - public static Element Cr { get; } = new Element { AtomicNumber = 24, Name = "Chromium", Symbol = "Cr", AtomicMass = 51.9961 }; - public static Element Mn { get; } = new Element { AtomicNumber = 25, Name = "Manganese", Symbol = "Mn", AtomicMass = 54.938045 }; - public static Element Fe { get; } = new Element { AtomicNumber = 26, Name = "Iron", Symbol = "Fe", AtomicMass = 55.845 }; - public static Element Co { get; } = new Element { AtomicNumber = 27, Name = "Cobalt", Symbol = "Co", AtomicMass = 58.933195 }; - public static Element Ni { get; } = new Element { AtomicNumber = 28, Name = "Nickel", Symbol = "Ni", AtomicMass = 58.6934 }; - public static Element Cu { get; } = new Element { AtomicNumber = 29, Name = "Copper", Symbol = "Cu", AtomicMass = 63.546 }; - public static Element Zn { get; } = new Element { AtomicNumber = 30, Name = "Zinc", Symbol = "Zn", AtomicMass = 65.409 }; - public static Element Ga { get; } = new Element { AtomicNumber = 31, Name = "Gallium", Symbol = "Ga", AtomicMass = 69.723 }; - public static Element Ge { get; } = new Element { AtomicNumber = 32, Name = "Germanium", Symbol = "Ge", AtomicMass = 72.64 }; - public static Element As { get; } = new Element { AtomicNumber = 33, Name = "Arsenic", Symbol = "As", AtomicMass = 74.9216 }; - public static Element Se { get; } = new Element { AtomicNumber = 34, Name = "Selenium", Symbol = "Se", AtomicMass = 78.96 }; - public static Element Br { get; } = new Element { AtomicNumber = 35, Name = "Bromine", Symbol = "Br", AtomicMass = 79.904 }; - public static Element Kr { get; } = new Element { AtomicNumber = 36, Name = "Krypton", Symbol = "Kr", AtomicMass = 83.798 }; - public static Element Rb { get; } = new Element { AtomicNumber = 37, Name = "Rubidium", Symbol = "Rb", AtomicMass = 85.4678 }; - public static Element Sr { get; } = new Element { AtomicNumber = 38, Name = "Strontium", Symbol = "Sr", AtomicMass = 87.62 }; - public static Element Y { get; } = new Element { AtomicNumber = 39, Name = "Yttrium", Symbol = "Y", AtomicMass = 88.90585 }; - public static Element Zr { get; } = new Element { AtomicNumber = 40, Name = "Zirconium", Symbol = "Zr", AtomicMass = 91.224 }; - public static Element Nb { get; } = new Element { AtomicNumber = 41, Name = "Niobium", Symbol = "Nb", AtomicMass = 92.90638 }; - public static Element Mo { get; } = new Element { AtomicNumber = 42, Name = "Molybdenum", Symbol = "Mo", AtomicMass = 95.94 }; - public static Element Tc { get; } = new Element { AtomicNumber = 43, Name = "Technetium", Symbol = "Tc", AtomicMass = 98.9063 }; - public static Element Ru { get; } = new Element { AtomicNumber = 44, Name = "Ruthenium", Symbol = "Ru", AtomicMass = 101.07 }; - public static Element Rh { get; } = new Element { AtomicNumber = 45, Name = "Rhodium", Symbol = "Rh", AtomicMass = 102.9055 }; - public static Element Pd { get; } = new Element { AtomicNumber = 46, Name = "Palladium", Symbol = "Pd", AtomicMass = 106.42 }; - public static Element Ag { get; } = new Element { AtomicNumber = 47, Name = "Silver", Symbol = "Ag", AtomicMass = 107.8682 }; - public static Element Cd { get; } = new Element { AtomicNumber = 48, Name = "Cadmium", Symbol = "Cd", AtomicMass = 112.411 }; - public static Element In { get; } = new Element { AtomicNumber = 49, Name = "Indium", Symbol = "In", AtomicMass = 114.818 }; - public static Element Sn { get; } = new Element { AtomicNumber = 50, Name = "Tin", Symbol = "Sn", AtomicMass = 118.71 }; - public static Element Sb { get; } = new Element { AtomicNumber = 51, Name = "Antimony", Symbol = "Sb", AtomicMass = 121.76 }; - public static Element Te { get; } = new Element { AtomicNumber = 52, Name = "Tellurium", Symbol = "Te", AtomicMass = 127.6 }; - public static Element I { get; } = new Element { AtomicNumber = 53, Name = "Iodine", Symbol = "I", AtomicMass = 126.90447 }; - public static Element Xe { get; } = new Element { AtomicNumber = 54, Name = "Xenon", Symbol = "Xe", AtomicMass = 131.293 }; - public static Element Cs { get; } = new Element { AtomicNumber = 55, Name = "Caesium", Symbol = "Cs", AtomicMass = 132.9054519 }; - public static Element Ba { get; } = new Element { AtomicNumber = 56, Name = "Barium", Symbol = "Ba", AtomicMass = 137.327 }; - public static Element La { get; } = new Element { AtomicNumber = 57, Name = "Lanthanum", Symbol = "La", AtomicMass = 138.90547 }; - public static Element Ce { get; } = new Element { AtomicNumber = 58, Name = "Cerium", Symbol = "Ce", AtomicMass = 140.116 }; - public static Element Pr { get; } = new Element { AtomicNumber = 59, Name = "Praseodymium", Symbol = "Pr", AtomicMass = 140.90765 }; - public static Element Nd { get; } = new Element { AtomicNumber = 60, Name = "Neodymium", Symbol = "Nd", AtomicMass = 144.242 }; - public static Element Pm { get; } = new Element { AtomicNumber = 61, Name = "Promethium", Symbol = "Pm", AtomicMass = 146.9151 }; - public static Element Sm { get; } = new Element { AtomicNumber = 62, Name = "Samarium", Symbol = "Sm", AtomicMass = 150.36 }; - public static Element Eu { get; } = new Element { AtomicNumber = 63, Name = "Europium", Symbol = "Eu", AtomicMass = 151.964 }; - public static Element Gd { get; } = new Element { AtomicNumber = 64, Name = "Gadolinium", Symbol = "Gd", AtomicMass = 157.25 }; - public static Element Tb { get; } = new Element { AtomicNumber = 65, Name = "Terbium", Symbol = "Tb", AtomicMass = 158.92535 }; - public static Element Dy { get; } = new Element { AtomicNumber = 66, Name = "Dysprosium", Symbol = "Dy", AtomicMass = 162.5 }; - public static Element Ho { get; } = new Element { AtomicNumber = 67, Name = "Holmium", Symbol = "Ho", AtomicMass = 164.93032 }; - public static Element Er { get; } = new Element { AtomicNumber = 68, Name = "Erbium", Symbol = "Er", AtomicMass = 167.259 }; - public static Element Tm { get; } = new Element { AtomicNumber = 69, Name = "Thulium", Symbol = "Tm", AtomicMass = 168.93421 }; - public static Element Yb { get; } = new Element { AtomicNumber = 70, Name = "Ytterbium", Symbol = "Yb", AtomicMass = 173.04 }; - public static Element Lu { get; } = new Element { AtomicNumber = 71, Name = "Lutetium", Symbol = "Lu", AtomicMass = 174.967 }; - public static Element Hf { get; } = new Element { AtomicNumber = 72, Name = "Hafnium", Symbol = "Hf", AtomicMass = 178.49 }; - public static Element Ta { get; } = new Element { AtomicNumber = 73, Name = "Tantalum", Symbol = "Ta", AtomicMass = 180.9479 }; - public static Element W { get; } = new Element { AtomicNumber = 74, Name = "Tungsten", Symbol = "W", AtomicMass = 183.84 }; - public static Element Re { get; } = new Element { AtomicNumber = 75, Name = "Rhenium", Symbol = "Re", AtomicMass = 186.207 }; - public static Element Os { get; } = new Element { AtomicNumber = 76, Name = "Osmium", Symbol = "Os", AtomicMass = 190.23 }; - public static Element Ir { get; } = new Element { AtomicNumber = 77, Name = "Iridium", Symbol = "Ir", AtomicMass = 192.217 }; - public static Element Pt { get; } = new Element { AtomicNumber = 78, Name = "Platinum", Symbol = "Pt", AtomicMass = 195.084 }; - public static Element Au { get; } = new Element { AtomicNumber = 79, Name = "Gold", Symbol = "Au", AtomicMass = 196.966569 }; - public static Element Hg { get; } = new Element { AtomicNumber = 80, Name = "Mercury", Symbol = "Hg", AtomicMass = 200.59 }; - public static Element Tl { get; } = new Element { AtomicNumber = 81, Name = "Thallium", Symbol = "Tl", AtomicMass = 204.3833 }; - public static Element Pb { get; } = new Element { AtomicNumber = 82, Name = "Lead", Symbol = "Pb", AtomicMass = 207.2 }; - public static Element Bi { get; } = new Element { AtomicNumber = 83, Name = "Bismuth", Symbol = "Bi", AtomicMass = 208.9804 }; - public static Element Po { get; } = new Element { AtomicNumber = 84, Name = "Polonium", Symbol = "Po", AtomicMass = 208.9824 }; - public static Element At { get; } = new Element { AtomicNumber = 85, Name = "Astatine", Symbol = "At", AtomicMass = 209.9871 }; - public static Element Rn { get; } = new Element { AtomicNumber = 86, Name = "Radon", Symbol = "Rn", AtomicMass = 222.0176 }; - public static Element Fr { get; } = new Element { AtomicNumber = 87, Name = "Francium", Symbol = "Fr", AtomicMass = 223.0197 }; - public static Element Ra { get; } = new Element { AtomicNumber = 88, Name = "Radium", Symbol = "Ra", AtomicMass = 226.0254 }; - public static Element Ac { get; } = new Element { AtomicNumber = 89, Name = "Actinium", Symbol = "Ac", AtomicMass = 227.0278 }; - public static Element Th { get; } = new Element { AtomicNumber = 90, Name = "Thorium", Symbol = "Th", AtomicMass = 232.03806 }; - public static Element Pa { get; } = new Element { AtomicNumber = 91, Name = "Protactinium", Symbol = "Pa", AtomicMass = 231.03588 }; - public static Element U { get; } = new Element { AtomicNumber = 92, Name = "Uranium", Symbol = "U", AtomicMass = 238.02891 }; - public static Element Np { get; } = new Element { AtomicNumber = 93, Name = "Neptunium", Symbol = "Np", AtomicMass = 237.0482 }; - public static Element Pu { get; } = new Element { AtomicNumber = 94, Name = "Plutonium", Symbol = "Pu", AtomicMass = 244.0642 }; - public static Element Am { get; } = new Element { AtomicNumber = 95, Name = "Americium", Symbol = "Am", AtomicMass = 243.0614 }; - public static Element Cm { get; } = new Element { AtomicNumber = 96, Name = "Curium", Symbol = "Cm", AtomicMass = 247.0703 }; - public static Element Bk { get; } = new Element { AtomicNumber = 97, Name = "Berkelium", Symbol = "Bk", AtomicMass = 247.0703 }; - public static Element Cf { get; } = new Element { AtomicNumber = 98, Name = "Californium", Symbol = "Cf", AtomicMass = 251.0796 }; - public static Element Es { get; } = new Element { AtomicNumber = 99, Name = "Einsteinium", Symbol = "Es", AtomicMass = 252.0829 }; - public static Element Fm { get; } = new Element { AtomicNumber = 100, Name = "Fermium", Symbol = "Fm", AtomicMass = 257.0951 }; - public static Element Md { get; } = new Element { AtomicNumber = 101, Name = "Mendelevium", Symbol = "Md", AtomicMass = 258.0986 }; - public static Element No { get; } = new Element { AtomicNumber = 102, Name = "Nobelium", Symbol = "No", AtomicMass = 259.1009 }; - public static Element Lr { get; } = new Element { AtomicNumber = 103, Name = "Lawrencium", Symbol = "Lr", AtomicMass = 260.1053 }; - public static Element Rf { get; } = new Element { AtomicNumber = 104, Name = "Rutherfordium", Symbol = "Rf", AtomicMass = 261.1087 }; - public static Element Db { get; } = new Element { AtomicNumber = 105, Name = "Dubnium", Symbol = "Db", AtomicMass = 262.1138 }; - public static Element Sg { get; } = new Element { AtomicNumber = 106, Name = "Seaborgium", Symbol = "Sg", AtomicMass = 263.1182 }; - public static Element Bh { get; } = new Element { AtomicNumber = 107, Name = "Bohrium", Symbol = "Bh", AtomicMass = 262.1229 }; - public static Element Hs { get; } = new Element { AtomicNumber = 108, Name = "Hassium", Symbol = "Hs", AtomicMass = 265 }; - public static Element Mt { get; } = new Element { AtomicNumber = 109, Name = "Meitnerium", Symbol = "Mt", AtomicMass = 266 }; - public static Element Ds { get; } = new Element { AtomicNumber = 110, Name = "Darmstadtium", Symbol = "Ds", AtomicMass = 269 }; - public static Element Rg { get; } = new Element { AtomicNumber = 111, Name = "Roentgenium", Symbol = "Rg", AtomicMass = 272 }; - public static Element Cn { get; } = new Element { AtomicNumber = 112, Name = "Copernicium", Symbol = "Cn", AtomicMass = 285 }; - public static Element Nh { get; } = new Element { AtomicNumber = 113, Name = "Nihonium", Symbol = "Nh", AtomicMass = 286 }; - public static Element Fl { get; } = new Element { AtomicNumber = 114, Name = "Flerovium", Symbol = "Fl", AtomicMass = 289 }; - public static Element Mc { get; } = new Element { AtomicNumber = 115, Name = "Moscovium", Symbol = "Mc", AtomicMass = 290 }; - public static Element Lv { get; } = new Element { AtomicNumber = 116, Name = "Livermorium", Symbol = "Lv", AtomicMass = 293 }; - public static Element Ts { get; } = new Element { AtomicNumber = 117, Name = "Tennessine", Symbol = "Ts", AtomicMass = 294 }; - public static Element Og { get; } = new Element { AtomicNumber = 118, Name = "Oganesson", Symbol = "Og", AtomicMass = 294 }; + #region PeriodicTable + public static Element H { get; } = new Element(1, "Hydrogen", "H", 1.00794); + public static Element He { get; } = new Element(2, "Helium", "He", 4.002602); + public static Element Li { get; } = new Element(3, "Lithium", "Li", 6.941); + public static Element Be { get; } = new Element(4, "Beryllium", "Be", 9.012182); + public static Element B { get; } = new Element(5, "Boron", "B", 10.811); + public static Element C { get; } = new Element(6, "Carbon", "C", 12.0107); + public static Element N { get; } = new Element(7, "Nitrogen", "N", 14.0067); + public static Element O { get; } = new Element(8, "Oxygen", "O", 15.9994); + public static Element F { get; } = new Element(9, "Fluorine", "F", 18.9984032); + public static Element Ne { get; } = new Element(10, "Neon", "Ne", 20.1797); + public static Element Na { get; } = new Element(11, "Sodium", "Na", 22.98976928); + public static Element Mg { get; } = new Element(12, "Magnesium", "Mg", 24.305); + public static Element Al { get; } = new Element(13, "Aluminium", "Al", 26.9815386); + public static Element Si { get; } = new Element(14, "Silicon", "Si", 28.0855); + public static Element P { get; } = new Element(15, "Phosphorus", "P", 30.973762); + public static Element S { get; } = new Element(16, "Sulfur", "S", 32.065); + public static Element Cl { get; } = new Element(17, "Chlorine", "Cl", 35.453); + public static Element Ar { get; } = new Element(18, "Argon", "Ar", 39.948); + public static Element K { get; } = new Element(19, "Potassium", "K", 39.0983); + public static Element Ca { get; } = new Element(20, "Calcium", "Ca", 40.078); + public static Element Sc { get; } = new Element(21, "Scandium", "Sc", 44.955912); + public static Element Ti { get; } = new Element(22, "Titanium", "Ti", 47.867); + public static Element V { get; } = new Element(23, "Vanadium", "V", 50.9415); + public static Element Cr { get; } = new Element(24, "Chromium", "Cr", 51.9961); + public static Element Mn { get; } = new Element(25, "Manganese", "Mn", 54.938045); + public static Element Fe { get; } = new Element(26, "Iron", "Fe", 55.845); + public static Element Co { get; } = new Element(27, "Cobalt", "Co", 58.933195); + public static Element Ni { get; } = new Element(28, "Nickel", "Ni", 58.6934); + public static Element Cu { get; } = new Element(29, "Copper", "Cu", 63.546); + public static Element Zn { get; } = new Element(30, "Zinc", "Zn", 65.409); + public static Element Ga { get; } = new Element(31, "Gallium", "Ga", 69.723); + public static Element Ge { get; } = new Element(32, "Germanium", "Ge", 72.64); + public static Element As { get; } = new Element(33, "Arsenic", "As", 74.9216); + public static Element Se { get; } = new Element(34, "Selenium", "Se", 78.96); + public static Element Br { get; } = new Element(35, "Bromine", "Br", 79.904); + public static Element Kr { get; } = new Element(36, "Krypton", "Kr", 83.798); + public static Element Rb { get; } = new Element(37, "Rubidium", "Rb", 85.4678); + public static Element Sr { get; } = new Element(38, "Strontium", "Sr", 87.62); + public static Element Y { get; } = new Element(39, "Yttrium", "Y", 88.90585); + public static Element Zr { get; } = new Element(40, "Zirconium", "Zr", 91.224); + public static Element Nb { get; } = new Element(41, "Niobium", "Nb", 92.90638); + public static Element Mo { get; } = new Element(42, "Molybdenum", "Mo", 95.94); + public static Element Tc { get; } = new Element(43, "Technetium", "Tc", 98.9063); + public static Element Ru { get; } = new Element(44, "Ruthenium", "Ru", 101.07); + public static Element Rh { get; } = new Element(45, "Rhodium", "Rh", 102.9055); + public static Element Pd { get; } = new Element(46, "Palladium", "Pd", 106.42); + public static Element Ag { get; } = new Element(47, "Silver", "Ag", 107.8682); + public static Element Cd { get; } = new Element(48, "Cadmium", "Cd", 112.411); + public static Element In { get; } = new Element(49, "Indium", "In", 114.818); + public static Element Sn { get; } = new Element(50, "Tin", "Sn", 118.71); + public static Element Sb { get; } = new Element(51, "Antimony", "Sb", 121.76); + public static Element Te { get; } = new Element(52, "Tellurium", "Te", 127.6); + public static Element I { get; } = new Element(53, "Iodine", "I", 126.90447); + public static Element Xe { get; } = new Element(54, "Xenon", "Xe", 131.293); + public static Element Cs { get; } = new Element(55, "Caesium", "Cs", 132.9054519); + public static Element Ba { get; } = new Element(56, "Barium", "Ba", 137.327); + public static Element La { get; } = new Element(57, "Lanthanum", "La", 138.90547); + public static Element Ce { get; } = new Element(58, "Cerium", "Ce", 140.116); + public static Element Pr { get; } = new Element(59, "Praseodymium", "Pr", 140.90765); + public static Element Nd { get; } = new Element(60, "Neodymium", "Nd", 144.242); + public static Element Pm { get; } = new Element(61, "Promethium", "Pm", 146.9151); + public static Element Sm { get; } = new Element(62, "Samarium", "Sm", 150.36); + public static Element Eu { get; } = new Element(63, "Europium", "Eu", 151.964); + public static Element Gd { get; } = new Element(64, "Gadolinium", "Gd", 157.25); + public static Element Tb { get; } = new Element(65, "Terbium", "Tb", 158.92535); + public static Element Dy { get; } = new Element(66, "Dysprosium", "Dy", 162.5); + public static Element Ho { get; } = new Element(67, "Holmium", "Ho", 164.93032); + public static Element Er { get; } = new Element(68, "Erbium", "Er", 167.259); + public static Element Tm { get; } = new Element(69, "Thulium", "Tm", 168.93421); + public static Element Yb { get; } = new Element(70, "Ytterbium", "Yb", 173.04); + public static Element Lu { get; } = new Element(71, "Lutetium", "Lu", 174.967); + public static Element Hf { get; } = new Element(72, "Hafnium", "Hf", 178.49); + public static Element Ta { get; } = new Element(73, "Tantalum", "Ta", 180.9479); + public static Element W { get; } = new Element(74, "Tungsten", "W", 183.84); + public static Element Re { get; } = new Element(75, "Rhenium", "Re", 186.207); + public static Element Os { get; } = new Element(76, "Osmium", "Os", 190.23); + public static Element Ir { get; } = new Element(77, "Iridium", "Ir", 192.217); + public static Element Pt { get; } = new Element(78, "Platinum", "Pt", 195.084); + public static Element Au { get; } = new Element(79, "Gold", "Au", 196.966569); + public static Element Hg { get; } = new Element(80, "Mercury", "Hg", 200.59); + public static Element Tl { get; } = new Element(81, "Thallium", "Tl", 204.3833); + public static Element Pb { get; } = new Element(82, "Lead", "Pb", 207.2); + public static Element Bi { get; } = new Element(83, "Bismuth", "Bi", 208.9804); + public static Element Po { get; } = new Element(84, "Polonium", "Po", 208.9824); + public static Element At { get; } = new Element(85, "Astatine", "At", 209.9871); + public static Element Rn { get; } = new Element(86, "Radon", "Rn", 222.0176); + public static Element Fr { get; } = new Element(87, "Francium", "Fr", 223.0197); + public static Element Ra { get; } = new Element(88, "Radium", "Ra", 226.0254); + public static Element Ac { get; } = new Element(89, "Actinium", "Ac", 227.0278); + public static Element Th { get; } = new Element(90, "Thorium", "Th", 232.03806); + public static Element Pa { get; } = new Element(91, "Protactinium", "Pa", 231.03588); + public static Element U { get; } = new Element(92, "Uranium", "U", 238.02891); + public static Element Np { get; } = new Element(93, "Neptunium", "Np", 237.0482); + public static Element Pu { get; } = new Element(94, "Plutonium", "Pu", 244.0642); + public static Element Am { get; } = new Element(95, "Americium", "Am", 243.0614); + public static Element Cm { get; } = new Element(96, "Curium", "Cm", 247.0703); + public static Element Bk { get; } = new Element(97, "Berkelium", "Bk", 247.0703); + public static Element Cf { get; } = new Element(98, "Californium", "Cf", 251.0796); + public static Element Es { get; } = new Element(99, "Einsteinium", "Es", 252.0829); + public static Element Fm { get; } = new Element(100, "Fermium", "Fm", 257.0951); + public static Element Md { get; } = new Element(101, "Mendelevium", "Md", 258.0986); + public static Element No { get; } = new Element(102, "Nobelium", "No", 259.1009); + public static Element Lr { get; } = new Element(103, "Lawrencium", "Lr", 260.1053); + public static Element Rf { get; } = new Element(104, "Rutherfordium", "Rf", 261.1087); + public static Element Db { get; } = new Element(105, "Dubnium", "Db", 262.1138); + public static Element Sg { get; } = new Element(106, "Seaborgium", "Sg", 263.1182); + public static Element Bh { get; } = new Element(107, "Bohrium", "Bh", 262.1229); + public static Element Hs { get; } = new Element(108, "Hassium", "Hs", 265); + public static Element Mt { get; } = new Element(109, "Meitnerium", "Mt", 266); + public static Element Ds { get; } = new Element(110, "Darmstadtium", "Ds", 269); + public static Element Rg { get; } = new Element(111, "Roentgenium", "Rg", 272); + public static Element Cn { get; } = new Element(112, "Copernicium", "Cn", 285); + public static Element Nh { get; } = new Element(113, "Nihonium", "Nh", 286); + public static Element Fl { get; } = new Element(114, "Flerovium", "Fl", 289); + public static Element Mc { get; } = new Element(115, "Moscovium", "Mc", 290); + public static Element Lv { get; } = new Element(116, "Livermorium", "Lv", 293); + public static Element Ts { get; } = new Element(117, "Tennessine", "Ts", 294); + public static Element Og { get; } = new Element(118, "Oganesson", "Og", 294); - #endregion - } + #endregion } \ No newline at end of file diff --git a/Molecules/ElementCollection.cs b/Molecules/ElementCollection.cs index 301b6c7..5dd6d37 100644 --- a/Molecules/ElementCollection.cs +++ b/Molecules/ElementCollection.cs @@ -3,224 +3,223 @@ using System.Collections.Generic; using System.Linq; -namespace Molecules +namespace Molecules; + +/// +/// Represents a collection of objects. +/// +public sealed record ElementCollection : ICollection { /// - /// Represents a collection of objects. + /// Backing collection. + /// + private readonly ICollection _elements = []; + + /// + /// Used for more performant lookups by atomic number. + /// + private readonly Dictionary _elementsByAtomicNumber = []; + + /// + /// Used for more performant lookups by symbol. + /// + private readonly Dictionary _elementsBySymbol = []; + + /// + /// Retrieves an element from the collection by . + /// + /// Atomic number of element to retrieve. + /// The element in the collection with the corresponding atomic number. + /// Thrown when there is no element in the collection with the corresponding atomic number. + public Element this[int atomicNumber] => _elementsByAtomicNumber[atomicNumber]; + + /// + /// Retrieves an element from the collection by . + /// + /// Symbol of element to retrieve. + /// The element in the collection with the corresponding symbol. + /// Thrown when there is no element in the collection with the corresponding symbol. + public Element this[string symbol] => _elementsBySymbol[symbol]; + + /// + /// Retrieves an element from the collection by . + /// + /// Atomic mass of element to retrieve. + /// The element in the collection with the corresponding atomic mass. + /// Thrown when there is no element in the collection with the corresponding atomic mass. + public Element this[double atomicMass] => _elements.Single(e => e.AtomicMass == atomicMass); + + /// + /// Retrieves an element from the collection by /// - public class ElementCollection : ICollection + /// Name of element to retrieve. + /// The element in the collection with the corresponding atomic name. + /// Thrown when there is no element in the collection with the corresponding name. + public Element GetByName(string name) => _elements.Single(e => e.Name.Equals(name, StringComparison.OrdinalIgnoreCase)); + + #region ICollection Implementation + /// + public int Count => _elements.Count; + + /// + public bool IsReadOnly => _elements.IsReadOnly; + + /// + public void Add(Element item) + { + _elements.Add(item); + _elementsByAtomicNumber.Add(item.AtomicNumber, item); + _elementsBySymbol.Add(item.Symbol, item); + } + + /// + public void Clear() { - /// - /// Backing collection. - /// - private readonly ICollection _elements = new List(); - - /// - /// Used for more performant lookups by atomic number. - /// - private readonly IDictionary _elementsByAtomicNumber = new Dictionary(); - - /// - /// Used for more performant lookups by symbol. - /// - private readonly IDictionary _elementsBySymbol = new Dictionary(); - - /// - /// Retrieves an element from the collection by . - /// - /// Atomic number of element to retrieve. - /// The element in the collection with the corresponding atomic number. - /// Thrown when there is no element in the collection with the corresponding atomic number. - public Element this[int atomicNumber] => _elementsByAtomicNumber[atomicNumber]; - - /// - /// Retrieves an element from the collection by . - /// - /// Symbol of element to retrieve. - /// The element in the collection with the corresponding symbol. - /// Thrown when there is no element in the collection with the corresponding symbol. - public Element this[string symbol] => _elementsBySymbol[symbol]; - - /// - /// Retrieves an element from the collection by . - /// - /// Atomic mass of element to retrieve. - /// The element in the collection with the corresponding atomic mass. - /// Thrown when there is no element in the collection with the corresponding atomic mass. - public Element this[double atomicMass] => _elements.Single(e => e.AtomicMass == atomicMass); - - /// - /// Retrieves an element from the collection by - /// - /// Name of element to retrieve. - /// The element in the collection with the corresponding atomic name. - /// Thrown when there is no element in the collection with the corresponding name. - public Element GetByName(string name) => _elements.Single(e => e.Name.Equals(name, StringComparison.OrdinalIgnoreCase)); - - #region ICollection Implementation - /// - public int Count => _elements.Count; - - /// - public bool IsReadOnly => _elements.IsReadOnly; - - /// - public void Add(Element item) - { - _elements.Add(item); - _elementsByAtomicNumber.Add(item.AtomicNumber, item); - _elementsBySymbol.Add(item.Symbol, item); - } - - /// - public void Clear() - { - _elements.Clear(); - _elementsByAtomicNumber.Clear(); - _elementsBySymbol.Clear(); - } - - /// - public bool Contains(Element item) => _elements.Contains(item); - - /// - public void CopyTo(Element[] array, int arrayIndex) => _elements.CopyTo(array, arrayIndex); - - /// - public bool Remove(Element item) => _elementsByAtomicNumber.Remove(item.AtomicNumber) && _elementsBySymbol.Remove(item.Symbol) && _elements.Remove(item); - - /// - public IEnumerator GetEnumerator() => _elements.GetEnumerator(); - - /// - IEnumerator IEnumerable.GetEnumerator() => ((IEnumerable)_elements).GetEnumerator(); - #endregion - - #region KnownElementCollection - /// - /// A collection containing the 118 known elements. - /// - public static ElementCollection PeriodicTable { get; } = new ElementCollection - { - Element.H, - Element.He, - Element.Li, - Element.Be, - Element.B, - Element.C, - Element.N, - Element.O, - Element.F, - Element.Ne, - Element.Na, - Element.Mg, - Element.Al, - Element.Si, - Element.P, - Element.S, - Element.Cl, - Element.Ar, - Element.K, - Element.Ca, - Element.Sc, - Element.Ti, - Element.V, - Element.Cr, - Element.Mn, - Element.Fe, - Element.Co, - Element.Ni, - Element.Cu, - Element.Zn, - Element.Ga, - Element.Ge, - Element.As, - Element.Se, - Element.Br, - Element.Kr, - Element.Rb, - Element.Sr, - Element.Y, - Element.Zr, - Element.Nb, - Element.Mo, - Element.Tc, - Element.Ru, - Element.Rh, - Element.Pd, - Element.Ag, - Element.Cd, - Element.In, - Element.Sn, - Element.Sb, - Element.Te, - Element.I, - Element.Xe, - Element.Cs, - Element.Ba, - Element.La, - Element.Ce, - Element.Pr, - Element.Nd, - Element.Pm, - Element.Sm, - Element.Eu, - Element.Gd, - Element.Tb, - Element.Dy, - Element.Ho, - Element.Er, - Element.Tm, - Element.Yb, - Element.Lu, - Element.Hf, - Element.Ta, - Element.W, - Element.Re, - Element.Os, - Element.Ir, - Element.Pt, - Element.Au, - Element.Hg, - Element.Tl, - Element.Pb, - Element.Bi, - Element.Po, - Element.At, - Element.Rn, - Element.Fr, - Element.Ra, - Element.Ac, - Element.Th, - Element.Pa, - Element.U, - Element.Np, - Element.Pu, - Element.Am, - Element.Cm, - Element.Bk, - Element.Cf, - Element.Es, - Element.Fm, - Element.Md, - Element.No, - Element.Lr, - Element.Rf, - Element.Db, - Element.Sg, - Element.Bh, - Element.Hs, - Element.Mt, - Element.Ds, - Element.Rg, - Element.Cn, - Element.Nh, - Element.Fl, - Element.Mc, - Element.Lv, - Element.Ts, - Element.Og - }; - #endregion + _elements.Clear(); + _elementsByAtomicNumber.Clear(); + _elementsBySymbol.Clear(); } + + /// + public bool Contains(Element item) => _elements.Contains(item); + + /// + public void CopyTo(Element[] array, int arrayIndex) => _elements.CopyTo(array, arrayIndex); + + /// + public bool Remove(Element item) => _elementsByAtomicNumber.Remove(item.AtomicNumber) && _elementsBySymbol.Remove(item.Symbol) && _elements.Remove(item); + + /// + public IEnumerator GetEnumerator() => _elements.GetEnumerator(); + + /// + IEnumerator IEnumerable.GetEnumerator() => ((IEnumerable)_elements).GetEnumerator(); + #endregion + + #region KnownElementCollection + /// + /// A collection containing the 118 known elements. + /// + public static ElementCollection PeriodicTable { get; } = + [ + Element.H, + Element.He, + Element.Li, + Element.Be, + Element.B, + Element.C, + Element.N, + Element.O, + Element.F, + Element.Ne, + Element.Na, + Element.Mg, + Element.Al, + Element.Si, + Element.P, + Element.S, + Element.Cl, + Element.Ar, + Element.K, + Element.Ca, + Element.Sc, + Element.Ti, + Element.V, + Element.Cr, + Element.Mn, + Element.Fe, + Element.Co, + Element.Ni, + Element.Cu, + Element.Zn, + Element.Ga, + Element.Ge, + Element.As, + Element.Se, + Element.Br, + Element.Kr, + Element.Rb, + Element.Sr, + Element.Y, + Element.Zr, + Element.Nb, + Element.Mo, + Element.Tc, + Element.Ru, + Element.Rh, + Element.Pd, + Element.Ag, + Element.Cd, + Element.In, + Element.Sn, + Element.Sb, + Element.Te, + Element.I, + Element.Xe, + Element.Cs, + Element.Ba, + Element.La, + Element.Ce, + Element.Pr, + Element.Nd, + Element.Pm, + Element.Sm, + Element.Eu, + Element.Gd, + Element.Tb, + Element.Dy, + Element.Ho, + Element.Er, + Element.Tm, + Element.Yb, + Element.Lu, + Element.Hf, + Element.Ta, + Element.W, + Element.Re, + Element.Os, + Element.Ir, + Element.Pt, + Element.Au, + Element.Hg, + Element.Tl, + Element.Pb, + Element.Bi, + Element.Po, + Element.At, + Element.Rn, + Element.Fr, + Element.Ra, + Element.Ac, + Element.Th, + Element.Pa, + Element.U, + Element.Np, + Element.Pu, + Element.Am, + Element.Cm, + Element.Bk, + Element.Cf, + Element.Es, + Element.Fm, + Element.Md, + Element.No, + Element.Lr, + Element.Rf, + Element.Db, + Element.Sg, + Element.Bh, + Element.Hs, + Element.Mt, + Element.Ds, + Element.Rg, + Element.Cn, + Element.Nh, + Element.Fl, + Element.Mc, + Element.Lv, + Element.Ts, + Element.Og + ]; + #endregion } \ No newline at end of file diff --git a/Molecules/Molecule.cs b/Molecules/Molecule.cs index 5434be5..03c53da 100644 --- a/Molecules/Molecule.cs +++ b/Molecules/Molecule.cs @@ -4,266 +4,265 @@ using System.Linq; using System.Text; -namespace Molecules +namespace Molecules; + +/// +/// Represents a molecule. Contains static methods to parse strings into molecule objects. +/// +public sealed record Molecule { /// - /// Represents a molecule. Contains static methods to parse strings into molecule objects. + /// The collection of elements in a molecule and their respective frequencies. /// - public record Molecule - { - /// - /// The collection of elements in a molecule and their respective frequencies. - /// - public IReadOnlyDictionary ElementFrequencies { get; } + public IReadOnlyDictionary ElementFrequencies { get; } - /// - /// The molecular mass of the molecule. - /// - public double Mass { get; } + /// + /// The molecular mass of the molecule. + /// + public double Mass { get; } - /// - /// Chemical Formula for molecule. - /// - public string ChemicalFormula { get; } + /// + /// Chemical Formula for molecule. + /// + public string ChemicalFormula { get; } - /// - /// Name of the molecule. - /// - public string Name { get; set; } + /// + /// Name of the molecule. + /// + public string Name { get; set; } - /// - /// Constructs a new Molecule with the specified formula and dictionary of element frequencies. - /// - /// Dictionary of element symbols/frequencies. - private Molecule(string formula, IDictionary elementFrequencies) - { - ChemicalFormula = formula; - ElementFrequencies = new ReadOnlyDictionary(elementFrequencies); - Mass = ElementFrequencies.Values.Sum(x => x.Frequency * x.Element.AtomicMass); - } + /// + /// Constructs a new Molecule with the specified formula and dictionary of element frequencies. + /// + /// Dictionary of element symbols/frequencies. + private Molecule(string formula, IDictionary elementFrequencies) + { + ChemicalFormula = formula; + ElementFrequencies = new ReadOnlyDictionary(elementFrequencies); + Mass = ElementFrequencies.Values.Sum(x => x.Frequency * x.Element.AtomicMass); + } - /// - /// Overrides the default implementation. - /// - /// The chemical formula of the molecule. - public override string ToString() => ChemicalFormula; + /// + /// Overrides the default implementation. + /// + /// The chemical formula of the molecule. + public override string ToString() => ChemicalFormula; - #region Parse - /// - /// Parses a string representation of a chemical formula into a Molecule Object using as a reference. - /// - /// Formula to parse. - /// A molecule parsed from the formula. - /// Thrown when formula is null. - /// Thrown when formula is empty or all whitespace - /// Thrown when formula: - /// * Contains nested or unmatched parentheses. - /// * Contains a non letter/digit character that is not a ( or ) - /// * Contains a "component" (a section of the string, either inside or outside parentheses) which starts with a lowercase - /// - public static Molecule Parse(string formula) => Parse(formula, ElementCollection.PeriodicTable); + #region Parse + /// + /// Parses a string representation of a chemical formula into a Molecule Object using as a reference. + /// + /// Formula to parse. + /// A molecule parsed from the formula. + /// Thrown when formula is null. + /// Thrown when formula is empty or all whitespace + /// Thrown when formula: + /// * Contains nested or unmatched parentheses. + /// * Contains a non letter/digit character that is not a ( or ) + /// * Contains a "component" (a section of the string, either inside or outside parentheses) which starts with a lowercase + /// + public static Molecule Parse(string formula) => Parse(formula, ElementCollection.PeriodicTable); - /// - /// Parses a string representation of a chemical formula into a Molecule Object using the provided elementCollection as a reference. - /// - /// Formula to parse. - /// Element collection to use. - /// A molecule parsed from the formula. - /// Thrown when formula is null. - /// Thrown when formula is empty or all whitespace - /// Thrown when formula: - /// * Contains nested or unmatched parentheses. - /// * Contains a non letter/digit character that is not a ( or ) - /// * Contains a "component" (a section of the string, either inside or outside parentheses) which starts with a lowercase - /// - public static Molecule Parse(string formula, ElementCollection elementCollection) + /// + /// Parses a string representation of a chemical formula into a Molecule Object using the provided elementCollection as a reference. + /// + /// Formula to parse. + /// Element collection to use. + /// A molecule parsed from the formula. + /// Thrown when formula is null. + /// Thrown when formula is empty or all whitespace + /// Thrown when formula: + /// * Contains nested or unmatched parentheses. + /// * Contains a non letter/digit character that is not a ( or ) + /// * Contains a "component" (a section of the string, either inside or outside parentheses) which starts with a lowercase + /// + public static Molecule Parse(string formula, ElementCollection elementCollection) + { + if (formula is null) { - if (formula is null) - { - throw new ArgumentNullException(nameof(formula), "Formula should not be null!"); - } - else if (string.IsNullOrWhiteSpace(formula)) - { - throw new ArgumentException("Formula should not be empty or all whitespace!"); - } + throw new ArgumentNullException(nameof(formula), "Formula should not be null!"); + } + else if (string.IsNullOrWhiteSpace(formula)) + { + throw new ArgumentException("Formula should not be empty or all whitespace!"); + } - var elementFrequencies = new Dictionary(); - foreach ((string component, int multiplier) in GetComponents(formula)) + var elementFrequencies = new Dictionary(); + foreach ((string component, int multiplier) in GetComponents(formula)) + { + foreach ((string symbol, int frequency) in ParseComponent(component)) { - foreach ((string symbol, int frequency) in ParseComponent(component)) + if (elementFrequencies.TryGetValue(symbol, out var elementFrequency)) { - if (elementFrequencies.TryGetValue(symbol, out var elementFrequency)) - { - elementFrequency.Frequency += multiplier * frequency; - } - else + elementFrequency.Frequency += multiplier * frequency; + } + else + { + elementFrequencies.Add(symbol, new ElementFrequency { - elementFrequencies.Add(symbol, new ElementFrequency - { - Element = elementCollection[symbol], - Frequency = multiplier * frequency - }); - } + Element = elementCollection[symbol], + Frequency = multiplier * frequency + }); } } - - return new Molecule(formula, elementFrequencies); } - /// - /// Parses a string representation of a chemical formula into a Molecule Object using the as a reference. - /// - /// Formula to parse. - /// The output molecule, will be null if false returned. - /// True if parse completed successfully, otherwise false.. - public static bool TryParse(string formula, out Molecule molecule) => TryParse(formula, ElementCollection.PeriodicTable, out molecule); + return new Molecule(formula, elementFrequencies); + } - /// - /// Parses a string representation of a chemical formula into a Molecule Object using the provided elementCollection as a reference. - /// - /// Formula to parse. - /// The output molecule, will be null if false is returned. - /// True if parse completed successfully, otherwise false. - public static bool TryParse(string formula, ElementCollection elementCollection, out Molecule molecule) + /// + /// Parses a string representation of a chemical formula into a Molecule Object using the as a reference. + /// + /// Formula to parse. + /// The output molecule, will be null if false returned. + /// True if parse completed successfully, otherwise false.. + public static bool TryParse(string formula, out Molecule molecule) => TryParse(formula, ElementCollection.PeriodicTable, out molecule); + + /// + /// Parses a string representation of a chemical formula into a Molecule Object using the provided elementCollection as a reference. + /// + /// Formula to parse. + /// The output molecule, will be null if false is returned. + /// True if parse completed successfully, otherwise false. + public static bool TryParse(string formula, ElementCollection elementCollection, out Molecule molecule) + { + try { - try - { - molecule = Parse(formula, elementCollection); - return true; - } - catch - { - molecule = null; - return false; - } + molecule = Parse(formula, elementCollection); + return true; + } + catch + { + molecule = null; + return false; } - #endregion + } + #endregion - #region Private Helpers - private static IEnumerable<(string Component, int Multiplier)> GetComponents(string formula) + #region Private Helpers + private static IEnumerable<(string Component, int Multiplier)> GetComponents(string formula) + { + var componentBuilder = new StringBuilder(); + var inParentheses = false; + for (int i = 0; i < formula.Length; i++) { - var componentBuilder = new StringBuilder(); - var inParentheses = false; - for (int i = 0; i < formula.Length; i++) - { - var character = formula[i]; + var character = formula[i]; - if (char.IsLetterOrDigit(character)) + if (char.IsLetterOrDigit(character)) + { + componentBuilder.Append(character); // Append character. + } + else if (character is '(') + { + if (inParentheses) // Do not support nested parentheses. { - componentBuilder.Append(character); // Append character. + throw new FormatException($"Formula: {formula} contains an unexpected opening bracket at position {i + 1}! Nested parentheses are not supported."); } - else if (character == '(') + else { - if (inParentheses) // Do not support nested parentheses. - { - throw new FormatException($"Formula: {formula} contains an unexpected opening bracket at position {i + 1}! Nested parentheses are not supported."); - } - else + inParentheses = true; + if (componentBuilder.Length > 0) { - inParentheses = true; - if (componentBuilder.Length > 0) - { - yield return (componentBuilder.ToString(), 1); - } - componentBuilder = new StringBuilder(); + yield return (componentBuilder.ToString(), 1); } + componentBuilder = new StringBuilder(); } - else if (character == ')') + } + else if (character is ')') + { + if (!inParentheses) { - if (!inParentheses) - { - throw new FormatException($"Formula: {formula} contains an unexpected closing bracket at position {i + 1}!"); - } - else - { - inParentheses = false; - i = i < formula.Length - 1 ? i + 1 : i; // Skip brace before handling multiplier if relevant. - yield return (componentBuilder.ToString(), GetMultiplier(formula, ref i)); - componentBuilder = new StringBuilder(); - } + throw new FormatException($"Formula: {formula} contains an unexpected closing bracket at position {i + 1}!"); } - else // Chemical formula should not contain non letter/digit except parentheses. + else { - throw new FormatException($"Formula: {formula} contains an invalid character at position {i + 1}!"); + inParentheses = false; + i = i < formula.Length - 1 ? i + 1 : i; // Skip brace before handling multiplier if relevant. + yield return (componentBuilder.ToString(), GetMultiplier(formula, ref i)); + componentBuilder = new StringBuilder(); } } - - if (componentBuilder.Length > 0) + else // Chemical formula should not contain non letter/digit except parentheses. { - yield return (componentBuilder.ToString(), 1); + throw new FormatException($"Formula: {formula} contains an invalid character at position {i + 1}!"); } } - private static IEnumerable<(string Symbol, int Frequency)> ParseComponent(string component) + if (componentBuilder.Length > 0) + { + yield return (componentBuilder.ToString(), 1); + } + } + + private static IEnumerable<(string Symbol, int Frequency)> ParseComponent(string component) + { + var elementBuilder = new StringBuilder(); + for (int i = 0; i < component.Length; i++) { - var elementBuilder = new StringBuilder(); - for (int i = 0; i < component.Length; i++) + var character = component[i]; + if (i == 0) { - var character = component[i]; - if (i == 0) + if (!char.IsLetter(character) || !char.IsUpper(character)) { - if (!char.IsLetter(character) || !char.IsUpper(character)) - { - throw new FormatException($"Component: {component} must start with an uppercase letter!"); - } - else - { - elementBuilder.Append(character); - } + throw new FormatException($"Component: {component} must start with an uppercase letter!"); } else { - if (char.IsUpper(character)) // Start of new element. - { - if (elementBuilder.Length > 0) - { - yield return (elementBuilder.ToString(), 1); - } - elementBuilder = new StringBuilder(character.ToString()); - } - else if (char.IsDigit(character)) // End current element - need to extract multiplier for element. - { - yield return (elementBuilder.ToString(), GetMultiplier(component, ref i)); - elementBuilder = new StringBuilder(); - } - else // Lowercase letter. + elementBuilder.Append(character); + } + } + else + { + if (char.IsUpper(character)) // Start of new element. + { + if (elementBuilder.Length > 0) { - elementBuilder.Append(character); + yield return (elementBuilder.ToString(), 1); } + elementBuilder = new StringBuilder(character.ToString()); + } + else if (char.IsDigit(character)) // End current element - need to extract multiplier for element. + { + yield return (elementBuilder.ToString(), GetMultiplier(component, ref i)); + elementBuilder = new StringBuilder(); + } + else // Lowercase letter. + { + elementBuilder.Append(character); } } + } - if (elementBuilder.Length > 0) - { - yield return (elementBuilder.ToString(), 1); - } + if (elementBuilder.Length > 0) + { + yield return (elementBuilder.ToString(), 1); } + } - private static int GetMultiplier(string containingString, ref int index) + private static int GetMultiplier(string containingString, ref int index) + { + var firstChar = containingString[index]; + if (char.IsDigit(firstChar)) // Expected end digit is { - var firstChar = containingString[index]; - if (char.IsDigit(firstChar)) // Expected end digit is + var multiplierBuilder = new StringBuilder(firstChar.ToString()); + while (index++ < containingString.Length - 1) { - var multiplierBuilder = new StringBuilder(firstChar.ToString()); - while (index++ < containingString.Length - 1) + var next = containingString[index]; + if (char.IsDigit(next)) { - var next = containingString[index]; - if (char.IsDigit(next)) - { - multiplierBuilder.Append(next); - } - else - { - break; - } + multiplierBuilder.Append(next); + } + else + { + break; } - index--; // One off deduction, as we have increased i by one more than the number of characters that are digits. - - return int.Parse(multiplierBuilder.ToString()); } + index--; // One off deduction, as we have increased i by one more than the number of characters that are digits. - return 1; + return int.Parse(multiplierBuilder.ToString()); } - #endregion + + return 1; } + #endregion } \ No newline at end of file diff --git a/Molecules/Molecules.csproj b/Molecules/Molecules.csproj index 874b1f1..acd305d 100644 --- a/Molecules/Molecules.csproj +++ b/Molecules/Molecules.csproj @@ -1,7 +1,7 @@ - netstandard2.0;netstandard2.1;net5.0;net6.0; + net8.0;net9.0 latest true true @@ -11,10 +11,8 @@ Justin Wilkinson 2020 LICENSE https://github.com/JustinWilkinson/Molecules - 3.0.0.0 - 3.0.0.0 Add additional target - 4.0.0 + 5.0.0 diff --git a/Molecules/packages.lock.json b/Molecules/packages.lock.json index 21b4c39..ef181b7 100644 --- a/Molecules/packages.lock.json +++ b/Molecules/packages.lock.json @@ -1,24 +1,7 @@ { "version": 1, "dependencies": { - ".NETStandard,Version=v2.0": { - "NETStandard.Library": { - "type": "Direct", - "requested": "[2.0.3, )", - "resolved": "2.0.3", - "contentHash": "st47PosZSHrjECdjeIzZQbzivYBJFv6P2nv4cj2ypdI204DO+vZ7l5raGMiX4eXMJ53RfOIg+/s4DHVZ54Nu2A==", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0" - } - }, - "Microsoft.NETCore.Platforms": { - "type": "Transitive", - "resolved": "1.1.0", - "contentHash": "kz0PEW2lhqygehI/d6XsPCQzD7ff7gUJaVGPVETX611eadGsA3A877GdSlU0LRVMCTH/+P3o2iDTak+S08V2+A==" - } - }, - ".NETStandard,Version=v2.1": {}, - ".NETCoreApp,Version=v5.0": {}, - "net6.0": {} + "net8.0": {}, + "net9.0": {} } } \ No newline at end of file