├── .github └── workflows │ ├── metrics.yml │ ├── nuget.yml │ └── test.yml ├── .gitignore ├── Expressions.Tests ├── Boolean │ ├── EqualityOperators │ │ └── EqualityOperator_Tests.cs │ ├── LogicalOperators │ │ └── LogicalOperator_Tests.cs │ └── RelationalOperators │ │ └── RelationalOperator_Tests.cs ├── ExpressionFactory_Tests.cs ├── Expressions.Tests.csproj ├── GenericExpressions │ └── GenericExpression_Tests.cs ├── IContext.cs ├── IType.cs ├── Integer │ └── Integer_Tests.cs ├── Logo.ico └── packages.lock.json ├── Expressions.sln ├── Expressions ├── Bool │ ├── BinaryBoolComparison.cs │ ├── ConstantBool.cs │ ├── EqualityOperators │ │ ├── EqualTo.cs │ │ ├── Extensions │ │ │ └── EqualityOperatorExtensions.cs │ │ └── NotEqualTo.cs │ ├── LogicalOperators │ │ ├── All.cs │ │ ├── And.cs │ │ ├── Any.cs │ │ ├── Extensions │ │ │ └── LogicalOperatorExtensions.cs │ │ ├── Not.cs │ │ ├── Or.cs │ │ └── XOr.cs │ ├── NaryBoolExpression.cs │ └── RelationalOperators │ │ ├── Extensions │ │ └── RelationalOperatorExtensions.cs │ │ ├── GreaterThan.cs │ │ ├── GreaterThanOrEqualTo.cs │ │ ├── LessThan.cs │ │ └── LessThanOrEqualTo.cs ├── Color │ └── ConstantColor.cs ├── Decimal │ ├── ConstantDecimal.cs │ └── DecimalArithmeticOperators │ │ ├── AddDecimal.cs │ │ ├── DecimalAritmeticOperatorExtensions.cs │ │ ├── MultiplyDecimal.cs │ │ └── SubtractDecimal.cs ├── Double │ ├── ConstantDouble.cs │ └── DoubleArithmeticOperators │ │ ├── AddDouble.cs │ │ ├── DoubleAritmeticOperatorExtensions.cs │ │ ├── MultiplyDouble.cs │ │ └── SubtractDouble.cs ├── ExpressionFactory.cs ├── Expressions.csproj ├── Float │ ├── ConstantFloat.cs │ └── FloatArithmeticOperators │ │ ├── AddFloat.cs │ │ ├── FloatAritmeticOperatorExtensions.cs │ │ ├── MultiplyFloat.cs │ │ └── SubtractFloat.cs ├── GenericArithmeticOperators │ ├── Add.cs │ ├── Extensions │ │ └── GenericAritmeticOperatorExtensions.cs │ ├── Multiply.cs │ └── Subtract.cs ├── GenericExpressions │ ├── BinaryExpression.cs │ ├── ConditionalExpression.cs │ ├── ConstantExpression.cs │ ├── TerminalExpression.cs │ ├── TernaryExpression.cs │ └── UnaryExpression.cs ├── Guid │ └── ConstantGuid.cs ├── IExpression.cs ├── Integer │ ├── ConstantInteger.cs │ └── IntegerArithmeticOperators │ │ ├── AddInteger.cs │ │ ├── IntegerAritmeticOperatorExtensions.cs │ │ ├── MultiplyInteger.cs │ │ └── SubtractInteger.cs ├── List │ ├── BinaryListExpression.cs │ ├── ConditionalListExpression.cs │ ├── ConstantList.cs │ ├── IListExpression.cs │ ├── IntegerListOperators │ │ ├── Count.cs │ │ └── Extensions │ │ │ └── IntegerListOperatorExtensions.cs │ ├── ListOperators │ │ ├── Append.cs │ │ ├── ConcatList.cs │ │ ├── Extensions │ │ │ └── ListOperatorExtensions.cs │ │ ├── First.cs │ │ ├── GetValue.cs │ │ ├── Last.cs │ │ ├── TakeFirst.cs │ │ └── TakeLast.cs │ ├── TerminalListExpression.cs │ ├── TernaryListExpression.cs │ ├── UnaryListExpression.cs │ ├── UnaryListIntegerExpression.cs │ └── UnaryListItemExpression.cs ├── Logo.ico ├── String │ ├── ConstantString.cs │ └── StringOperators │ │ ├── ConcatString.cs │ │ └── StringOperatorExtensions.cs ├── Utilities │ └── EnumerableExtensions.cs └── Visitor │ ├── ExpressionVisitor.cs │ └── IExpressionVisitor.cs ├── LICENSE ├── README.md └── Resources ├── Banner.afdesign ├── Banner.jpg ├── Banner.png ├── Logo.afdesign ├── Logo.ico ├── Logo128.png └── Logo256.png /.github/workflows/metrics.yml: -------------------------------------------------------------------------------- 1 | name: 'code metrics' 2 | 3 | on: 4 | push: 5 | branches: [ main ] 6 | paths: 7 | - '!./CODE_METRICS.md' # ignore this file 8 | 9 | workflow_dispatch: 10 | inputs: 11 | reason: 12 | description: 'The reason for running the workflow' 13 | required: true 14 | default: 'Manual run' 15 | 16 | jobs: 17 | build: 18 | 19 | runs-on: ubuntu-latest 20 | 21 | steps: 22 | - uses: actions/checkout@v2 23 | 24 | - name: 'Print manual run reason' 25 | if: ${{ github.event_name == 'workflow_dispatch' }} 26 | run: | 27 | echo 'Reason: ${{ github.event.inputs.reason }}' 28 | - name: .NET code metrics 29 | id: dotnet-code-metrics 30 | uses: dotnet/samples/github-actions/DotNet.GitHubAction@main 31 | env: 32 | GREETINGS: 'Hello, .NET developers!' # ${{ secrets.GITHUB_TOKEN }} 33 | with: 34 | owner: ${{ github.repository_owner }} 35 | name: ${{ github.repository }} 36 | branch: ${{ github.ref }} 37 | dir: ${{ './' }} 38 | 39 | - name: Create pull request 40 | uses: peter-evans/create-pull-request@v3.4.1 41 | if: ${{ steps.dotnet-code-metrics.outputs.updated-metrics }} == 'true' 42 | with: 43 | title: '${{ steps.dotnet-code-metrics.outputs.summary-title }}' 44 | body: '${{ steps.dotnet-code-metrics.outputs.summary-details }}' 45 | commit-message: '.NET code metrics, automated pull request.' 46 | -------------------------------------------------------------------------------- /.github/workflows/nuget.yml: -------------------------------------------------------------------------------- 1 | name: nuget 2 | env: 3 | dotnet_version: 6.0.x 4 | on: 5 | push: 6 | branches: 7 | - main 8 | pull_request: 9 | types: [closed] 10 | branches: 11 | - main 12 | 13 | jobs: 14 | build: 15 | runs-on: ubuntu-18.04 16 | name: Update NuGet package 17 | steps: 18 | - uses: actions/checkout@v2 19 | - name: Setup .NET 20 | uses: actions/setup-dotnet@v1 21 | with: 22 | dotnet-version: ${{ env.dotnet_version }} 23 | - name: Restore 24 | run: dotnet restore 25 | - name: Build 26 | run: dotnet build -c Release --no-restore 27 | - name: Pack 28 | run: dotnet pack -c Release -o out 29 | - name: Push 30 | run: dotnet nuget push ./out/*.nupkg --source https://api.nuget.org/v3/index.json --api-key ${{secrets.NUGET_TOKEN}} --skip-duplicate --no-symbols true 31 | -------------------------------------------------------------------------------- /.github/workflows/test.yml: -------------------------------------------------------------------------------- 1 | # The name of the workflow. 2 | # This is the name that's displayed for status 3 | # badges (commonly embedded in README.md files). 4 | name: tests 5 | 6 | # Trigger this workflow on a push, or pull request to 7 | # the production branch, when either C# or project files changed 8 | on: 9 | push: 10 | pull_request: 11 | branches: [ main ] 12 | paths-ignore: 13 | - 'README.md' 14 | 15 | # Create an environment variable named DOTNET_VERSION 16 | # and set it as "6.0.x" 17 | env: 18 | DOTNET_VERSION: '6.0.x' # The .NET SDK version to use 19 | 20 | # Defines a single job named "build-and-test" 21 | jobs: 22 | build-and-test: 23 | 24 | # When the workflow runs, this is the name that is logged 25 | # This job will run three times, once for each "os" defined 26 | name: build-and-test-${{matrix.os}} 27 | runs-on: ${{ matrix.os }} 28 | strategy: 29 | matrix: 30 | os: [ubuntu-latest, windows-latest, macOS-latest] 31 | 32 | # Each job run contains these five steps 33 | steps: 34 | 35 | # 1) Check out the source code so that the workflow can access it. 36 | - uses: actions/checkout@v2 37 | 38 | # 2) Set up the .NET CLI environment for the workflow to use. 39 | # The .NET version is specified by the environment variable. 40 | - name: Setup .NET 41 | uses: actions/setup-dotnet@v1 42 | with: 43 | dotnet-version: ${{ env.DOTNET_VERSION }} 44 | 45 | # 3) Restore the dependencies and tools of a project or solution. 46 | - name: Install dependencies 47 | run: dotnet restore 48 | 49 | # 4) Build a project or solution and all of its dependencies. 50 | - name: Build 51 | run: dotnet build --configuration Release --no-restore 52 | 53 | # 5) Test a project or solution. 54 | - name: Test 55 | run: dotnet test --no-restore --verbosity normal 56 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, and 2 | ## files generated by popular Visual Studio add-ons. 3 | ## 4 | ## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore 5 | 6 | # User-specific files 7 | *.rsuser 8 | *.suo 9 | *.user 10 | *.userosscache 11 | *.sln.docstates 12 | 13 | # User-specific files (MonoDevelop/Xamarin Studio) 14 | *.userprefs 15 | 16 | # Mono auto generated files 17 | mono_crash.* 18 | 19 | # Build results 20 | [Dd]ebug/ 21 | [Dd]ebugPublic/ 22 | [Rr]elease/ 23 | [Rr]eleases/ 24 | x64/ 25 | x86/ 26 | [Aa][Rr][Mm]/ 27 | [Aa][Rr][Mm]64/ 28 | bld/ 29 | [Bb]in/ 30 | [Oo]bj/ 31 | [Ll]og/ 32 | [Ll]ogs/ 33 | 34 | # Visual Studio 2015/2017 cache/options directory 35 | .vs/ 36 | # Uncomment if you have tasks that create the project's static files in wwwroot 37 | #wwwroot/ 38 | 39 | # Visual Studio 2017 auto generated files 40 | Generated\ Files/ 41 | 42 | # MSTest test Results 43 | [Tt]est[Rr]esult*/ 44 | [Bb]uild[Ll]og.* 45 | 46 | # NUnit 47 | *.VisualState.xml 48 | TestResult.xml 49 | nunit-*.xml 50 | 51 | # Build Results of an ATL Project 52 | [Dd]ebugPS/ 53 | [Rr]eleasePS/ 54 | dlldata.c 55 | 56 | # Benchmark Results 57 | BenchmarkDotNet.Artifacts/ 58 | 59 | # .NET Core 60 | project.lock.json 61 | project.fragment.lock.json 62 | artifacts/ 63 | 64 | # StyleCop 65 | StyleCopReport.xml 66 | 67 | # Files built by Visual Studio 68 | *_i.c 69 | *_p.c 70 | *_h.h 71 | *.ilk 72 | *.meta 73 | *.obj 74 | *.iobj 75 | *.pch 76 | *.pdb 77 | *.ipdb 78 | *.pgc 79 | *.pgd 80 | *.rsp 81 | *.sbr 82 | *.tlb 83 | *.tli 84 | *.tlh 85 | *.tmp 86 | *.tmp_proj 87 | *_wpftmp.csproj 88 | *.log 89 | *.vspscc 90 | *.vssscc 91 | .builds 92 | *.pidb 93 | *.svclog 94 | *.scc 95 | 96 | # Chutzpah Test files 97 | _Chutzpah* 98 | 99 | # Visual C++ cache files 100 | ipch/ 101 | *.aps 102 | *.ncb 103 | *.opendb 104 | *.opensdf 105 | *.sdf 106 | *.cachefile 107 | *.VC.db 108 | *.VC.VC.opendb 109 | 110 | # Visual Studio profiler 111 | *.psess 112 | *.vsp 113 | *.vspx 114 | *.sap 115 | 116 | # Visual Studio Trace Files 117 | *.e2e 118 | 119 | # TFS 2012 Local Workspace 120 | $tf/ 121 | 122 | # Guidance Automation Toolkit 123 | *.gpState 124 | 125 | # ReSharper is a .NET coding add-in 126 | _ReSharper*/ 127 | *.[Rr]e[Ss]harper 128 | *.DotSettings.user 129 | 130 | # TeamCity is a build add-in 131 | _TeamCity* 132 | 133 | # DotCover is a Code Coverage Tool 134 | *.dotCover 135 | 136 | # AxoCover is a Code Coverage Tool 137 | .axoCover/* 138 | !.axoCover/settings.json 139 | 140 | # Visual Studio code coverage results 141 | *.coverage 142 | *.coveragexml 143 | 144 | # NCrunch 145 | _NCrunch_* 146 | .*crunch*.local.xml 147 | nCrunchTemp_* 148 | 149 | # MightyMoose 150 | *.mm.* 151 | AutoTest.Net/ 152 | 153 | # Web workbench (sass) 154 | .sass-cache/ 155 | 156 | # Installshield output folder 157 | [Ee]xpress/ 158 | 159 | # DocProject is a documentation generator add-in 160 | DocProject/buildhelp/ 161 | DocProject/Help/*.HxT 162 | DocProject/Help/*.HxC 163 | DocProject/Help/*.hhc 164 | DocProject/Help/*.hhk 165 | DocProject/Help/*.hhp 166 | DocProject/Help/Html2 167 | DocProject/Help/html 168 | 169 | # Click-Once directory 170 | publish/ 171 | 172 | # Publish Web Output 173 | *.[Pp]ublish.xml 174 | *.azurePubxml 175 | # Note: Comment the next line if you want to checkin your web deploy settings, 176 | # but database connection strings (with potential passwords) will be unencrypted 177 | *.pubxml 178 | *.publishproj 179 | 180 | # Microsoft Azure Web App publish settings. Comment the next line if you want to 181 | # checkin your Azure Web App publish settings, but sensitive information contained 182 | # in these scripts will be unencrypted 183 | PublishScripts/ 184 | 185 | # NuGet Packages 186 | *.nupkg 187 | # NuGet Symbol Packages 188 | *.snupkg 189 | # The packages folder can be ignored because of Package Restore 190 | **/[Pp]ackages/* 191 | # except build/, which is used as an MSBuild target. 192 | !**/[Pp]ackages/build/ 193 | # Uncomment if necessary however generally it will be regenerated when needed 194 | #!**/[Pp]ackages/repositories.config 195 | # NuGet v3's project.json files produces more ignorable files 196 | *.nuget.props 197 | *.nuget.targets 198 | 199 | # Microsoft Azure Build Output 200 | csx/ 201 | *.build.csdef 202 | 203 | # Microsoft Azure Emulator 204 | ecf/ 205 | rcf/ 206 | 207 | # Windows Store app package directories and files 208 | AppPackages/ 209 | BundleArtifacts/ 210 | Package.StoreAssociation.xml 211 | _pkginfo.txt 212 | *.appx 213 | *.appxbundle 214 | *.appxupload 215 | 216 | # Visual Studio cache files 217 | # files ending in .cache can be ignored 218 | *.[Cc]ache 219 | # but keep track of directories ending in .cache 220 | !?*.[Cc]ache/ 221 | 222 | # Others 223 | ClientBin/ 224 | ~$* 225 | *~ 226 | *.dbmdl 227 | *.dbproj.schemaview 228 | *.jfm 229 | *.pfx 230 | *.publishsettings 231 | orleans.codegen.cs 232 | 233 | # Including strong name files can present a security risk 234 | # (https://github.com/github/gitignore/pull/2483#issue-259490424) 235 | #*.snk 236 | 237 | # Since there are multiple workflows, uncomment next line to ignore bower_components 238 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) 239 | #bower_components/ 240 | 241 | # RIA/Silverlight projects 242 | Generated_Code/ 243 | 244 | # Backup & report files from converting an old project file 245 | # to a newer Visual Studio version. Backup files are not needed, 246 | # because we have git ;-) 247 | _UpgradeReport_Files/ 248 | Backup*/ 249 | UpgradeLog*.XML 250 | UpgradeLog*.htm 251 | ServiceFabricBackup/ 252 | *.rptproj.bak 253 | 254 | # SQL Server files 255 | *.mdf 256 | *.ldf 257 | *.ndf 258 | 259 | # Business Intelligence projects 260 | *.rdl.data 261 | *.bim.layout 262 | *.bim_*.settings 263 | *.rptproj.rsuser 264 | *- [Bb]ackup.rdl 265 | *- [Bb]ackup ([0-9]).rdl 266 | *- [Bb]ackup ([0-9][0-9]).rdl 267 | 268 | # Microsoft Fakes 269 | FakesAssemblies/ 270 | 271 | # GhostDoc plugin setting file 272 | *.GhostDoc.xml 273 | 274 | # Node.js Tools for Visual Studio 275 | .ntvs_analysis.dat 276 | node_modules/ 277 | 278 | # Visual Studio 6 build log 279 | *.plg 280 | 281 | # Visual Studio 6 workspace options file 282 | *.opt 283 | 284 | # Visual Studio 6 auto-generated workspace file (contains which files were open etc.) 285 | *.vbw 286 | 287 | # Visual Studio LightSwitch build output 288 | **/*.HTMLClient/GeneratedArtifacts 289 | **/*.DesktopClient/GeneratedArtifacts 290 | **/*.DesktopClient/ModelManifest.xml 291 | **/*.Server/GeneratedArtifacts 292 | **/*.Server/ModelManifest.xml 293 | _Pvt_Extensions 294 | 295 | # Paket dependency manager 296 | .paket/paket.exe 297 | paket-files/ 298 | 299 | # FAKE - F# Make 300 | .fake/ 301 | 302 | # CodeRush personal settings 303 | .cr/personal 304 | 305 | # Python Tools for Visual Studio (PTVS) 306 | __pycache__/ 307 | *.pyc 308 | 309 | # Cake - Uncomment if you are using it 310 | # tools/** 311 | # !tools/packages.config 312 | 313 | # Tabs Studio 314 | *.tss 315 | 316 | # Telerik's JustMock configuration file 317 | *.jmconfig 318 | 319 | # BizTalk build output 320 | *.btp.cs 321 | *.btm.cs 322 | *.odx.cs 323 | *.xsd.cs 324 | 325 | # OpenCover UI analysis results 326 | OpenCover/ 327 | 328 | # Azure Stream Analytics local run output 329 | ASALocalRun/ 330 | 331 | # MSBuild Binary and Structured Log 332 | *.binlog 333 | 334 | # NVidia Nsight GPU debugger configuration file 335 | *.nvuser 336 | 337 | # MFractors (Xamarin productivity tool) working folder 338 | .mfractor/ 339 | 340 | # Local History for Visual Studio 341 | .localhistory/ 342 | 343 | # BeatPulse healthcheck temp database 344 | healthchecksdb 345 | 346 | # Backup folder for Package Reference Convert tool in Visual Studio 2017 347 | MigrationBackup/ 348 | 349 | # Ionide (cross platform F# VS Code tools) working folder 350 | .ionide/ 351 | -------------------------------------------------------------------------------- /Expressions.Tests/Boolean/EqualityOperators/EqualityOperator_Tests.cs: -------------------------------------------------------------------------------- 1 | using Aptacode.Expressions.Bool.EqualityOperators; 2 | using Aptacode.Expressions.Integer; 3 | using Moq; 4 | using Xunit; 5 | 6 | namespace Expressions.Tests.Boolean.EqualityOperators; 7 | 8 | public class EqualityOperator_Tests 9 | { 10 | private readonly IContext _context; 11 | 12 | public EqualityOperator_Tests() 13 | { 14 | _context = new Mock().Object; 15 | } 16 | 17 | [Fact] 18 | public void EqualTo() 19 | { 20 | //Arrange 21 | var isEqual = 22 | new EqualTo(new ConstantInteger(1), new ConstantInteger(1)); 23 | //Act 24 | var sut = isEqual.Interpret(_context); 25 | //Assert 26 | Assert.True(sut); 27 | } 28 | 29 | [Fact] 30 | public void NotEqualTo() 31 | { 32 | //Arrange 33 | var isEqual = 34 | new NotEqualTo(new ConstantInteger(2), new ConstantInteger(1)); 35 | //Act 36 | var sut = isEqual.Interpret(_context); 37 | //Assert 38 | Assert.True(sut); 39 | } 40 | } -------------------------------------------------------------------------------- /Expressions.Tests/Boolean/LogicalOperators/LogicalOperator_Tests.cs: -------------------------------------------------------------------------------- 1 | using Aptacode.Expressions.Bool; 2 | using Aptacode.Expressions.Bool.LogicalOperators; 3 | using Moq; 4 | using Xunit; 5 | 6 | namespace Expressions.Tests.Boolean.LogicalOperators; 7 | 8 | public class LogicalOperator_Tests 9 | { 10 | private readonly IContext _context; 11 | 12 | public LogicalOperator_Tests() 13 | { 14 | _context = new Mock().Object; 15 | } 16 | 17 | [Fact] 18 | public void And() 19 | { 20 | //Arrange 21 | var trueAndTrue = new And(new ConstantBool(true), new ConstantBool(true)); 22 | var trueAndFalse = new And(new ConstantBool(true), new ConstantBool(false)); 23 | var falseAndTrue = new And(new ConstantBool(false), new ConstantBool(true)); 24 | var falseAndFalse = new And(new ConstantBool(false), new ConstantBool(false)); 25 | //Act 26 | var sut1 = trueAndTrue.Interpret(_context); 27 | var sut2 = trueAndFalse.Interpret(_context); 28 | var sut3 = falseAndTrue.Interpret(_context); 29 | var sut4 = falseAndFalse.Interpret(_context); 30 | //Assert 31 | Assert.True(sut1); 32 | Assert.False(sut2); 33 | Assert.False(sut3); 34 | Assert.False(sut4); 35 | } 36 | 37 | [Fact] 38 | public void Not() 39 | { 40 | //Arrange 41 | var trueConstant = new ConstantBool(true); 42 | //Act 43 | var sut = new Not(trueConstant).Interpret(_context); 44 | //Assert 45 | Assert.False(sut); 46 | } 47 | 48 | [Fact] 49 | public void Or() 50 | { 51 | //Arrange 52 | var trueOrTrue = new Or(new ConstantBool(true), new ConstantBool(true)); 53 | var trueOrFalse = new Or(new ConstantBool(true), new ConstantBool(false)); 54 | var falseOrTrue = new Or(new ConstantBool(false), new ConstantBool(true)); 55 | var falseOrFalse = new Or(new ConstantBool(false), new ConstantBool(false)); 56 | //Act 57 | var sut1 = trueOrTrue.Interpret(_context); 58 | var sut2 = trueOrFalse.Interpret(_context); 59 | var sut3 = falseOrTrue.Interpret(_context); 60 | var sut4 = falseOrFalse.Interpret(_context); 61 | //Assert 62 | Assert.True(sut1); 63 | Assert.True(sut2); 64 | Assert.True(sut3); 65 | Assert.False(sut4); 66 | } 67 | 68 | [Fact] 69 | public void XOr() 70 | { 71 | //Arrange 72 | var trueXOrTrue = new XOr(new ConstantBool(true), new ConstantBool(true)); 73 | var trueXOrFalse = new XOr(new ConstantBool(true), new ConstantBool(false)); 74 | var falseXOrTrue = new XOr(new ConstantBool(false), new ConstantBool(true)); 75 | var falseXOrFalse = new XOr(new ConstantBool(false), new ConstantBool(false)); 76 | //Act 77 | var sut1 = trueXOrTrue.Interpret(_context); 78 | var sut2 = trueXOrFalse.Interpret(_context); 79 | var sut3 = falseXOrTrue.Interpret(_context); 80 | var sut4 = falseXOrFalse.Interpret(_context); 81 | //Assert 82 | Assert.False(sut1); 83 | Assert.True(sut2); 84 | Assert.True(sut3); 85 | Assert.False(sut4); 86 | } 87 | } -------------------------------------------------------------------------------- /Expressions.Tests/Boolean/RelationalOperators/RelationalOperator_Tests.cs: -------------------------------------------------------------------------------- 1 | using Aptacode.Expressions.Bool.RelationalOperators; 2 | using Aptacode.Expressions.Integer; 3 | using Moq; 4 | using Xunit; 5 | 6 | namespace Expressions.Tests.Boolean.RelationalOperators; 7 | 8 | public class RelationalOperators_Tests 9 | { 10 | private readonly IContext _context; 11 | 12 | public RelationalOperators_Tests() 13 | { 14 | _context = new Mock().Object; 15 | } 16 | 17 | [Fact] 18 | public void GreaterThan() 19 | { 20 | //Arrange 21 | var isGreaterThan = 22 | new GreaterThan(new ConstantInteger(2), new ConstantInteger(1)); 23 | //Act 24 | var sut = isGreaterThan.Interpret(_context); 25 | //Assert 26 | Assert.True(sut); 27 | } 28 | 29 | [Fact] 30 | public void GreaterThanOrEqualTo() 31 | { 32 | //Arrange 33 | 34 | var isGreaterThan = 35 | new GreaterThanOrEqualTo(new ConstantInteger(2), 36 | new ConstantInteger(1)); 37 | var isEqual = 38 | new GreaterThanOrEqualTo(new ConstantInteger(1), 39 | new ConstantInteger(1)); 40 | //Act 41 | var sut1 = isGreaterThan.Interpret(_context); 42 | var sut2 = isEqual.Interpret(_context); 43 | 44 | //Assert 45 | Assert.True(sut1); 46 | Assert.True(sut2); 47 | } 48 | 49 | [Fact] 50 | public void LessThan() 51 | { 52 | //Arrange 53 | var isLessThan = 54 | new LessThan(new ConstantInteger(1), new ConstantInteger(2)); 55 | //Act 56 | var sut = isLessThan.Interpret(_context); 57 | //Assert 58 | Assert.True(sut); 59 | } 60 | 61 | [Fact] 62 | public void LessThanOrEqualTo() 63 | { 64 | //Arrange 65 | var isLessThan = 66 | new LessThanOrEqualTo(new ConstantInteger(1), 67 | new ConstantInteger(2)); 68 | var isEqual = 69 | new LessThanOrEqualTo(new ConstantInteger(1), 70 | new ConstantInteger(1)); 71 | 72 | //Act 73 | var sut1 = isLessThan.Interpret(_context); 74 | var sut2 = isEqual.Interpret(_context); 75 | 76 | //Assert 77 | Assert.True(sut1); 78 | Assert.True(sut2); 79 | } 80 | } -------------------------------------------------------------------------------- /Expressions.Tests/ExpressionFactory_Tests.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Drawing; 3 | using Aptacode.Expressions; 4 | using Aptacode.Expressions.Bool; 5 | using Aptacode.Expressions.Bool.LogicalOperators; 6 | using Aptacode.Expressions.Color; 7 | using Aptacode.Expressions.Decimal; 8 | using Aptacode.Expressions.Double; 9 | using Aptacode.Expressions.Float; 10 | using Aptacode.Expressions.GenericExpressions; 11 | using Aptacode.Expressions.Guid; 12 | using Aptacode.Expressions.Integer; 13 | using Aptacode.Expressions.String; 14 | using Moq; 15 | using Xunit; 16 | 17 | namespace Expressions.Tests; 18 | 19 | public class ExpressionFactory_Tests 20 | { 21 | private readonly IContext _context; 22 | private readonly ExpressionFactory _expressions; 23 | 24 | private readonly IType _type; 25 | 26 | public ExpressionFactory_Tests() 27 | { 28 | _context = new Mock().Object; 29 | _expressions = new Mock>().Object; 30 | _type = new Mock().Object; 31 | } 32 | 33 | 34 | [Fact] 35 | public void ListTest() 36 | { 37 | var fibListExpression = _expressions.List(new[] { 1, 1 }); 38 | 39 | for (var i = 0; i < 20; i++) 40 | { 41 | fibListExpression = _expressions.List(_expressions.ConditionalList( 42 | _expressions.LessThan(_expressions.Last(fibListExpression), _expressions.Int(100)), 43 | _expressions.Append(fibListExpression, 44 | _expressions.Add(_expressions.First(_expressions.TakeLast(fibListExpression, _expressions.Int(2))), 45 | _expressions.Last(_expressions.TakeLast(fibListExpression, _expressions.Int(2))))), 46 | fibListExpression).Interpret(_context)); 47 | } 48 | 49 | var sut = fibListExpression.Interpret(_context); 50 | 51 | Assert.Equal(13, sut[6]); 52 | Assert.Equal(21, sut[7]); 53 | Assert.Equal(34, sut[8]); 54 | } 55 | 56 | #region Constant Expressions 57 | 58 | [Fact] 59 | public void ExpressionFactoryExpression_SuccessfullyCreates_ConstantExpression_Test() 60 | { 61 | //Arrange 62 | var constantExpression = new ConstantExpression(_type); 63 | //Act 64 | var sut = _expressions.Expression(_type); 65 | //Assert 66 | Assert.True(sut.Interpret(_context) == constantExpression.Interpret(_context)); 67 | } 68 | 69 | [Fact] 70 | public void ExpressionFactoryBool_SuccessfullyCreates_ConstantBoolExpression_Test() 71 | { 72 | //Arrange 73 | var constantBool = new ConstantBool(true); 74 | //Act 75 | var sut = _expressions.Bool(true); 76 | //Assert 77 | Assert.True(sut.Interpret(_context) == constantBool.Interpret(_context)); 78 | } 79 | 80 | [Fact] 81 | public void ExpressionFactoryInt_SuccessfullyCreates_ConstantIntegerExpression_Test() 82 | { 83 | //Arrange 84 | var constantInt = new ConstantInteger(1); 85 | //Act 86 | var sut = _expressions.Int(1); 87 | //Assert 88 | Assert.True(sut.Interpret(_context) == constantInt.Interpret(_context)); 89 | } 90 | 91 | [Fact] 92 | public void ExpressionFactoryFloat_SuccessfullyCreates_ConstantFloatExpression_Test() 93 | { 94 | //Arrange 95 | var constantFloat = new ConstantFloat(3.1415f); 96 | //Act 97 | var sut = _expressions.Float(3.1415f); 98 | //Assert 99 | Assert.True(sut.Interpret(_context) == constantFloat.Interpret(_context)); 100 | } 101 | 102 | [Fact] 103 | public void ExpressionFactoryDouble_SuccessfullyCreates_ConstantDoubleExpression_Test() 104 | { 105 | //Arrange 106 | var constantDouble = new ConstantDouble(0.99); 107 | //Act 108 | var sut = _expressions.Double(0.99); 109 | //Assert 110 | Assert.True(sut.Interpret(_context) == constantDouble.Interpret(_context)); 111 | } 112 | 113 | [Fact] 114 | public void ExpressionFactoryDecimal_SuccessfullyCreates_ConstantDecimalExpression_Test() 115 | { 116 | //Arrange 117 | var constantDecimal = new ConstantDecimal(1.23m); 118 | //Act 119 | var sut = _expressions.Decimal(1.23m); 120 | //Assert 121 | Assert.True(sut.Interpret(_context) == constantDecimal.Interpret(_context)); 122 | } 123 | 124 | [Fact] 125 | public void ExpressionFactoryGuid_SuccessfullyCreates_ConstantGuidExpression_Test() 126 | { 127 | //Arrange 128 | var constantGuid = new ConstantGuid(Guid.Parse("9f3a43e8-43db-4115-87ef-20398ead7ae5")); 129 | //Act 130 | var sut = _expressions.Guid(Guid.Parse("9f3a43e8-43db-4115-87ef-20398ead7ae5")); 131 | //Assert 132 | Assert.True(sut.Interpret(_context) == constantGuid.Interpret(_context)); 133 | } 134 | 135 | 136 | [Fact] 137 | public void ExpressionFactoryString_SuccessfullyCreates_ConstantStringExpression_Test() 138 | { 139 | //Arrange 140 | var constantString = new ConstantString("foo"); 141 | //Act 142 | var sut = _expressions.String("foo"); 143 | //Assert 144 | Assert.True(sut.Interpret(_context) == constantString.Interpret(_context)); 145 | } 146 | 147 | [Fact] 148 | public void ExpressionFactoryColor_SuccessfullyCreates_ConstantColorExpression_Test() 149 | { 150 | //Arrange 151 | var constantColor = new ConstantColor(Color.Red); 152 | //Act 153 | var sut = _expressions.Color(Color.Red); 154 | //Assert 155 | Assert.True(sut.Interpret(_context) == constantColor.Interpret(_context)); 156 | } 157 | 158 | #endregion 159 | 160 | #region Boolean Logical Operator Expressions 161 | 162 | [Fact] 163 | public void And_SuccessfullyCreates_AndExpression_Test() 164 | { 165 | //Arrange 166 | var True = _expressions.Bool(true); 167 | var TrueAndTrueEx = new And(True, True); 168 | //Act 169 | var sut = _expressions.And(True, True); 170 | //Assert 171 | Assert.Equal(TrueAndTrueEx.Interpret(_context), sut.Interpret(_context)); 172 | } 173 | 174 | [Fact] 175 | public void Not_SuccessfullyCreates_NotExpression_Test() 176 | { 177 | //Arrange 178 | var True = _expressions.Bool(true); 179 | var NotTrueEx = new Not(True); 180 | //Act 181 | var sut = _expressions.Not(True); 182 | //Assert 183 | Assert.Equal(NotTrueEx.Interpret(_context), sut.Interpret(_context)); 184 | } 185 | 186 | [Fact] 187 | public void Or_SuccessfullyCreates_OrExpression_Test() 188 | { 189 | //Arrange 190 | var True = _expressions.Bool(true); 191 | var TrueOrTrueEx = new Or(True, True); 192 | //Act 193 | var sut = _expressions.Or(True, True); 194 | //Assert 195 | Assert.Equal(TrueOrTrueEx.Interpret(_context), sut.Interpret(_context)); 196 | } 197 | 198 | [Fact] 199 | public void XOr_SuccessfullyCreates_XOrExpression_Test() 200 | { 201 | //Arrange 202 | var True = _expressions.Bool(true); 203 | var TrueXOrTrueEx = new XOr(True, True); 204 | //Act 205 | var sut = _expressions.XOr(True, True); 206 | //Assert 207 | Assert.Equal(TrueXOrTrueEx.Interpret(_context), sut.Interpret(_context)); 208 | } 209 | 210 | #endregion 211 | 212 | #region Boolean Equality Operator Expressions 213 | 214 | [Fact] 215 | public void EqualTo_ReturnsFalse_WhenExpressionsAreNotEqual_Test() 216 | { 217 | //Arrange 218 | var ex1 = _expressions.Int(1); 219 | var ex2 = _expressions.Int(0); 220 | //Act 221 | var sut = _expressions.EqualTo(ex1, ex2); 222 | //Assert 223 | Assert.False(sut.Interpret(_context)); 224 | } 225 | 226 | [Fact] 227 | public void EqualTo_ReturnsTrue_WhenExpressionsAreEqual_Test() 228 | { 229 | //Arrange 230 | var ex1 = _expressions.Int(0); 231 | var ex2 = _expressions.Int(0); 232 | //Act 233 | var sut = _expressions.EqualTo(ex1, ex2); 234 | //Assert 235 | Assert.True(sut.Interpret(_context)); 236 | } 237 | 238 | [Fact] 239 | public void NotEqualTo_ReturnsTrue_WhenExpressionsAreNotEqual_Test() 240 | { 241 | //Arrange 242 | var ex1 = _expressions.Int(0); 243 | var ex2 = _expressions.Int(1); 244 | //Act 245 | var sut = _expressions.NotEqualTo(ex1, ex2); 246 | //Assert 247 | Assert.True(sut.Interpret(_context)); 248 | } 249 | 250 | [Fact] 251 | public void NotEqualTo_ReturnsFlase_WhenExpressionsAreEqual_Test() 252 | { 253 | //Arrange 254 | var ex1 = _expressions.Int(0); 255 | var ex2 = _expressions.Int(0); 256 | //Act 257 | var sut = _expressions.NotEqualTo(ex1, ex2); 258 | //Assert 259 | Assert.False(sut.Interpret(_context)); 260 | } 261 | 262 | #endregion 263 | 264 | #region Boolean Relational Operator Expressions 265 | 266 | [Fact] 267 | public void GreaterThan_ReturnsFalse_When_LHS_IsNot_GreaterThan_RHS_Test() 268 | { 269 | //Arrange 270 | var ex1 = _expressions.Int(1); 271 | var ex2 = _expressions.Int(0); 272 | //Act 273 | var sut = _expressions.GreaterThan(ex2, ex1); 274 | //Assert 275 | Assert.False(sut.Interpret(_context)); 276 | } 277 | 278 | [Fact] 279 | public void GreaterThan_ReturnsTrue_When_LHS_Is_GreaterThan_RHS_Test() 280 | { 281 | //Arrange 282 | var ex1 = _expressions.Int(1); 283 | var ex2 = _expressions.Int(0); 284 | //Act 285 | var sut = _expressions.GreaterThan(ex1, ex2); 286 | //Assert 287 | Assert.True(sut.Interpret(_context)); 288 | } 289 | 290 | [Fact] 291 | public void GreaterThanOrEqualTo_ReturnsFalse_When_LHS_IsNot_GreaterThanOrEqualTo_RHS_Test() 292 | { 293 | //Arrange 294 | var ex1 = _expressions.Int(1); 295 | var ex2 = _expressions.Int(0); 296 | 297 | //Act 298 | var sut = _expressions.GreaterThanOrEqualTo(ex2, ex1); 299 | 300 | //Assert 301 | Assert.False(sut.Interpret(_context)); 302 | } 303 | 304 | [Fact] 305 | public void GreaterThanOrEqualTo_ReturnsTrue_When_LHS_Is_GreaterThanOrEqualTo_RHS_Test() 306 | { 307 | //Arrange 308 | var ex1 = _expressions.Int(1); 309 | var ex2 = _expressions.Int(0); 310 | var ex3 = _expressions.Int(0); 311 | //Act 312 | var sut1 = _expressions.GreaterThanOrEqualTo(ex1, ex2); 313 | var sut2 = _expressions.GreaterThanOrEqualTo(ex2, ex3); 314 | //Assert 315 | Assert.True(sut1.Interpret(_context)); 316 | Assert.True(sut2.Interpret(_context)); 317 | } 318 | 319 | [Fact] 320 | public void LessThan_ReturnsFalse_When_LHS_IsNot_LessThan_RHS_Test() 321 | { 322 | //Arrange 323 | var ex1 = _expressions.Int(1); 324 | var ex2 = _expressions.Int(0); 325 | //Act 326 | var sut = _expressions.LessThan(ex1, ex2); 327 | //Assert 328 | Assert.False(sut.Interpret(_context)); 329 | } 330 | 331 | [Fact] 332 | public void LessThan_ReturnsTrue_When_LHS_Is_LessThan_RHS_Test() 333 | { 334 | //Arrange 335 | var ex1 = _expressions.Int(1); 336 | var ex2 = _expressions.Int(0); 337 | //Act 338 | var sut = _expressions.LessThan(ex2, ex1); 339 | //Assert 340 | Assert.True(sut.Interpret(_context)); 341 | } 342 | 343 | [Fact] 344 | public void LessThanOrEqualTo_ReturnsFalse_When_LHS_IsNot_LessThanOrEqualTo_RHS_Test() 345 | { 346 | //Arrange 347 | var ex1 = _expressions.Int(1); 348 | var ex2 = _expressions.Int(0); 349 | //Act 350 | var sut = _expressions.LessThanOrEqualTo(ex1, ex2); 351 | //Assert 352 | Assert.False(sut.Interpret(_context)); 353 | } 354 | 355 | [Fact] 356 | public void LessThanOrEqualTo_ReturnsTrue_When_LHS_Is_LessThanOrEqualTo_RHS_Test() 357 | { 358 | //Arrange 359 | var ex1 = _expressions.Int(1); 360 | var ex2 = _expressions.Int(0); 361 | var ex3 = _expressions.Int(0); 362 | //Act 363 | var sut1 = _expressions.LessThanOrEqualTo(ex2, ex1); 364 | var sut2 = _expressions.LessThanOrEqualTo(ex2, ex3); 365 | //Assert 366 | Assert.True(sut1.Interpret(_context)); 367 | Assert.True(sut2.Interpret(_context)); 368 | } 369 | 370 | #endregion 371 | 372 | #region Conditional Expressions 373 | 374 | [Fact] 375 | public void ExpressionFactoryConditional_SuccessfullyCreates_ConditionalExpression_Test() 376 | { 377 | //Arrange 378 | var Conditional = 379 | new ConditionalExpression(_expressions.Bool(true), _expressions.Expression(_type), 380 | _expressions.Expression(_type)); 381 | //Act 382 | var sut = _expressions.Conditional(_expressions.Bool(true), _expressions.Expression(_type), 383 | _expressions.Expression(_type)); 384 | //Assert 385 | Assert.True(_expressions.EqualTo(Conditional, sut).Interpret(_context)); 386 | } 387 | 388 | [Fact] 389 | public void ExpressionFactoryConditional_SuccessfullyCreates_ConditionalIntegerExpression_Test() 390 | { 391 | //Arrange 392 | var intConditional = 393 | new ConditionalExpression(_expressions.Bool(true), _expressions.Int(1), 394 | _expressions.Int(0)); 395 | //Act 396 | var sut = _expressions.Conditional(_expressions.Bool(true), _expressions.Int(1), _expressions.Int(0)); 397 | //Assert 398 | Assert.True(_expressions.EqualTo(intConditional, sut).Interpret(_context)); 399 | } 400 | 401 | #endregion 402 | 403 | #region Arithmetic Operator Expressions 404 | 405 | [Fact] 406 | public void ExpressionFactory_Add_SuccessfullyAdds_Two_IntegerExpressions_Test() 407 | { 408 | //Arrange 409 | var int1 = _expressions.Int(1); 410 | var int2 = _expressions.Int(1); 411 | //Act 412 | var sut = _expressions.Add(int1, int2); 413 | //Assert 414 | Assert.Equal(2, sut.Interpret(_context)); 415 | } 416 | 417 | [Fact] 418 | public void ExpressionFactory_Multiply_SuccessfullyMultiplies_Two_IntegerExpressions_Test() 419 | { 420 | //Arrange 421 | var int1 = _expressions.Int(2); 422 | var int2 = _expressions.Int(2); 423 | //Act 424 | var sut = _expressions.Multiply(int1, int2); 425 | //Assert 426 | Assert.Equal(4, sut.Interpret(_context)); 427 | } 428 | 429 | [Fact] 430 | public void ExpressionFactory_Subtract_SuccessfullySubtracts_Two_IntegerExpressions_Test() 431 | { 432 | //Arrange 433 | var int1 = _expressions.Int(1); 434 | var int2 = _expressions.Int(1); 435 | //Act 436 | var sut = _expressions.Subtract(int1, int2); 437 | //Assert 438 | Assert.Equal(0, sut.Interpret(_context)); 439 | } 440 | 441 | #endregion 442 | } -------------------------------------------------------------------------------- /Expressions.Tests/Expressions.Tests.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | net6.0 5 | 6 | false 7 | 8 | Logo.ico 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | runtime; build; native; contentfiles; analyzers; buildtransitive 17 | all 18 | 19 | 20 | runtime; build; native; contentfiles; analyzers; buildtransitive 21 | all 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /Expressions.Tests/GenericExpressions/GenericExpression_Tests.cs: -------------------------------------------------------------------------------- 1 | using Aptacode.Expressions.Bool; 2 | using Aptacode.Expressions.GenericExpressions; 3 | using Moq; 4 | using Xunit; 5 | 6 | namespace Expressions.Tests.GenericExpressions; 7 | 8 | public class GenericExpression_Tests 9 | { 10 | private readonly IContext _context; 11 | private readonly IType _typeObject1; 12 | private readonly IType _typeObject2; 13 | 14 | public GenericExpression_Tests() 15 | { 16 | _context = new Mock().Object; 17 | _typeObject1 = new Mock().Object; 18 | _typeObject2 = new Mock().Object; 19 | } 20 | 21 | [Fact] 22 | public void ConstantExpression_OfGenericType_Evaluatesto_AnExpression_WithValue_OfGivenType_Test() 23 | { 24 | //Arrange 25 | var constantExpression = 26 | new ConstantExpression(_typeObject1); 27 | //Act 28 | var sut = constantExpression.Interpret(_context); 29 | //Assert 30 | Assert.Equal(_typeObject1, sut); 31 | } 32 | 33 | [Fact] 34 | public void 35 | ConditionalExpression_OfGenericType_EvaluatesToFailExpression_WithValue_OfGivenType_OnFalseCondition_Test() 36 | { 37 | //Arrange 38 | var conditionalExpression = new ConditionalExpression(new ConstantBool(false), 39 | new ConstantExpression(_typeObject1), 40 | new ConstantExpression(_typeObject2)); 41 | //Act 42 | var sut = conditionalExpression.Interpret(_context); 43 | //Assert 44 | Assert.Equal(_typeObject2, sut); 45 | } 46 | 47 | [Fact] 48 | public void 49 | ConditionalExpression_OfGenericType_EvaluatesToPassExpression_WithValue_OfGivenType_OnTrueCondition_Test() 50 | { 51 | //Arrange 52 | var conditionalExpression = new ConditionalExpression(new ConstantBool(true), 53 | new ConstantExpression(_typeObject1), 54 | new ConstantExpression(_typeObject2)); 55 | //Act 56 | var sut = conditionalExpression.Interpret(_context); 57 | //Assert 58 | Assert.Equal(_typeObject1, sut); 59 | } 60 | } -------------------------------------------------------------------------------- /Expressions.Tests/IContext.cs: -------------------------------------------------------------------------------- 1 | namespace Expressions.Tests; 2 | 3 | public interface IContext 4 | { 5 | } -------------------------------------------------------------------------------- /Expressions.Tests/IType.cs: -------------------------------------------------------------------------------- 1 | namespace Expressions.Tests; 2 | 3 | public interface IType 4 | { 5 | } -------------------------------------------------------------------------------- /Expressions.Tests/Integer/Integer_Tests.cs: -------------------------------------------------------------------------------- 1 | using Aptacode.Expressions.GenericArithmeticOperators; 2 | using Aptacode.Expressions.Integer; 3 | using Moq; 4 | using Xunit; 5 | 6 | namespace Expressions.Tests.Integer; 7 | 8 | public class Integer_Tests 9 | { 10 | private readonly IContext _context; 11 | 12 | public Integer_Tests() 13 | { 14 | _context = new Mock().Object; 15 | } 16 | 17 | [Fact] 18 | public void Add_SuccessfullyAdds_Two_ConstantIntegers_Test() 19 | { 20 | //Arrange 21 | var addExpression = 22 | new Add(new ConstantInteger(1), new ConstantInteger(1)); 23 | //Act 24 | var sut = addExpression.Interpret(_context); 25 | //Assert 26 | Assert.Equal(2, sut); 27 | } 28 | 29 | [Fact] 30 | public void Multiply_SuccessfullyMultiplies_Two_ConstantIntegers_Test() 31 | { 32 | //Arrange 33 | var multiplyExpression = 34 | new Multiply(new ConstantInteger(2), new ConstantInteger(2)); 35 | //Act 36 | var sut = multiplyExpression.Interpret(_context); 37 | //Assert 38 | Assert.Equal(4, sut); 39 | } 40 | 41 | [Fact] 42 | public void Subtract_SuccessfullySubtracts_Two_ConstantIntegers_Test() 43 | { 44 | //Arrange 45 | var subtractExpression = 46 | new Subtract(new ConstantInteger(2), new ConstantInteger(1)); 47 | //Act 48 | var sut = subtractExpression.Interpret(_context); 49 | //Assert 50 | Assert.Equal(1, sut); 51 | } 52 | } -------------------------------------------------------------------------------- /Expressions.Tests/Logo.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Aptacode/Expressions/92a1f1249fa5dd80f32efb997855eb7cf4747d6c/Expressions.Tests/Logo.ico -------------------------------------------------------------------------------- /Expressions.Tests/packages.lock.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": 1, 3 | "dependencies": { 4 | "net6.0": { 5 | "coverlet.collector": { 6 | "type": "Direct", 7 | "requested": "[3.1.2, )", 8 | "resolved": "3.1.2", 9 | "contentHash": "wuLDIDKD5XMt0A7lE31JPenT7QQwZPFkP5rRpdJeblyXZ9MGLI8rYjvm5fvAKln+2/X+4IxxQDxBtwdrqKNLZw==" 10 | }, 11 | "Microsoft.NET.Test.Sdk": { 12 | "type": "Direct", 13 | "requested": "[17.1.0, )", 14 | "resolved": "17.1.0", 15 | "contentHash": "MVKvOsHIfrZrvg+8aqOF5dknO/qWrR1sWZjMPQ1N42MKMlL/zQL30FQFZxPeWfmVKWUWAOmAHYsqB5OerTKziw==", 16 | "dependencies": { 17 | "Microsoft.CodeCoverage": "17.1.0", 18 | "Microsoft.TestPlatform.TestHost": "17.1.0" 19 | } 20 | }, 21 | "Moq": { 22 | "type": "Direct", 23 | "requested": "[4.17.2, )", 24 | "resolved": "4.17.2", 25 | "contentHash": "HytUPJ3/uks2UgJ9hIcyXm3YxpFAR4OJzbQwTHltbKGun3lFLhEHs97hiiPj1dY8jV/kasXeihTzDxct6Zf3iQ==", 26 | "dependencies": { 27 | "Castle.Core": "4.4.1", 28 | "System.Threading.Tasks.Extensions": "4.5.4" 29 | } 30 | }, 31 | "xunit": { 32 | "type": "Direct", 33 | "requested": "[2.4.1, )", 34 | "resolved": "2.4.1", 35 | "contentHash": "XNR3Yz9QTtec16O0aKcO6+baVNpXmOnPUxDkCY97J+8krUYxPvXT1szYYEUdKk4sB8GOI2YbAjRIOm8ZnXRfzQ==", 36 | "dependencies": { 37 | "xunit.analyzers": "0.10.0", 38 | "xunit.assert": "[2.4.1]", 39 | "xunit.core": "[2.4.1]" 40 | } 41 | }, 42 | "xunit.runner.visualstudio": { 43 | "type": "Direct", 44 | "requested": "[2.4.3, )", 45 | "resolved": "2.4.3", 46 | "contentHash": "kZZSmOmKA8OBlAJaquPXnJJLM9RwQ27H7BMVqfMLUcTi9xHinWGJiWksa3D4NEtz0wZ/nxd2mogObvBgJKCRhQ==" 47 | }, 48 | "Castle.Core": { 49 | "type": "Transitive", 50 | "resolved": "4.4.1", 51 | "contentHash": "zanbjWC0Y05gbx4eGXkzVycOQqVOFVeCjVsDSyuao9P4mtN1w3WxxTo193NGC7j3o2u3AJRswaoC6hEbnGACnQ==", 52 | "dependencies": { 53 | "NETStandard.Library": "1.6.1", 54 | "System.Collections.Specialized": "4.3.0", 55 | "System.ComponentModel": "4.3.0", 56 | "System.ComponentModel.TypeConverter": "4.3.0", 57 | "System.Diagnostics.TraceSource": "4.3.0", 58 | "System.Dynamic.Runtime": "4.3.0", 59 | "System.Reflection": "4.3.0", 60 | "System.Reflection.Emit": "4.3.0", 61 | "System.Reflection.TypeExtensions": "4.3.0", 62 | "System.Xml.XmlDocument": "4.3.0" 63 | } 64 | }, 65 | "Microsoft.CodeCoverage": { 66 | "type": "Transitive", 67 | "resolved": "17.1.0", 68 | "contentHash": "0N/ZJ71ncCxQWhgtkEYKOgu2oMHa8h1tsOUbhmIKXF8UwtSUCe4vHAsJ3DVcNWRwNfQzSTy263ZE+QF6MdIhhQ==" 69 | }, 70 | "Microsoft.CSharp": { 71 | "type": "Transitive", 72 | "resolved": "4.0.1", 73 | "contentHash": "17h8b5mXa87XYKrrVqdgZ38JefSUqLChUQpXgSnpzsM0nDOhE40FTeNWOJ/YmySGV6tG6T8+hjz6vxbknHJr6A==", 74 | "dependencies": { 75 | "System.Collections": "4.0.11", 76 | "System.Diagnostics.Debug": "4.0.11", 77 | "System.Dynamic.Runtime": "4.0.11", 78 | "System.Globalization": "4.0.11", 79 | "System.Linq": "4.1.0", 80 | "System.Linq.Expressions": "4.1.0", 81 | "System.ObjectModel": "4.0.12", 82 | "System.Reflection": "4.1.0", 83 | "System.Reflection.Extensions": "4.0.1", 84 | "System.Reflection.Primitives": "4.0.1", 85 | "System.Reflection.TypeExtensions": "4.1.0", 86 | "System.Resources.ResourceManager": "4.0.1", 87 | "System.Runtime": "4.1.0", 88 | "System.Runtime.Extensions": "4.1.0", 89 | "System.Runtime.InteropServices": "4.1.0", 90 | "System.Threading": "4.0.11" 91 | } 92 | }, 93 | "Microsoft.NETCore.Platforms": { 94 | "type": "Transitive", 95 | "resolved": "1.1.0", 96 | "contentHash": "kz0PEW2lhqygehI/d6XsPCQzD7ff7gUJaVGPVETX611eadGsA3A877GdSlU0LRVMCTH/+P3o2iDTak+S08V2+A==" 97 | }, 98 | "Microsoft.NETCore.Targets": { 99 | "type": "Transitive", 100 | "resolved": "1.1.0", 101 | "contentHash": "aOZA3BWfz9RXjpzt0sRJJMjAscAUm3Hoa4UWAfceV9UTYxgwZ1lZt5nO2myFf+/jetYQo4uTP7zS8sJY67BBxg==" 102 | }, 103 | "Microsoft.TestPlatform.ObjectModel": { 104 | "type": "Transitive", 105 | "resolved": "17.1.0", 106 | "contentHash": "OMo/FYnKGy3lZEK0gfitskRM3ga/YBt6MyCyFPq0xNLeybGOQ6HnYNAAvzyePo5WPuMiw3LX+HiuRWNjnas1fA==", 107 | "dependencies": { 108 | "NuGet.Frameworks": "5.11.0", 109 | "System.Reflection.Metadata": "1.6.0" 110 | } 111 | }, 112 | "Microsoft.TestPlatform.TestHost": { 113 | "type": "Transitive", 114 | "resolved": "17.1.0", 115 | "contentHash": "JS0JDLniDhIzkSPLHz7N/x1CG8ywJOtwInFDYA3KQvbz+ojGoT5MT2YDVReL1b86zmNRV8339vsTSm/zh0RcMg==", 116 | "dependencies": { 117 | "Microsoft.TestPlatform.ObjectModel": "17.1.0", 118 | "Newtonsoft.Json": "9.0.1" 119 | } 120 | }, 121 | "Microsoft.Win32.Primitives": { 122 | "type": "Transitive", 123 | "resolved": "4.3.0", 124 | "contentHash": "9ZQKCWxH7Ijp9BfahvL2Zyf1cJIk8XYLF6Yjzr2yi0b2cOut/HQ31qf1ThHAgCc3WiZMdnWcfJCgN82/0UunxA==", 125 | "dependencies": { 126 | "Microsoft.NETCore.Platforms": "1.1.0", 127 | "Microsoft.NETCore.Targets": "1.1.0", 128 | "System.Runtime": "4.3.0" 129 | } 130 | }, 131 | "NETStandard.Library": { 132 | "type": "Transitive", 133 | "resolved": "1.6.1", 134 | "contentHash": "WcSp3+vP+yHNgS8EV5J7pZ9IRpeDuARBPN28by8zqff1wJQXm26PVU8L3/fYLBJVU7BtDyqNVWq2KlCVvSSR4A==", 135 | "dependencies": { 136 | "Microsoft.NETCore.Platforms": "1.1.0", 137 | "Microsoft.Win32.Primitives": "4.3.0", 138 | "System.AppContext": "4.3.0", 139 | "System.Collections": "4.3.0", 140 | "System.Collections.Concurrent": "4.3.0", 141 | "System.Console": "4.3.0", 142 | "System.Diagnostics.Debug": "4.3.0", 143 | "System.Diagnostics.Tools": "4.3.0", 144 | "System.Diagnostics.Tracing": "4.3.0", 145 | "System.Globalization": "4.3.0", 146 | "System.Globalization.Calendars": "4.3.0", 147 | "System.IO": "4.3.0", 148 | "System.IO.Compression": "4.3.0", 149 | "System.IO.Compression.ZipFile": "4.3.0", 150 | "System.IO.FileSystem": "4.3.0", 151 | "System.IO.FileSystem.Primitives": "4.3.0", 152 | "System.Linq": "4.3.0", 153 | "System.Linq.Expressions": "4.3.0", 154 | "System.Net.Http": "4.3.0", 155 | "System.Net.Primitives": "4.3.0", 156 | "System.Net.Sockets": "4.3.0", 157 | "System.ObjectModel": "4.3.0", 158 | "System.Reflection": "4.3.0", 159 | "System.Reflection.Extensions": "4.3.0", 160 | "System.Reflection.Primitives": "4.3.0", 161 | "System.Resources.ResourceManager": "4.3.0", 162 | "System.Runtime": "4.3.0", 163 | "System.Runtime.Extensions": "4.3.0", 164 | "System.Runtime.Handles": "4.3.0", 165 | "System.Runtime.InteropServices": "4.3.0", 166 | "System.Runtime.InteropServices.RuntimeInformation": "4.3.0", 167 | "System.Runtime.Numerics": "4.3.0", 168 | "System.Security.Cryptography.Algorithms": "4.3.0", 169 | "System.Security.Cryptography.Encoding": "4.3.0", 170 | "System.Security.Cryptography.Primitives": "4.3.0", 171 | "System.Security.Cryptography.X509Certificates": "4.3.0", 172 | "System.Text.Encoding": "4.3.0", 173 | "System.Text.Encoding.Extensions": "4.3.0", 174 | "System.Text.RegularExpressions": "4.3.0", 175 | "System.Threading": "4.3.0", 176 | "System.Threading.Tasks": "4.3.0", 177 | "System.Threading.Timer": "4.3.0", 178 | "System.Xml.ReaderWriter": "4.3.0", 179 | "System.Xml.XDocument": "4.3.0" 180 | } 181 | }, 182 | "Newtonsoft.Json": { 183 | "type": "Transitive", 184 | "resolved": "9.0.1", 185 | "contentHash": "U82mHQSKaIk+lpSVCbWYKNavmNH1i5xrExDEquU1i6I5pV6UMOqRnJRSlKO3cMPfcpp0RgDY+8jUXHdQ4IfXvw==", 186 | "dependencies": { 187 | "Microsoft.CSharp": "4.0.1", 188 | "System.Collections": "4.0.11", 189 | "System.Diagnostics.Debug": "4.0.11", 190 | "System.Dynamic.Runtime": "4.0.11", 191 | "System.Globalization": "4.0.11", 192 | "System.IO": "4.1.0", 193 | "System.Linq": "4.1.0", 194 | "System.Linq.Expressions": "4.1.0", 195 | "System.ObjectModel": "4.0.12", 196 | "System.Reflection": "4.1.0", 197 | "System.Reflection.Extensions": "4.0.1", 198 | "System.Resources.ResourceManager": "4.0.1", 199 | "System.Runtime": "4.1.0", 200 | "System.Runtime.Extensions": "4.1.0", 201 | "System.Runtime.Serialization.Primitives": "4.1.1", 202 | "System.Text.Encoding": "4.0.11", 203 | "System.Text.Encoding.Extensions": "4.0.11", 204 | "System.Text.RegularExpressions": "4.1.0", 205 | "System.Threading": "4.0.11", 206 | "System.Threading.Tasks": "4.0.11", 207 | "System.Xml.ReaderWriter": "4.0.11", 208 | "System.Xml.XDocument": "4.0.11" 209 | } 210 | }, 211 | "NuGet.Frameworks": { 212 | "type": "Transitive", 213 | "resolved": "5.11.0", 214 | "contentHash": "eaiXkUjC4NPcquGWzAGMXjuxvLwc6XGKMptSyOGQeT0X70BUZObuybJFZLA0OfTdueLd3US23NBPTBb6iF3V1Q==" 215 | }, 216 | "runtime.debian.8-x64.runtime.native.System.Security.Cryptography.OpenSsl": { 217 | "type": "Transitive", 218 | "resolved": "4.3.0", 219 | "contentHash": "HdSSp5MnJSsg08KMfZThpuLPJpPwE5hBXvHwoKWosyHHfe8Mh5WKT0ylEOf6yNzX6Ngjxe4Whkafh5q7Ymac4Q==" 220 | }, 221 | "runtime.fedora.23-x64.runtime.native.System.Security.Cryptography.OpenSsl": { 222 | "type": "Transitive", 223 | "resolved": "4.3.0", 224 | "contentHash": "+yH1a49wJMy8Zt4yx5RhJrxO/DBDByAiCzNwiETI+1S4mPdCu0OY4djdciC7Vssk0l22wQaDLrXxXkp+3+7bVA==" 225 | }, 226 | "runtime.fedora.24-x64.runtime.native.System.Security.Cryptography.OpenSsl": { 227 | "type": "Transitive", 228 | "resolved": "4.3.0", 229 | "contentHash": "c3YNH1GQJbfIPJeCnr4avseugSqPrxwIqzthYyZDN6EuOyNOzq+y2KSUfRcXauya1sF4foESTgwM5e1A8arAKw==" 230 | }, 231 | "runtime.native.System": { 232 | "type": "Transitive", 233 | "resolved": "4.3.0", 234 | "contentHash": "c/qWt2LieNZIj1jGnVNsE2Kl23Ya2aSTBuXMD6V7k9KWr6l16Tqdwq+hJScEpWER9753NWC8h96PaVNY5Ld7Jw==", 235 | "dependencies": { 236 | "Microsoft.NETCore.Platforms": "1.1.0", 237 | "Microsoft.NETCore.Targets": "1.1.0" 238 | } 239 | }, 240 | "runtime.native.System.IO.Compression": { 241 | "type": "Transitive", 242 | "resolved": "4.3.0", 243 | "contentHash": "INBPonS5QPEgn7naufQFXJEp3zX6L4bwHgJ/ZH78aBTpeNfQMtf7C6VrAFhlq2xxWBveIOWyFzQjJ8XzHMhdOQ==", 244 | "dependencies": { 245 | "Microsoft.NETCore.Platforms": "1.1.0", 246 | "Microsoft.NETCore.Targets": "1.1.0" 247 | } 248 | }, 249 | "runtime.native.System.Net.Http": { 250 | "type": "Transitive", 251 | "resolved": "4.3.0", 252 | "contentHash": "ZVuZJqnnegJhd2k/PtAbbIcZ3aZeITq3sj06oKfMBSfphW3HDmk/t4ObvbOk/JA/swGR0LNqMksAh/f7gpTROg==", 253 | "dependencies": { 254 | "Microsoft.NETCore.Platforms": "1.1.0", 255 | "Microsoft.NETCore.Targets": "1.1.0" 256 | } 257 | }, 258 | "runtime.native.System.Security.Cryptography.Apple": { 259 | "type": "Transitive", 260 | "resolved": "4.3.0", 261 | "contentHash": "DloMk88juo0OuOWr56QG7MNchmafTLYWvABy36izkrLI5VledI0rq28KGs1i9wbpeT9NPQrx/wTf8U2vazqQ3Q==", 262 | "dependencies": { 263 | "runtime.osx.10.10-x64.runtime.native.System.Security.Cryptography.Apple": "4.3.0" 264 | } 265 | }, 266 | "runtime.native.System.Security.Cryptography.OpenSsl": { 267 | "type": "Transitive", 268 | "resolved": "4.3.0", 269 | "contentHash": "NS1U+700m4KFRHR5o4vo9DSlTmlCKu/u7dtE5sUHVIPB+xpXxYQvgBgA6wEIeCz6Yfn0Z52/72WYsToCEPJnrw==", 270 | "dependencies": { 271 | "runtime.debian.8-x64.runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0", 272 | "runtime.fedora.23-x64.runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0", 273 | "runtime.fedora.24-x64.runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0", 274 | "runtime.opensuse.13.2-x64.runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0", 275 | "runtime.opensuse.42.1-x64.runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0", 276 | "runtime.osx.10.10-x64.runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0", 277 | "runtime.rhel.7-x64.runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0", 278 | "runtime.ubuntu.14.04-x64.runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0", 279 | "runtime.ubuntu.16.04-x64.runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0", 280 | "runtime.ubuntu.16.10-x64.runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0" 281 | } 282 | }, 283 | "runtime.opensuse.13.2-x64.runtime.native.System.Security.Cryptography.OpenSsl": { 284 | "type": "Transitive", 285 | "resolved": "4.3.0", 286 | "contentHash": "b3pthNgxxFcD+Pc0WSEoC0+md3MyhRS6aCEeenvNE3Fdw1HyJ18ZhRFVJJzIeR/O/jpxPboB805Ho0T3Ul7w8A==" 287 | }, 288 | "runtime.opensuse.42.1-x64.runtime.native.System.Security.Cryptography.OpenSsl": { 289 | "type": "Transitive", 290 | "resolved": "4.3.0", 291 | "contentHash": "KeLz4HClKf+nFS7p/6Fi/CqyLXh81FpiGzcmuS8DGi9lUqSnZ6Es23/gv2O+1XVGfrbNmviF7CckBpavkBoIFQ==" 292 | }, 293 | "runtime.osx.10.10-x64.runtime.native.System.Security.Cryptography.Apple": { 294 | "type": "Transitive", 295 | "resolved": "4.3.0", 296 | "contentHash": "kVXCuMTrTlxq4XOOMAysuNwsXWpYeboGddNGpIgNSZmv1b6r/s/DPk0fYMB7Q5Qo4bY68o48jt4T4y5BVecbCQ==" 297 | }, 298 | "runtime.osx.10.10-x64.runtime.native.System.Security.Cryptography.OpenSsl": { 299 | "type": "Transitive", 300 | "resolved": "4.3.0", 301 | "contentHash": "X7IdhILzr4ROXd8mI1BUCQMSHSQwelUlBjF1JyTKCjXaOGn2fB4EKBxQbCK2VjO3WaWIdlXZL3W6TiIVnrhX4g==" 302 | }, 303 | "runtime.rhel.7-x64.runtime.native.System.Security.Cryptography.OpenSsl": { 304 | "type": "Transitive", 305 | "resolved": "4.3.0", 306 | "contentHash": "nyFNiCk/r+VOiIqreLix8yN+q3Wga9+SE8BCgkf+2BwEKiNx6DyvFjCgkfV743/grxv8jHJ8gUK4XEQw7yzRYg==" 307 | }, 308 | "runtime.ubuntu.14.04-x64.runtime.native.System.Security.Cryptography.OpenSsl": { 309 | "type": "Transitive", 310 | "resolved": "4.3.0", 311 | "contentHash": "ytoewC6wGorL7KoCAvRfsgoJPJbNq+64k2SqW6JcOAebWsFUvCCYgfzQMrnpvPiEl4OrblUlhF2ji+Q1+SVLrQ==" 312 | }, 313 | "runtime.ubuntu.16.04-x64.runtime.native.System.Security.Cryptography.OpenSsl": { 314 | "type": "Transitive", 315 | "resolved": "4.3.0", 316 | "contentHash": "I8bKw2I8k58Wx7fMKQJn2R8lamboCAiHfHeV/pS65ScKWMMI0+wJkLYlEKvgW1D/XvSl/221clBoR2q9QNNM7A==" 317 | }, 318 | "runtime.ubuntu.16.10-x64.runtime.native.System.Security.Cryptography.OpenSsl": { 319 | "type": "Transitive", 320 | "resolved": "4.3.0", 321 | "contentHash": "VB5cn/7OzUfzdnC8tqAIMQciVLiq2epm2NrAm1E9OjNRyG4lVhfR61SMcLizejzQP8R8Uf/0l5qOIbUEi+RdEg==" 322 | }, 323 | "System.AppContext": { 324 | "type": "Transitive", 325 | "resolved": "4.3.0", 326 | "contentHash": "fKC+rmaLfeIzUhagxY17Q9siv/sPrjjKcfNg1Ic8IlQkZLipo8ljcaZQu4VtI4Jqbzjc2VTjzGLF6WmsRXAEgA==", 327 | "dependencies": { 328 | "System.Runtime": "4.3.0" 329 | } 330 | }, 331 | "System.Buffers": { 332 | "type": "Transitive", 333 | "resolved": "4.3.0", 334 | "contentHash": "ratu44uTIHgeBeI0dE8DWvmXVBSo4u7ozRZZHOMmK/JPpYyo0dAfgSiHlpiObMQ5lEtEyIXA40sKRYg5J6A8uQ==", 335 | "dependencies": { 336 | "System.Diagnostics.Debug": "4.3.0", 337 | "System.Diagnostics.Tracing": "4.3.0", 338 | "System.Resources.ResourceManager": "4.3.0", 339 | "System.Runtime": "4.3.0", 340 | "System.Threading": "4.3.0" 341 | } 342 | }, 343 | "System.Collections": { 344 | "type": "Transitive", 345 | "resolved": "4.3.0", 346 | "contentHash": "3Dcj85/TBdVpL5Zr+gEEBUuFe2icOnLalmEh9hfck1PTYbbyWuZgh4fmm2ysCLTrqLQw6t3TgTyJ+VLp+Qb+Lw==", 347 | "dependencies": { 348 | "Microsoft.NETCore.Platforms": "1.1.0", 349 | "Microsoft.NETCore.Targets": "1.1.0", 350 | "System.Runtime": "4.3.0" 351 | } 352 | }, 353 | "System.Collections.Concurrent": { 354 | "type": "Transitive", 355 | "resolved": "4.3.0", 356 | "contentHash": "ztl69Xp0Y/UXCL+3v3tEU+lIy+bvjKNUmopn1wep/a291pVPK7dxBd6T7WnlQqRog+d1a/hSsgRsmFnIBKTPLQ==", 357 | "dependencies": { 358 | "System.Collections": "4.3.0", 359 | "System.Diagnostics.Debug": "4.3.0", 360 | "System.Diagnostics.Tracing": "4.3.0", 361 | "System.Globalization": "4.3.0", 362 | "System.Reflection": "4.3.0", 363 | "System.Resources.ResourceManager": "4.3.0", 364 | "System.Runtime": "4.3.0", 365 | "System.Runtime.Extensions": "4.3.0", 366 | "System.Threading": "4.3.0", 367 | "System.Threading.Tasks": "4.3.0" 368 | } 369 | }, 370 | "System.Collections.NonGeneric": { 371 | "type": "Transitive", 372 | "resolved": "4.3.0", 373 | "contentHash": "prtjIEMhGUnQq6RnPEYLpFt8AtLbp9yq2zxOSrY7KJJZrw25Fi97IzBqY7iqssbM61Ek5b8f3MG/sG1N2sN5KA==", 374 | "dependencies": { 375 | "System.Diagnostics.Debug": "4.3.0", 376 | "System.Globalization": "4.3.0", 377 | "System.Resources.ResourceManager": "4.3.0", 378 | "System.Runtime": "4.3.0", 379 | "System.Runtime.Extensions": "4.3.0", 380 | "System.Threading": "4.3.0" 381 | } 382 | }, 383 | "System.Collections.Specialized": { 384 | "type": "Transitive", 385 | "resolved": "4.3.0", 386 | "contentHash": "Epx8PoVZR0iuOnJJDzp7pWvdfMMOAvpUo95pC4ScH2mJuXkKA2Y4aR3cG9qt2klHgSons1WFh4kcGW7cSXvrxg==", 387 | "dependencies": { 388 | "System.Collections.NonGeneric": "4.3.0", 389 | "System.Globalization": "4.3.0", 390 | "System.Globalization.Extensions": "4.3.0", 391 | "System.Resources.ResourceManager": "4.3.0", 392 | "System.Runtime": "4.3.0", 393 | "System.Runtime.Extensions": "4.3.0", 394 | "System.Threading": "4.3.0" 395 | } 396 | }, 397 | "System.ComponentModel": { 398 | "type": "Transitive", 399 | "resolved": "4.3.0", 400 | "contentHash": "VyGn1jGRZVfxnh8EdvDCi71v3bMXrsu8aYJOwoV7SNDLVhiEqwP86pPMyRGsDsxhXAm2b3o9OIqeETfN5qfezw==", 401 | "dependencies": { 402 | "System.Runtime": "4.3.0" 403 | } 404 | }, 405 | "System.ComponentModel.Primitives": { 406 | "type": "Transitive", 407 | "resolved": "4.3.0", 408 | "contentHash": "j8GUkCpM8V4d4vhLIIoBLGey2Z5bCkMVNjEZseyAlm4n5arcsJOeI3zkUP+zvZgzsbLTYh4lYeP/ZD/gdIAPrw==", 409 | "dependencies": { 410 | "System.ComponentModel": "4.3.0", 411 | "System.Resources.ResourceManager": "4.3.0", 412 | "System.Runtime": "4.3.0" 413 | } 414 | }, 415 | "System.ComponentModel.TypeConverter": { 416 | "type": "Transitive", 417 | "resolved": "4.3.0", 418 | "contentHash": "16pQ6P+EdhcXzPiEK4kbA953Fu0MNG2ovxTZU81/qsCd1zPRsKc3uif5NgvllCY598k6bI0KUyKW8fanlfaDQg==", 419 | "dependencies": { 420 | "System.Collections": "4.3.0", 421 | "System.Collections.NonGeneric": "4.3.0", 422 | "System.Collections.Specialized": "4.3.0", 423 | "System.ComponentModel": "4.3.0", 424 | "System.ComponentModel.Primitives": "4.3.0", 425 | "System.Globalization": "4.3.0", 426 | "System.Linq": "4.3.0", 427 | "System.Reflection": "4.3.0", 428 | "System.Reflection.Extensions": "4.3.0", 429 | "System.Reflection.Primitives": "4.3.0", 430 | "System.Reflection.TypeExtensions": "4.3.0", 431 | "System.Resources.ResourceManager": "4.3.0", 432 | "System.Runtime": "4.3.0", 433 | "System.Runtime.Extensions": "4.3.0", 434 | "System.Threading": "4.3.0" 435 | } 436 | }, 437 | "System.Console": { 438 | "type": "Transitive", 439 | "resolved": "4.3.0", 440 | "contentHash": "DHDrIxiqk1h03m6khKWV2X8p/uvN79rgSqpilL6uzpmSfxfU5ng8VcPtW4qsDsQDHiTv6IPV9TmD5M/vElPNLg==", 441 | "dependencies": { 442 | "Microsoft.NETCore.Platforms": "1.1.0", 443 | "Microsoft.NETCore.Targets": "1.1.0", 444 | "System.IO": "4.3.0", 445 | "System.Runtime": "4.3.0", 446 | "System.Text.Encoding": "4.3.0" 447 | } 448 | }, 449 | "System.Diagnostics.Debug": { 450 | "type": "Transitive", 451 | "resolved": "4.3.0", 452 | "contentHash": "ZUhUOdqmaG5Jk3Xdb8xi5kIyQYAA4PnTNlHx1mu9ZY3qv4ELIdKbnL/akbGaKi2RnNUWaZsAs31rvzFdewTj2g==", 453 | "dependencies": { 454 | "Microsoft.NETCore.Platforms": "1.1.0", 455 | "Microsoft.NETCore.Targets": "1.1.0", 456 | "System.Runtime": "4.3.0" 457 | } 458 | }, 459 | "System.Diagnostics.DiagnosticSource": { 460 | "type": "Transitive", 461 | "resolved": "4.3.0", 462 | "contentHash": "tD6kosZnTAGdrEa0tZSuFyunMbt/5KYDnHdndJYGqZoNy00XVXyACd5d6KnE1YgYv3ne2CjtAfNXo/fwEhnKUA==", 463 | "dependencies": { 464 | "System.Collections": "4.3.0", 465 | "System.Diagnostics.Tracing": "4.3.0", 466 | "System.Reflection": "4.3.0", 467 | "System.Runtime": "4.3.0", 468 | "System.Threading": "4.3.0" 469 | } 470 | }, 471 | "System.Diagnostics.Tools": { 472 | "type": "Transitive", 473 | "resolved": "4.3.0", 474 | "contentHash": "UUvkJfSYJMM6x527dJg2VyWPSRqIVB0Z7dbjHst1zmwTXz5CcXSYJFWRpuigfbO1Lf7yfZiIaEUesfnl/g5EyA==", 475 | "dependencies": { 476 | "Microsoft.NETCore.Platforms": "1.1.0", 477 | "Microsoft.NETCore.Targets": "1.1.0", 478 | "System.Runtime": "4.3.0" 479 | } 480 | }, 481 | "System.Diagnostics.TraceSource": { 482 | "type": "Transitive", 483 | "resolved": "4.3.0", 484 | "contentHash": "VnYp1NxGx8Ww731y2LJ1vpfb/DKVNKEZ8Jsh5SgQTZREL/YpWRArgh9pI8CDLmgHspZmLL697CaLvH85qQpRiw==", 485 | "dependencies": { 486 | "Microsoft.NETCore.Platforms": "1.1.0", 487 | "System.Collections": "4.3.0", 488 | "System.Diagnostics.Debug": "4.3.0", 489 | "System.Globalization": "4.3.0", 490 | "System.Resources.ResourceManager": "4.3.0", 491 | "System.Runtime": "4.3.0", 492 | "System.Runtime.Extensions": "4.3.0", 493 | "System.Threading": "4.3.0", 494 | "runtime.native.System": "4.3.0" 495 | } 496 | }, 497 | "System.Diagnostics.Tracing": { 498 | "type": "Transitive", 499 | "resolved": "4.3.0", 500 | "contentHash": "rswfv0f/Cqkh78rA5S8eN8Neocz234+emGCtTF3lxPY96F+mmmUen6tbn0glN6PMvlKQb9bPAY5e9u7fgPTkKw==", 501 | "dependencies": { 502 | "Microsoft.NETCore.Platforms": "1.1.0", 503 | "Microsoft.NETCore.Targets": "1.1.0", 504 | "System.Runtime": "4.3.0" 505 | } 506 | }, 507 | "System.Dynamic.Runtime": { 508 | "type": "Transitive", 509 | "resolved": "4.3.0", 510 | "contentHash": "SNVi1E/vfWUAs/WYKhE9+qlS6KqK0YVhnlT0HQtr8pMIA8YX3lwy3uPMownDwdYISBdmAF/2holEIldVp85Wag==", 511 | "dependencies": { 512 | "System.Collections": "4.3.0", 513 | "System.Diagnostics.Debug": "4.3.0", 514 | "System.Linq": "4.3.0", 515 | "System.Linq.Expressions": "4.3.0", 516 | "System.ObjectModel": "4.3.0", 517 | "System.Reflection": "4.3.0", 518 | "System.Reflection.Emit": "4.3.0", 519 | "System.Reflection.Emit.ILGeneration": "4.3.0", 520 | "System.Reflection.Primitives": "4.3.0", 521 | "System.Reflection.TypeExtensions": "4.3.0", 522 | "System.Resources.ResourceManager": "4.3.0", 523 | "System.Runtime": "4.3.0", 524 | "System.Runtime.Extensions": "4.3.0", 525 | "System.Threading": "4.3.0" 526 | } 527 | }, 528 | "System.Globalization": { 529 | "type": "Transitive", 530 | "resolved": "4.3.0", 531 | "contentHash": "kYdVd2f2PAdFGblzFswE4hkNANJBKRmsfa2X5LG2AcWE1c7/4t0pYae1L8vfZ5xvE2nK/R9JprtToA61OSHWIg==", 532 | "dependencies": { 533 | "Microsoft.NETCore.Platforms": "1.1.0", 534 | "Microsoft.NETCore.Targets": "1.1.0", 535 | "System.Runtime": "4.3.0" 536 | } 537 | }, 538 | "System.Globalization.Calendars": { 539 | "type": "Transitive", 540 | "resolved": "4.3.0", 541 | "contentHash": "GUlBtdOWT4LTV3I+9/PJW+56AnnChTaOqqTLFtdmype/L500M2LIyXgmtd9X2P2VOkmJd5c67H5SaC2QcL1bFA==", 542 | "dependencies": { 543 | "Microsoft.NETCore.Platforms": "1.1.0", 544 | "Microsoft.NETCore.Targets": "1.1.0", 545 | "System.Globalization": "4.3.0", 546 | "System.Runtime": "4.3.0" 547 | } 548 | }, 549 | "System.Globalization.Extensions": { 550 | "type": "Transitive", 551 | "resolved": "4.3.0", 552 | "contentHash": "FhKmdR6MPG+pxow6wGtNAWdZh7noIOpdD5TwQ3CprzgIE1bBBoim0vbR1+AWsWjQmU7zXHgQo4TWSP6lCeiWcQ==", 553 | "dependencies": { 554 | "Microsoft.NETCore.Platforms": "1.1.0", 555 | "System.Globalization": "4.3.0", 556 | "System.Resources.ResourceManager": "4.3.0", 557 | "System.Runtime": "4.3.0", 558 | "System.Runtime.Extensions": "4.3.0", 559 | "System.Runtime.InteropServices": "4.3.0" 560 | } 561 | }, 562 | "System.IO": { 563 | "type": "Transitive", 564 | "resolved": "4.3.0", 565 | "contentHash": "3qjaHvxQPDpSOYICjUoTsmoq5u6QJAFRUITgeT/4gqkF1bajbSmb1kwSxEA8AHlofqgcKJcM8udgieRNhaJ5Cg==", 566 | "dependencies": { 567 | "Microsoft.NETCore.Platforms": "1.1.0", 568 | "Microsoft.NETCore.Targets": "1.1.0", 569 | "System.Runtime": "4.3.0", 570 | "System.Text.Encoding": "4.3.0", 571 | "System.Threading.Tasks": "4.3.0" 572 | } 573 | }, 574 | "System.IO.Compression": { 575 | "type": "Transitive", 576 | "resolved": "4.3.0", 577 | "contentHash": "YHndyoiV90iu4iKG115ibkhrG+S3jBm8Ap9OwoUAzO5oPDAWcr0SFwQFm0HjM8WkEZWo0zvLTyLmbvTkW1bXgg==", 578 | "dependencies": { 579 | "Microsoft.NETCore.Platforms": "1.1.0", 580 | "System.Buffers": "4.3.0", 581 | "System.Collections": "4.3.0", 582 | "System.Diagnostics.Debug": "4.3.0", 583 | "System.IO": "4.3.0", 584 | "System.Resources.ResourceManager": "4.3.0", 585 | "System.Runtime": "4.3.0", 586 | "System.Runtime.Extensions": "4.3.0", 587 | "System.Runtime.Handles": "4.3.0", 588 | "System.Runtime.InteropServices": "4.3.0", 589 | "System.Text.Encoding": "4.3.0", 590 | "System.Threading": "4.3.0", 591 | "System.Threading.Tasks": "4.3.0", 592 | "runtime.native.System": "4.3.0", 593 | "runtime.native.System.IO.Compression": "4.3.0" 594 | } 595 | }, 596 | "System.IO.Compression.ZipFile": { 597 | "type": "Transitive", 598 | "resolved": "4.3.0", 599 | "contentHash": "G4HwjEsgIwy3JFBduZ9quBkAu+eUwjIdJleuNSgmUojbH6O3mlvEIme+GHx/cLlTAPcrnnL7GqvB9pTlWRfhOg==", 600 | "dependencies": { 601 | "System.Buffers": "4.3.0", 602 | "System.IO": "4.3.0", 603 | "System.IO.Compression": "4.3.0", 604 | "System.IO.FileSystem": "4.3.0", 605 | "System.IO.FileSystem.Primitives": "4.3.0", 606 | "System.Resources.ResourceManager": "4.3.0", 607 | "System.Runtime": "4.3.0", 608 | "System.Runtime.Extensions": "4.3.0", 609 | "System.Text.Encoding": "4.3.0" 610 | } 611 | }, 612 | "System.IO.FileSystem": { 613 | "type": "Transitive", 614 | "resolved": "4.3.0", 615 | "contentHash": "3wEMARTnuio+ulnvi+hkRNROYwa1kylvYahhcLk4HSoVdl+xxTFVeVlYOfLwrDPImGls0mDqbMhrza8qnWPTdA==", 616 | "dependencies": { 617 | "Microsoft.NETCore.Platforms": "1.1.0", 618 | "Microsoft.NETCore.Targets": "1.1.0", 619 | "System.IO": "4.3.0", 620 | "System.IO.FileSystem.Primitives": "4.3.0", 621 | "System.Runtime": "4.3.0", 622 | "System.Runtime.Handles": "4.3.0", 623 | "System.Text.Encoding": "4.3.0", 624 | "System.Threading.Tasks": "4.3.0" 625 | } 626 | }, 627 | "System.IO.FileSystem.Primitives": { 628 | "type": "Transitive", 629 | "resolved": "4.3.0", 630 | "contentHash": "6QOb2XFLch7bEc4lIcJH49nJN2HV+OC3fHDgsLVsBVBk3Y4hFAnOBGzJ2lUu7CyDDFo9IBWkSsnbkT6IBwwiMw==", 631 | "dependencies": { 632 | "System.Runtime": "4.3.0" 633 | } 634 | }, 635 | "System.Linq": { 636 | "type": "Transitive", 637 | "resolved": "4.3.0", 638 | "contentHash": "5DbqIUpsDp0dFftytzuMmc0oeMdQwjcP/EWxsksIz/w1TcFRkZ3yKKz0PqiYFMmEwPSWw+qNVqD7PJ889JzHbw==", 639 | "dependencies": { 640 | "System.Collections": "4.3.0", 641 | "System.Diagnostics.Debug": "4.3.0", 642 | "System.Resources.ResourceManager": "4.3.0", 643 | "System.Runtime": "4.3.0", 644 | "System.Runtime.Extensions": "4.3.0" 645 | } 646 | }, 647 | "System.Linq.Expressions": { 648 | "type": "Transitive", 649 | "resolved": "4.3.0", 650 | "contentHash": "PGKkrd2khG4CnlyJwxwwaWWiSiWFNBGlgXvJpeO0xCXrZ89ODrQ6tjEWS/kOqZ8GwEOUATtKtzp1eRgmYNfclg==", 651 | "dependencies": { 652 | "System.Collections": "4.3.0", 653 | "System.Diagnostics.Debug": "4.3.0", 654 | "System.Globalization": "4.3.0", 655 | "System.IO": "4.3.0", 656 | "System.Linq": "4.3.0", 657 | "System.ObjectModel": "4.3.0", 658 | "System.Reflection": "4.3.0", 659 | "System.Reflection.Emit": "4.3.0", 660 | "System.Reflection.Emit.ILGeneration": "4.3.0", 661 | "System.Reflection.Emit.Lightweight": "4.3.0", 662 | "System.Reflection.Extensions": "4.3.0", 663 | "System.Reflection.Primitives": "4.3.0", 664 | "System.Reflection.TypeExtensions": "4.3.0", 665 | "System.Resources.ResourceManager": "4.3.0", 666 | "System.Runtime": "4.3.0", 667 | "System.Runtime.Extensions": "4.3.0", 668 | "System.Threading": "4.3.0" 669 | } 670 | }, 671 | "System.Net.Http": { 672 | "type": "Transitive", 673 | "resolved": "4.3.0", 674 | "contentHash": "sYg+FtILtRQuYWSIAuNOELwVuVsxVyJGWQyOnlAzhV4xvhyFnON1bAzYYC+jjRW8JREM45R0R5Dgi8MTC5sEwA==", 675 | "dependencies": { 676 | "Microsoft.NETCore.Platforms": "1.1.0", 677 | "System.Collections": "4.3.0", 678 | "System.Diagnostics.Debug": "4.3.0", 679 | "System.Diagnostics.DiagnosticSource": "4.3.0", 680 | "System.Diagnostics.Tracing": "4.3.0", 681 | "System.Globalization": "4.3.0", 682 | "System.Globalization.Extensions": "4.3.0", 683 | "System.IO": "4.3.0", 684 | "System.IO.FileSystem": "4.3.0", 685 | "System.Net.Primitives": "4.3.0", 686 | "System.Resources.ResourceManager": "4.3.0", 687 | "System.Runtime": "4.3.0", 688 | "System.Runtime.Extensions": "4.3.0", 689 | "System.Runtime.Handles": "4.3.0", 690 | "System.Runtime.InteropServices": "4.3.0", 691 | "System.Security.Cryptography.Algorithms": "4.3.0", 692 | "System.Security.Cryptography.Encoding": "4.3.0", 693 | "System.Security.Cryptography.OpenSsl": "4.3.0", 694 | "System.Security.Cryptography.Primitives": "4.3.0", 695 | "System.Security.Cryptography.X509Certificates": "4.3.0", 696 | "System.Text.Encoding": "4.3.0", 697 | "System.Threading": "4.3.0", 698 | "System.Threading.Tasks": "4.3.0", 699 | "runtime.native.System": "4.3.0", 700 | "runtime.native.System.Net.Http": "4.3.0", 701 | "runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0" 702 | } 703 | }, 704 | "System.Net.Primitives": { 705 | "type": "Transitive", 706 | "resolved": "4.3.0", 707 | "contentHash": "qOu+hDwFwoZPbzPvwut2qATe3ygjeQBDQj91xlsaqGFQUI5i4ZnZb8yyQuLGpDGivEPIt8EJkd1BVzVoP31FXA==", 708 | "dependencies": { 709 | "Microsoft.NETCore.Platforms": "1.1.0", 710 | "Microsoft.NETCore.Targets": "1.1.0", 711 | "System.Runtime": "4.3.0", 712 | "System.Runtime.Handles": "4.3.0" 713 | } 714 | }, 715 | "System.Net.Sockets": { 716 | "type": "Transitive", 717 | "resolved": "4.3.0", 718 | "contentHash": "m6icV6TqQOAdgt5N/9I5KNpjom/5NFtkmGseEH+AK/hny8XrytLH3+b5M8zL/Ycg3fhIocFpUMyl/wpFnVRvdw==", 719 | "dependencies": { 720 | "Microsoft.NETCore.Platforms": "1.1.0", 721 | "Microsoft.NETCore.Targets": "1.1.0", 722 | "System.IO": "4.3.0", 723 | "System.Net.Primitives": "4.3.0", 724 | "System.Runtime": "4.3.0", 725 | "System.Threading.Tasks": "4.3.0" 726 | } 727 | }, 728 | "System.ObjectModel": { 729 | "type": "Transitive", 730 | "resolved": "4.3.0", 731 | "contentHash": "bdX+80eKv9bN6K4N+d77OankKHGn6CH711a6fcOpMQu2Fckp/Ft4L/kW9WznHpyR0NRAvJutzOMHNNlBGvxQzQ==", 732 | "dependencies": { 733 | "System.Collections": "4.3.0", 734 | "System.Diagnostics.Debug": "4.3.0", 735 | "System.Resources.ResourceManager": "4.3.0", 736 | "System.Runtime": "4.3.0", 737 | "System.Threading": "4.3.0" 738 | } 739 | }, 740 | "System.Reflection": { 741 | "type": "Transitive", 742 | "resolved": "4.3.0", 743 | "contentHash": "KMiAFoW7MfJGa9nDFNcfu+FpEdiHpWgTcS2HdMpDvt9saK3y/G4GwprPyzqjFH9NTaGPQeWNHU+iDlDILj96aQ==", 744 | "dependencies": { 745 | "Microsoft.NETCore.Platforms": "1.1.0", 746 | "Microsoft.NETCore.Targets": "1.1.0", 747 | "System.IO": "4.3.0", 748 | "System.Reflection.Primitives": "4.3.0", 749 | "System.Runtime": "4.3.0" 750 | } 751 | }, 752 | "System.Reflection.Emit": { 753 | "type": "Transitive", 754 | "resolved": "4.3.0", 755 | "contentHash": "228FG0jLcIwTVJyz8CLFKueVqQK36ANazUManGaJHkO0icjiIypKW7YLWLIWahyIkdh5M7mV2dJepllLyA1SKg==", 756 | "dependencies": { 757 | "System.IO": "4.3.0", 758 | "System.Reflection": "4.3.0", 759 | "System.Reflection.Emit.ILGeneration": "4.3.0", 760 | "System.Reflection.Primitives": "4.3.0", 761 | "System.Runtime": "4.3.0" 762 | } 763 | }, 764 | "System.Reflection.Emit.ILGeneration": { 765 | "type": "Transitive", 766 | "resolved": "4.3.0", 767 | "contentHash": "59tBslAk9733NXLrUJrwNZEzbMAcu8k344OYo+wfSVygcgZ9lgBdGIzH/nrg3LYhXceynyvTc8t5/GD4Ri0/ng==", 768 | "dependencies": { 769 | "System.Reflection": "4.3.0", 770 | "System.Reflection.Primitives": "4.3.0", 771 | "System.Runtime": "4.3.0" 772 | } 773 | }, 774 | "System.Reflection.Emit.Lightweight": { 775 | "type": "Transitive", 776 | "resolved": "4.3.0", 777 | "contentHash": "oadVHGSMsTmZsAF864QYN1t1QzZjIcuKU3l2S9cZOwDdDueNTrqq1yRj7koFfIGEnKpt6NjpL3rOzRhs4ryOgA==", 778 | "dependencies": { 779 | "System.Reflection": "4.3.0", 780 | "System.Reflection.Emit.ILGeneration": "4.3.0", 781 | "System.Reflection.Primitives": "4.3.0", 782 | "System.Runtime": "4.3.0" 783 | } 784 | }, 785 | "System.Reflection.Extensions": { 786 | "type": "Transitive", 787 | "resolved": "4.3.0", 788 | "contentHash": "rJkrJD3kBI5B712aRu4DpSIiHRtr6QlfZSQsb0hYHrDCZORXCFjQfoipo2LaMUHoT9i1B7j7MnfaEKWDFmFQNQ==", 789 | "dependencies": { 790 | "Microsoft.NETCore.Platforms": "1.1.0", 791 | "Microsoft.NETCore.Targets": "1.1.0", 792 | "System.Reflection": "4.3.0", 793 | "System.Runtime": "4.3.0" 794 | } 795 | }, 796 | "System.Reflection.Metadata": { 797 | "type": "Transitive", 798 | "resolved": "1.6.0", 799 | "contentHash": "COC1aiAJjCoA5GBF+QKL2uLqEBew4JsCkQmoHKbN3TlOZKa2fKLz5CpiRQKDz0RsAOEGsVKqOD5bomsXq/4STQ==" 800 | }, 801 | "System.Reflection.Primitives": { 802 | "type": "Transitive", 803 | "resolved": "4.3.0", 804 | "contentHash": "5RXItQz5As4xN2/YUDxdpsEkMhvw3e6aNveFXUn4Hl/udNTCNhnKp8lT9fnc3MhvGKh1baak5CovpuQUXHAlIA==", 805 | "dependencies": { 806 | "Microsoft.NETCore.Platforms": "1.1.0", 807 | "Microsoft.NETCore.Targets": "1.1.0", 808 | "System.Runtime": "4.3.0" 809 | } 810 | }, 811 | "System.Reflection.TypeExtensions": { 812 | "type": "Transitive", 813 | "resolved": "4.3.0", 814 | "contentHash": "7u6ulLcZbyxB5Gq0nMkQttcdBTx57ibzw+4IOXEfR+sXYQoHvjW5LTLyNr8O22UIMrqYbchJQJnos4eooYzYJA==", 815 | "dependencies": { 816 | "System.Reflection": "4.3.0", 817 | "System.Runtime": "4.3.0" 818 | } 819 | }, 820 | "System.Resources.ResourceManager": { 821 | "type": "Transitive", 822 | "resolved": "4.3.0", 823 | "contentHash": "/zrcPkkWdZmI4F92gL/TPumP98AVDu/Wxr3CSJGQQ+XN6wbRZcyfSKVoPo17ilb3iOr0cCRqJInGwNMolqhS8A==", 824 | "dependencies": { 825 | "Microsoft.NETCore.Platforms": "1.1.0", 826 | "Microsoft.NETCore.Targets": "1.1.0", 827 | "System.Globalization": "4.3.0", 828 | "System.Reflection": "4.3.0", 829 | "System.Runtime": "4.3.0" 830 | } 831 | }, 832 | "System.Runtime": { 833 | "type": "Transitive", 834 | "resolved": "4.3.0", 835 | "contentHash": "JufQi0vPQ0xGnAczR13AUFglDyVYt4Kqnz1AZaiKZ5+GICq0/1MH/mO/eAJHt/mHW1zjKBJd7kV26SrxddAhiw==", 836 | "dependencies": { 837 | "Microsoft.NETCore.Platforms": "1.1.0", 838 | "Microsoft.NETCore.Targets": "1.1.0" 839 | } 840 | }, 841 | "System.Runtime.Extensions": { 842 | "type": "Transitive", 843 | "resolved": "4.3.0", 844 | "contentHash": "guW0uK0fn5fcJJ1tJVXYd7/1h5F+pea1r7FLSOz/f8vPEqbR2ZAknuRDvTQ8PzAilDveOxNjSfr0CHfIQfFk8g==", 845 | "dependencies": { 846 | "Microsoft.NETCore.Platforms": "1.1.0", 847 | "Microsoft.NETCore.Targets": "1.1.0", 848 | "System.Runtime": "4.3.0" 849 | } 850 | }, 851 | "System.Runtime.Handles": { 852 | "type": "Transitive", 853 | "resolved": "4.3.0", 854 | "contentHash": "OKiSUN7DmTWeYb3l51A7EYaeNMnvxwE249YtZz7yooT4gOZhmTjIn48KgSsw2k2lYdLgTKNJw/ZIfSElwDRVgg==", 855 | "dependencies": { 856 | "Microsoft.NETCore.Platforms": "1.1.0", 857 | "Microsoft.NETCore.Targets": "1.1.0", 858 | "System.Runtime": "4.3.0" 859 | } 860 | }, 861 | "System.Runtime.InteropServices": { 862 | "type": "Transitive", 863 | "resolved": "4.3.0", 864 | "contentHash": "uv1ynXqiMK8mp1GM3jDqPCFN66eJ5w5XNomaK2XD+TuCroNTLFGeZ+WCmBMcBDyTFKou3P6cR6J/QsaqDp7fGQ==", 865 | "dependencies": { 866 | "Microsoft.NETCore.Platforms": "1.1.0", 867 | "Microsoft.NETCore.Targets": "1.1.0", 868 | "System.Reflection": "4.3.0", 869 | "System.Reflection.Primitives": "4.3.0", 870 | "System.Runtime": "4.3.0", 871 | "System.Runtime.Handles": "4.3.0" 872 | } 873 | }, 874 | "System.Runtime.InteropServices.RuntimeInformation": { 875 | "type": "Transitive", 876 | "resolved": "4.3.0", 877 | "contentHash": "cbz4YJMqRDR7oLeMRbdYv7mYzc++17lNhScCX0goO2XpGWdvAt60CGN+FHdePUEHCe/Jy9jUlvNAiNdM+7jsOw==", 878 | "dependencies": { 879 | "System.Reflection": "4.3.0", 880 | "System.Reflection.Extensions": "4.3.0", 881 | "System.Resources.ResourceManager": "4.3.0", 882 | "System.Runtime": "4.3.0", 883 | "System.Runtime.InteropServices": "4.3.0", 884 | "System.Threading": "4.3.0", 885 | "runtime.native.System": "4.3.0" 886 | } 887 | }, 888 | "System.Runtime.Numerics": { 889 | "type": "Transitive", 890 | "resolved": "4.3.0", 891 | "contentHash": "yMH+MfdzHjy17l2KESnPiF2dwq7T+xLnSJar7slyimAkUh/gTrS9/UQOtv7xarskJ2/XDSNvfLGOBQPjL7PaHQ==", 892 | "dependencies": { 893 | "System.Globalization": "4.3.0", 894 | "System.Resources.ResourceManager": "4.3.0", 895 | "System.Runtime": "4.3.0", 896 | "System.Runtime.Extensions": "4.3.0" 897 | } 898 | }, 899 | "System.Runtime.Serialization.Primitives": { 900 | "type": "Transitive", 901 | "resolved": "4.1.1", 902 | "contentHash": "HZ6Du5QrTG8MNJbf4e4qMO3JRAkIboGT5Fk804uZtg3Gq516S7hAqTm2UZKUHa7/6HUGdVy3AqMQKbns06G/cg==", 903 | "dependencies": { 904 | "System.Resources.ResourceManager": "4.0.1", 905 | "System.Runtime": "4.1.0" 906 | } 907 | }, 908 | "System.Security.Cryptography.Algorithms": { 909 | "type": "Transitive", 910 | "resolved": "4.3.0", 911 | "contentHash": "W1kd2Y8mYSCgc3ULTAZ0hOP2dSdG5YauTb1089T0/kRcN2MpSAW1izOFROrJgxSlMn3ArsgHXagigyi+ibhevg==", 912 | "dependencies": { 913 | "Microsoft.NETCore.Platforms": "1.1.0", 914 | "System.Collections": "4.3.0", 915 | "System.IO": "4.3.0", 916 | "System.Resources.ResourceManager": "4.3.0", 917 | "System.Runtime": "4.3.0", 918 | "System.Runtime.Extensions": "4.3.0", 919 | "System.Runtime.Handles": "4.3.0", 920 | "System.Runtime.InteropServices": "4.3.0", 921 | "System.Runtime.Numerics": "4.3.0", 922 | "System.Security.Cryptography.Encoding": "4.3.0", 923 | "System.Security.Cryptography.Primitives": "4.3.0", 924 | "System.Text.Encoding": "4.3.0", 925 | "runtime.native.System.Security.Cryptography.Apple": "4.3.0", 926 | "runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0" 927 | } 928 | }, 929 | "System.Security.Cryptography.Cng": { 930 | "type": "Transitive", 931 | "resolved": "4.3.0", 932 | "contentHash": "03idZOqFlsKRL4W+LuCpJ6dBYDUWReug6lZjBa3uJWnk5sPCUXckocevTaUA8iT/MFSrY/2HXkOt753xQ/cf8g==", 933 | "dependencies": { 934 | "Microsoft.NETCore.Platforms": "1.1.0", 935 | "System.IO": "4.3.0", 936 | "System.Resources.ResourceManager": "4.3.0", 937 | "System.Runtime": "4.3.0", 938 | "System.Runtime.Extensions": "4.3.0", 939 | "System.Runtime.Handles": "4.3.0", 940 | "System.Runtime.InteropServices": "4.3.0", 941 | "System.Security.Cryptography.Algorithms": "4.3.0", 942 | "System.Security.Cryptography.Encoding": "4.3.0", 943 | "System.Security.Cryptography.Primitives": "4.3.0", 944 | "System.Text.Encoding": "4.3.0" 945 | } 946 | }, 947 | "System.Security.Cryptography.Csp": { 948 | "type": "Transitive", 949 | "resolved": "4.3.0", 950 | "contentHash": "X4s/FCkEUnRGnwR3aSfVIkldBmtURMhmexALNTwpjklzxWU7yjMk7GHLKOZTNkgnWnE0q7+BCf9N2LVRWxewaA==", 951 | "dependencies": { 952 | "Microsoft.NETCore.Platforms": "1.1.0", 953 | "System.IO": "4.3.0", 954 | "System.Reflection": "4.3.0", 955 | "System.Resources.ResourceManager": "4.3.0", 956 | "System.Runtime": "4.3.0", 957 | "System.Runtime.Extensions": "4.3.0", 958 | "System.Runtime.Handles": "4.3.0", 959 | "System.Runtime.InteropServices": "4.3.0", 960 | "System.Security.Cryptography.Algorithms": "4.3.0", 961 | "System.Security.Cryptography.Encoding": "4.3.0", 962 | "System.Security.Cryptography.Primitives": "4.3.0", 963 | "System.Text.Encoding": "4.3.0", 964 | "System.Threading": "4.3.0" 965 | } 966 | }, 967 | "System.Security.Cryptography.Encoding": { 968 | "type": "Transitive", 969 | "resolved": "4.3.0", 970 | "contentHash": "1DEWjZZly9ae9C79vFwqaO5kaOlI5q+3/55ohmq/7dpDyDfc8lYe7YVxJUZ5MF/NtbkRjwFRo14yM4OEo9EmDw==", 971 | "dependencies": { 972 | "Microsoft.NETCore.Platforms": "1.1.0", 973 | "System.Collections": "4.3.0", 974 | "System.Collections.Concurrent": "4.3.0", 975 | "System.Linq": "4.3.0", 976 | "System.Resources.ResourceManager": "4.3.0", 977 | "System.Runtime": "4.3.0", 978 | "System.Runtime.Extensions": "4.3.0", 979 | "System.Runtime.Handles": "4.3.0", 980 | "System.Runtime.InteropServices": "4.3.0", 981 | "System.Security.Cryptography.Primitives": "4.3.0", 982 | "System.Text.Encoding": "4.3.0", 983 | "runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0" 984 | } 985 | }, 986 | "System.Security.Cryptography.OpenSsl": { 987 | "type": "Transitive", 988 | "resolved": "4.3.0", 989 | "contentHash": "h4CEgOgv5PKVF/HwaHzJRiVboL2THYCou97zpmhjghx5frc7fIvlkY1jL+lnIQyChrJDMNEXS6r7byGif8Cy4w==", 990 | "dependencies": { 991 | "System.Collections": "4.3.0", 992 | "System.IO": "4.3.0", 993 | "System.Resources.ResourceManager": "4.3.0", 994 | "System.Runtime": "4.3.0", 995 | "System.Runtime.Extensions": "4.3.0", 996 | "System.Runtime.Handles": "4.3.0", 997 | "System.Runtime.InteropServices": "4.3.0", 998 | "System.Runtime.Numerics": "4.3.0", 999 | "System.Security.Cryptography.Algorithms": "4.3.0", 1000 | "System.Security.Cryptography.Encoding": "4.3.0", 1001 | "System.Security.Cryptography.Primitives": "4.3.0", 1002 | "System.Text.Encoding": "4.3.0", 1003 | "runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0" 1004 | } 1005 | }, 1006 | "System.Security.Cryptography.Primitives": { 1007 | "type": "Transitive", 1008 | "resolved": "4.3.0", 1009 | "contentHash": "7bDIyVFNL/xKeFHjhobUAQqSpJq9YTOpbEs6mR233Et01STBMXNAc/V+BM6dwYGc95gVh/Zf+iVXWzj3mE8DWg==", 1010 | "dependencies": { 1011 | "System.Diagnostics.Debug": "4.3.0", 1012 | "System.Globalization": "4.3.0", 1013 | "System.IO": "4.3.0", 1014 | "System.Resources.ResourceManager": "4.3.0", 1015 | "System.Runtime": "4.3.0", 1016 | "System.Threading": "4.3.0", 1017 | "System.Threading.Tasks": "4.3.0" 1018 | } 1019 | }, 1020 | "System.Security.Cryptography.X509Certificates": { 1021 | "type": "Transitive", 1022 | "resolved": "4.3.0", 1023 | "contentHash": "t2Tmu6Y2NtJ2um0RtcuhP7ZdNNxXEgUm2JeoA/0NvlMjAhKCnM1NX07TDl3244mVp3QU6LPEhT3HTtH1uF7IYw==", 1024 | "dependencies": { 1025 | "Microsoft.NETCore.Platforms": "1.1.0", 1026 | "System.Collections": "4.3.0", 1027 | "System.Diagnostics.Debug": "4.3.0", 1028 | "System.Globalization": "4.3.0", 1029 | "System.Globalization.Calendars": "4.3.0", 1030 | "System.IO": "4.3.0", 1031 | "System.IO.FileSystem": "4.3.0", 1032 | "System.IO.FileSystem.Primitives": "4.3.0", 1033 | "System.Resources.ResourceManager": "4.3.0", 1034 | "System.Runtime": "4.3.0", 1035 | "System.Runtime.Extensions": "4.3.0", 1036 | "System.Runtime.Handles": "4.3.0", 1037 | "System.Runtime.InteropServices": "4.3.0", 1038 | "System.Runtime.Numerics": "4.3.0", 1039 | "System.Security.Cryptography.Algorithms": "4.3.0", 1040 | "System.Security.Cryptography.Cng": "4.3.0", 1041 | "System.Security.Cryptography.Csp": "4.3.0", 1042 | "System.Security.Cryptography.Encoding": "4.3.0", 1043 | "System.Security.Cryptography.OpenSsl": "4.3.0", 1044 | "System.Security.Cryptography.Primitives": "4.3.0", 1045 | "System.Text.Encoding": "4.3.0", 1046 | "System.Threading": "4.3.0", 1047 | "runtime.native.System": "4.3.0", 1048 | "runtime.native.System.Net.Http": "4.3.0", 1049 | "runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0" 1050 | } 1051 | }, 1052 | "System.Text.Encoding": { 1053 | "type": "Transitive", 1054 | "resolved": "4.3.0", 1055 | "contentHash": "BiIg+KWaSDOITze6jGQynxg64naAPtqGHBwDrLaCtixsa5bKiR8dpPOHA7ge3C0JJQizJE+sfkz1wV+BAKAYZw==", 1056 | "dependencies": { 1057 | "Microsoft.NETCore.Platforms": "1.1.0", 1058 | "Microsoft.NETCore.Targets": "1.1.0", 1059 | "System.Runtime": "4.3.0" 1060 | } 1061 | }, 1062 | "System.Text.Encoding.Extensions": { 1063 | "type": "Transitive", 1064 | "resolved": "4.3.0", 1065 | "contentHash": "YVMK0Bt/A43RmwizJoZ22ei2nmrhobgeiYwFzC4YAN+nue8RF6djXDMog0UCn+brerQoYVyaS+ghy9P/MUVcmw==", 1066 | "dependencies": { 1067 | "Microsoft.NETCore.Platforms": "1.1.0", 1068 | "Microsoft.NETCore.Targets": "1.1.0", 1069 | "System.Runtime": "4.3.0", 1070 | "System.Text.Encoding": "4.3.0" 1071 | } 1072 | }, 1073 | "System.Text.RegularExpressions": { 1074 | "type": "Transitive", 1075 | "resolved": "4.3.0", 1076 | "contentHash": "RpT2DA+L660cBt1FssIE9CAGpLFdFPuheB7pLpKpn6ZXNby7jDERe8Ua/Ne2xGiwLVG2JOqziiaVCGDon5sKFA==", 1077 | "dependencies": { 1078 | "System.Runtime": "4.3.0" 1079 | } 1080 | }, 1081 | "System.Threading": { 1082 | "type": "Transitive", 1083 | "resolved": "4.3.0", 1084 | "contentHash": "VkUS0kOBcUf3Wwm0TSbrevDDZ6BlM+b/HRiapRFWjM5O0NS0LviG0glKmFK+hhPDd1XFeSdU1GmlLhb2CoVpIw==", 1085 | "dependencies": { 1086 | "System.Runtime": "4.3.0", 1087 | "System.Threading.Tasks": "4.3.0" 1088 | } 1089 | }, 1090 | "System.Threading.Tasks": { 1091 | "type": "Transitive", 1092 | "resolved": "4.3.0", 1093 | "contentHash": "LbSxKEdOUhVe8BezB/9uOGGppt+nZf6e1VFyw6v3DN6lqitm0OSn2uXMOdtP0M3W4iMcqcivm2J6UgqiwwnXiA==", 1094 | "dependencies": { 1095 | "Microsoft.NETCore.Platforms": "1.1.0", 1096 | "Microsoft.NETCore.Targets": "1.1.0", 1097 | "System.Runtime": "4.3.0" 1098 | } 1099 | }, 1100 | "System.Threading.Tasks.Extensions": { 1101 | "type": "Transitive", 1102 | "resolved": "4.5.4", 1103 | "contentHash": "zteT+G8xuGu6mS+mzDzYXbzS7rd3K6Fjb9RiZlYlJPam2/hU7JCBZBVEcywNuR+oZ1ncTvc/cq0faRr3P01OVg==" 1104 | }, 1105 | "System.Threading.Timer": { 1106 | "type": "Transitive", 1107 | "resolved": "4.3.0", 1108 | "contentHash": "Z6YfyYTCg7lOZjJzBjONJTFKGN9/NIYKSxhU5GRd+DTwHSZyvWp1xuI5aR+dLg+ayyC5Xv57KiY4oJ0tMO89fQ==", 1109 | "dependencies": { 1110 | "Microsoft.NETCore.Platforms": "1.1.0", 1111 | "Microsoft.NETCore.Targets": "1.1.0", 1112 | "System.Runtime": "4.3.0" 1113 | } 1114 | }, 1115 | "System.Xml.ReaderWriter": { 1116 | "type": "Transitive", 1117 | "resolved": "4.3.0", 1118 | "contentHash": "GrprA+Z0RUXaR4N7/eW71j1rgMnEnEVlgii49GZyAjTH7uliMnrOU3HNFBr6fEDBCJCIdlVNq9hHbaDR621XBA==", 1119 | "dependencies": { 1120 | "System.Collections": "4.3.0", 1121 | "System.Diagnostics.Debug": "4.3.0", 1122 | "System.Globalization": "4.3.0", 1123 | "System.IO": "4.3.0", 1124 | "System.IO.FileSystem": "4.3.0", 1125 | "System.IO.FileSystem.Primitives": "4.3.0", 1126 | "System.Resources.ResourceManager": "4.3.0", 1127 | "System.Runtime": "4.3.0", 1128 | "System.Runtime.Extensions": "4.3.0", 1129 | "System.Runtime.InteropServices": "4.3.0", 1130 | "System.Text.Encoding": "4.3.0", 1131 | "System.Text.Encoding.Extensions": "4.3.0", 1132 | "System.Text.RegularExpressions": "4.3.0", 1133 | "System.Threading.Tasks": "4.3.0", 1134 | "System.Threading.Tasks.Extensions": "4.3.0" 1135 | } 1136 | }, 1137 | "System.Xml.XDocument": { 1138 | "type": "Transitive", 1139 | "resolved": "4.3.0", 1140 | "contentHash": "5zJ0XDxAIg8iy+t4aMnQAu0MqVbqyvfoUVl1yDV61xdo3Vth45oA2FoY4pPkxYAH5f8ixpmTqXeEIya95x0aCQ==", 1141 | "dependencies": { 1142 | "System.Collections": "4.3.0", 1143 | "System.Diagnostics.Debug": "4.3.0", 1144 | "System.Diagnostics.Tools": "4.3.0", 1145 | "System.Globalization": "4.3.0", 1146 | "System.IO": "4.3.0", 1147 | "System.Reflection": "4.3.0", 1148 | "System.Resources.ResourceManager": "4.3.0", 1149 | "System.Runtime": "4.3.0", 1150 | "System.Runtime.Extensions": "4.3.0", 1151 | "System.Text.Encoding": "4.3.0", 1152 | "System.Threading": "4.3.0", 1153 | "System.Xml.ReaderWriter": "4.3.0" 1154 | } 1155 | }, 1156 | "System.Xml.XmlDocument": { 1157 | "type": "Transitive", 1158 | "resolved": "4.3.0", 1159 | "contentHash": "lJ8AxvkX7GQxpC6GFCeBj8ThYVyQczx2+f/cWHJU8tjS7YfI6Cv6bon70jVEgs2CiFbmmM8b9j1oZVx0dSI2Ww==", 1160 | "dependencies": { 1161 | "System.Collections": "4.3.0", 1162 | "System.Diagnostics.Debug": "4.3.0", 1163 | "System.Globalization": "4.3.0", 1164 | "System.IO": "4.3.0", 1165 | "System.Resources.ResourceManager": "4.3.0", 1166 | "System.Runtime": "4.3.0", 1167 | "System.Runtime.Extensions": "4.3.0", 1168 | "System.Text.Encoding": "4.3.0", 1169 | "System.Threading": "4.3.0", 1170 | "System.Xml.ReaderWriter": "4.3.0" 1171 | } 1172 | }, 1173 | "xunit.abstractions": { 1174 | "type": "Transitive", 1175 | "resolved": "2.0.3", 1176 | "contentHash": "pot1I4YOxlWjIb5jmwvvQNbTrZ3lJQ+jUGkGjWE3hEFM0l5gOnBWS+H3qsex68s5cO52g+44vpGzhAt+42vwKg==" 1177 | }, 1178 | "xunit.analyzers": { 1179 | "type": "Transitive", 1180 | "resolved": "0.10.0", 1181 | "contentHash": "4/IDFCJfIeg6bix9apmUtIMwvOsiwqdEexeO/R2D4GReIGPLIRODTpId/l4LRSrAJk9lEO3Zx1H0Zx6uohJDNg==" 1182 | }, 1183 | "xunit.assert": { 1184 | "type": "Transitive", 1185 | "resolved": "2.4.1", 1186 | "contentHash": "O/Oe0BS5RmSsM+LQOb041TzuPo5MdH2Rov+qXGS37X+KFG1Hxz7kopYklM5+1Y+tRGeXrOx5+Xne1RuqLFQoyQ==", 1187 | "dependencies": { 1188 | "NETStandard.Library": "1.6.1" 1189 | } 1190 | }, 1191 | "xunit.core": { 1192 | "type": "Transitive", 1193 | "resolved": "2.4.1", 1194 | "contentHash": "Zsj5OMU6JasNGERXZy8s72+pcheG6Q15atS5XpZXqAtULuyQiQ6XNnUsp1gyfC6WgqScqMvySiEHmHcOG6Eg0Q==", 1195 | "dependencies": { 1196 | "xunit.extensibility.core": "[2.4.1]", 1197 | "xunit.extensibility.execution": "[2.4.1]" 1198 | } 1199 | }, 1200 | "xunit.extensibility.core": { 1201 | "type": "Transitive", 1202 | "resolved": "2.4.1", 1203 | "contentHash": "yKZKm/8QNZnBnGZFD9SewkllHBiK0DThybQD/G4PiAmQjKtEZyHi6ET70QPU9KtSMJGRYS6Syk7EyR2EVDU4Kg==", 1204 | "dependencies": { 1205 | "NETStandard.Library": "1.6.1", 1206 | "xunit.abstractions": "2.0.3" 1207 | } 1208 | }, 1209 | "xunit.extensibility.execution": { 1210 | "type": "Transitive", 1211 | "resolved": "2.4.1", 1212 | "contentHash": "7e/1jqBpcb7frLkB6XDrHCGXAbKN4Rtdb88epYxCSRQuZDRW8UtTfdTEVpdTl8s4T56e07hOBVd4G0OdCxIY2A==", 1213 | "dependencies": { 1214 | "NETStandard.Library": "1.6.1", 1215 | "xunit.extensibility.core": "[2.4.1]" 1216 | } 1217 | }, 1218 | "Aptacode.Expressions": { 1219 | "type": "Project" 1220 | } 1221 | } 1222 | } 1223 | } -------------------------------------------------------------------------------- /Expressions.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 17 4 | VisualStudioVersion = 17.1.32228.430 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Expressions", "Expressions\Expressions.csproj", "{8B825EC6-5231-4F61-883F-ADD3B605D4D0}" 7 | EndProject 8 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Expressions.Tests", "Expressions.Tests\Expressions.Tests.csproj", "{1FE16980-0354-4B5D-BBA4-01B03849E948}" 9 | EndProject 10 | Global 11 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 12 | Debug|Any CPU = Debug|Any CPU 13 | Release|Any CPU = Release|Any CPU 14 | EndGlobalSection 15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 16 | {8B825EC6-5231-4F61-883F-ADD3B605D4D0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 17 | {8B825EC6-5231-4F61-883F-ADD3B605D4D0}.Debug|Any CPU.Build.0 = Debug|Any CPU 18 | {8B825EC6-5231-4F61-883F-ADD3B605D4D0}.Release|Any CPU.ActiveCfg = Release|Any CPU 19 | {8B825EC6-5231-4F61-883F-ADD3B605D4D0}.Release|Any CPU.Build.0 = Release|Any CPU 20 | {1FE16980-0354-4B5D-BBA4-01B03849E948}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 21 | {1FE16980-0354-4B5D-BBA4-01B03849E948}.Debug|Any CPU.Build.0 = Debug|Any CPU 22 | {1FE16980-0354-4B5D-BBA4-01B03849E948}.Release|Any CPU.ActiveCfg = Release|Any CPU 23 | {1FE16980-0354-4B5D-BBA4-01B03849E948}.Release|Any CPU.Build.0 = Release|Any CPU 24 | EndGlobalSection 25 | GlobalSection(SolutionProperties) = preSolution 26 | HideSolutionNode = FALSE 27 | EndGlobalSection 28 | GlobalSection(ExtensibilityGlobals) = postSolution 29 | SolutionGuid = {A17D6567-2DBA-4457-AB4B-F26193E40212} 30 | EndGlobalSection 31 | EndGlobal 32 | -------------------------------------------------------------------------------- /Expressions/Bool/BinaryBoolComparison.cs: -------------------------------------------------------------------------------- 1 | using Aptacode.Expressions.Visitor; 2 | 3 | namespace Aptacode.Expressions.Bool; 4 | 5 | public abstract record BinaryBoolComparison(IExpression Lhs, 6 | IExpression Rhs) : IExpression 7 | { 8 | public abstract bool Interpret(TContext context); 9 | 10 | public void Visit(IExpressionVisitor visitor) 11 | { 12 | visitor.Visit(this); 13 | } 14 | } -------------------------------------------------------------------------------- /Expressions/Bool/ConstantBool.cs: -------------------------------------------------------------------------------- 1 | using Aptacode.Expressions.GenericExpressions; 2 | 3 | namespace Aptacode.Expressions.Bool; 4 | 5 | public record ConstantBool(bool Value) : ConstantExpression(Value); -------------------------------------------------------------------------------- /Expressions/Bool/EqualityOperators/EqualTo.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace Aptacode.Expressions.Bool.EqualityOperators; 4 | 5 | /// 6 | /// The class for the boolean equality operator '==' on expressions of a given type. 7 | /// 8 | /// Expressions must be of the same type for equality to be defined on them. 9 | public record EqualTo(IExpression Lhs, IExpression Rhs) : 10 | BinaryBoolComparison(Lhs, 11 | Rhs) 12 | 13 | { 14 | public override bool Interpret(TContext context) 15 | { 16 | return Comparer.Default.Compare(Lhs.Interpret(context), Rhs.Interpret(context)) == 0; 17 | } 18 | } -------------------------------------------------------------------------------- /Expressions/Bool/EqualityOperators/Extensions/EqualityOperatorExtensions.cs: -------------------------------------------------------------------------------- 1 | namespace Aptacode.Expressions.Bool.EqualityOperators.Extensions; 2 | 3 | public static class EqualityOperatorExtensions 4 | { 5 | public static EqualTo EqualTo( 6 | this IExpression lhs, 7 | IExpression rhs) 8 | { 9 | return new EqualTo(lhs, rhs); 10 | } 11 | 12 | public static NotEqualTo NotEqualTo( 13 | this IExpression lhs, 14 | IExpression rhs) 15 | { 16 | return new NotEqualTo(lhs, rhs); 17 | } 18 | } -------------------------------------------------------------------------------- /Expressions/Bool/EqualityOperators/NotEqualTo.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace Aptacode.Expressions.Bool.EqualityOperators; 4 | 5 | /// 6 | /// The class for the boolean equality operator '!=' on expressions of a given type. 7 | /// 8 | /// Expressions must be of the same type for equality to be defined on them. 9 | public record NotEqualTo(IExpression Lhs, IExpression Rhs) : 10 | BinaryBoolComparison(Lhs, 11 | Rhs) 12 | 13 | { 14 | public override bool Interpret(TContext context) 15 | { 16 | return Comparer.Default.Compare(Lhs.Interpret(context), Rhs.Interpret(context)) != 0; 17 | } 18 | } -------------------------------------------------------------------------------- /Expressions/Bool/LogicalOperators/All.cs: -------------------------------------------------------------------------------- 1 | using System.Linq; 2 | 3 | namespace Aptacode.Expressions.Bool.LogicalOperators; 4 | 5 | /// 6 | /// The class for the boolean conditional logical operator '&&' for any amount of boolean expressions. 7 | /// 8 | public record All 9 | (params IExpression[] Expressions) : NaryBoolExpression(Expressions) 10 | { 11 | public override bool Interpret(TContext context) 12 | { 13 | return Expressions.Aggregate(true, 14 | (current, booleanExpression) => current && booleanExpression.Interpret(context)); 15 | } 16 | } -------------------------------------------------------------------------------- /Expressions/Bool/LogicalOperators/And.cs: -------------------------------------------------------------------------------- 1 | using Aptacode.Expressions.GenericExpressions; 2 | 3 | namespace Aptacode.Expressions.Bool.LogicalOperators; 4 | 5 | /// 6 | /// The class for the boolean conditional logical operator '&&' on boolean expressions. 7 | /// 8 | public record And 9 | (IExpression Lhs, IExpression Rhs) : BinaryExpression(Lhs, Rhs) 10 | { 11 | public override bool Interpret(TContext context) 12 | { 13 | return Lhs.Interpret(context) && Rhs.Interpret(context); 14 | } 15 | } -------------------------------------------------------------------------------- /Expressions/Bool/LogicalOperators/Any.cs: -------------------------------------------------------------------------------- 1 | using System.Linq; 2 | 3 | namespace Aptacode.Expressions.Bool.LogicalOperators; 4 | 5 | /// 6 | /// The class for the boolean conditional logical operator '||' for any amount of boolean expressions. 7 | /// 8 | public record Any 9 | (params IExpression[] Expressions) : NaryBoolExpression(Expressions) 10 | { 11 | public override bool Interpret(TContext context) 12 | { 13 | return Expressions.Aggregate(false, 14 | (current, booleanExpression) => current || booleanExpression.Interpret(context)); 15 | } 16 | } -------------------------------------------------------------------------------- /Expressions/Bool/LogicalOperators/Extensions/LogicalOperatorExtensions.cs: -------------------------------------------------------------------------------- 1 | using System.Linq; 2 | 3 | namespace Aptacode.Expressions.Bool.LogicalOperators.Extensions; 4 | 5 | public static class LogicalOperatorExtensions 6 | { 7 | public static IExpression All(this IExpression expression, 8 | params IExpression[] expressions) 9 | { 10 | var allExpressions = expressions.ToList(); 11 | allExpressions.Add(expression); 12 | return new All(allExpressions.ToArray()); 13 | } 14 | 15 | public static IExpression Any(this IExpression expression, 16 | params IExpression[] expressions) 17 | { 18 | var allExpressions = expressions.ToList(); 19 | allExpressions.Add(expression); 20 | return new Any(allExpressions.ToArray()); 21 | } 22 | 23 | public static IExpression Not(this IExpression expression) 24 | { 25 | return new Not(expression); 26 | } 27 | 28 | public static IExpression Or(this IExpression lhs, 29 | IExpression rhs) 30 | { 31 | return new Or(lhs, rhs); 32 | } 33 | 34 | public static IExpression And(this IExpression lhs, 35 | IExpression rhs) 36 | { 37 | return new And(lhs, rhs); 38 | } 39 | 40 | public static IExpression XOr(this IExpression lhs, 41 | IExpression rhs) 42 | { 43 | return new XOr(lhs, rhs); 44 | } 45 | } -------------------------------------------------------------------------------- /Expressions/Bool/LogicalOperators/Not.cs: -------------------------------------------------------------------------------- 1 | using Aptacode.Expressions.GenericExpressions; 2 | 3 | namespace Aptacode.Expressions.Bool.LogicalOperators; 4 | 5 | /// 6 | /// The class for the boolean logical operator '!' on boolean expressions. 7 | /// 8 | public record Not(IExpression Expression) : UnaryExpression(Expression) 9 | { 10 | public override bool Interpret(TContext context) 11 | { 12 | return !Expression.Interpret(context); 13 | } 14 | } -------------------------------------------------------------------------------- /Expressions/Bool/LogicalOperators/Or.cs: -------------------------------------------------------------------------------- 1 | using Aptacode.Expressions.GenericExpressions; 2 | 3 | namespace Aptacode.Expressions.Bool.LogicalOperators; 4 | 5 | /// 6 | /// The class for the boolean conditional logical operator '||' on boolean expressions. 7 | /// 8 | public record Or 9 | (IExpression Lhs, IExpression Rhs) : BinaryExpression(Lhs, Rhs) 10 | { 11 | public override bool Interpret(TContext context) 12 | { 13 | return Lhs.Interpret(context) || Rhs.Interpret(context); 14 | } 15 | } -------------------------------------------------------------------------------- /Expressions/Bool/LogicalOperators/XOr.cs: -------------------------------------------------------------------------------- 1 | using Aptacode.Expressions.GenericExpressions; 2 | 3 | namespace Aptacode.Expressions.Bool.LogicalOperators; 4 | 5 | /// 6 | /// The class for the boolean logical operator '^' on boolean expressions. 7 | /// 8 | public record XOr 9 | (IExpression Lhs, IExpression Rhs) : BinaryExpression(Lhs, Rhs) 10 | { 11 | public override bool Interpret(TContext context) 12 | { 13 | return Lhs.Interpret(context) ^ Rhs.Interpret(context); 14 | } 15 | } -------------------------------------------------------------------------------- /Expressions/Bool/NaryBoolExpression.cs: -------------------------------------------------------------------------------- 1 | using Aptacode.Expressions.Visitor; 2 | 3 | namespace Aptacode.Expressions.Bool; 4 | 5 | public abstract record NaryBoolExpression 6 | (IExpression[] Expressions) : IExpression 7 | { 8 | public abstract bool Interpret(TContext context); 9 | 10 | public void Visit(IExpressionVisitor visitor) 11 | { 12 | visitor.Visit(this); 13 | } 14 | } -------------------------------------------------------------------------------- /Expressions/Bool/RelationalOperators/Extensions/RelationalOperatorExtensions.cs: -------------------------------------------------------------------------------- 1 | namespace Aptacode.Expressions.Bool.RelationalOperators.Extensions; 2 | 3 | public static class RelationalOperatorExtensions 4 | { 5 | public static GreaterThan GreaterThan( 6 | this IExpression lhs, 7 | IExpression rhs) 8 | { 9 | return new GreaterThan(lhs, rhs); 10 | } 11 | 12 | public static GreaterThanOrEqualTo GreaterThanOrEqualTo( 13 | this IExpression lhs, 14 | IExpression rhs) 15 | { 16 | return new GreaterThanOrEqualTo(lhs, rhs); 17 | } 18 | 19 | public static LessThan LessThan( 20 | this IExpression lhs, 21 | IExpression rhs) 22 | { 23 | return new LessThan(lhs, rhs); 24 | } 25 | 26 | public static LessThanOrEqualTo LessThanOrEqualTo( 27 | this IExpression lhs, 28 | IExpression rhs) 29 | { 30 | return new LessThanOrEqualTo(lhs, rhs); 31 | } 32 | } -------------------------------------------------------------------------------- /Expressions/Bool/RelationalOperators/GreaterThan.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace Aptacode.Expressions.Bool.RelationalOperators; 4 | 5 | /// 6 | /// The class for the boolean relational operator '>' on expressions of a given type. 7 | /// 8 | /// 9 | /// Expressions must be of the same type for relations to be defined on them.
10 | /// Care should be taken to ensure type comparison can be done on the given type. 11 | ///
12 | public record GreaterThan(IExpression Lhs, IExpression Rhs) : 13 | BinaryBoolComparison(Lhs, 14 | Rhs) 15 | 16 | { 17 | /// 18 | /// 19 | /// 20 | /// True if lhs > rhs, otherwise false. 21 | public override bool Interpret(TContext context) 22 | { 23 | return Comparer.Default.Compare(Lhs.Interpret(context), Rhs.Interpret(context)) > 0; 24 | } 25 | } -------------------------------------------------------------------------------- /Expressions/Bool/RelationalOperators/GreaterThanOrEqualTo.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace Aptacode.Expressions.Bool.RelationalOperators; 4 | 5 | /// 6 | /// The class for the boolean relational operator '>=' on expressions of a given type. 7 | /// 8 | /// 9 | /// Expressions must be of the same type for relations to be defined on them.
10 | /// Care should be taken to ensure type comparison can be done on the given type. 11 | ///
12 | public record GreaterThanOrEqualTo 13 | (IExpression Lhs, IExpression Rhs) : BinaryBoolComparison(Lhs, 14 | Rhs) 15 | 16 | { 17 | /// 18 | /// 19 | /// 20 | /// True if lhs >= rhs, otherwise false. 21 | public override bool Interpret(TContext context) 22 | { 23 | return Comparer.Default.Compare(Lhs.Interpret(context), Rhs.Interpret(context)) >= 0; 24 | } 25 | } -------------------------------------------------------------------------------- /Expressions/Bool/RelationalOperators/LessThan.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace Aptacode.Expressions.Bool.RelationalOperators; 4 | 5 | /// 6 | /// The class for the boolean relational operator '<' on expressions of a given type. 7 | /// 8 | /// 9 | /// Expressions must be of the same type for relations to be defined on them.
10 | /// Care should be taken to ensure type comparison can be done on the given type. 11 | ///
12 | public record LessThan(IExpression Lhs, IExpression Rhs) : 13 | BinaryBoolComparison(Lhs, 14 | Rhs) 15 | 16 | { 17 | /// 18 | /// 19 | /// 20 | /// True if lhs < rhs, otherwise false. 21 | public override bool Interpret(TContext context) 22 | { 23 | return Comparer.Default.Compare(Lhs.Interpret(context), Rhs.Interpret(context)) < 0; 24 | } 25 | } -------------------------------------------------------------------------------- /Expressions/Bool/RelationalOperators/LessThanOrEqualTo.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace Aptacode.Expressions.Bool.RelationalOperators; 4 | 5 | /// 6 | /// The class for the boolean relational operator '<' on expressions of a given type. 7 | /// 8 | /// 9 | /// Expressions must be of the same type for relations to be defined on them.
10 | /// Care should be taken to ensure type comparison can be done on the given type. 11 | ///
12 | public record LessThanOrEqualTo 13 | (IExpression Lhs, IExpression Rhs) : BinaryBoolComparison(Lhs, 14 | Rhs) 15 | 16 | { 17 | /// 18 | /// 19 | /// 20 | /// True if lhs <= rhs, otherwise false. 21 | public override bool Interpret(TContext context) 22 | { 23 | return Comparer.Default.Compare(Lhs.Interpret(context), Rhs.Interpret(context)) <= 0; 24 | } 25 | } -------------------------------------------------------------------------------- /Expressions/Color/ConstantColor.cs: -------------------------------------------------------------------------------- 1 | using Aptacode.Expressions.GenericExpressions; 2 | 3 | namespace Aptacode.Expressions.Color; 4 | 5 | public record ConstantColor 6 | (System.Drawing.Color Value) : ConstantExpression(Value); -------------------------------------------------------------------------------- /Expressions/Decimal/ConstantDecimal.cs: -------------------------------------------------------------------------------- 1 | using Aptacode.Expressions.GenericExpressions; 2 | 3 | namespace Aptacode.Expressions.Decimal; 4 | 5 | public record ConstantDecimal(decimal Value) : ConstantExpression(Value); -------------------------------------------------------------------------------- /Expressions/Decimal/DecimalArithmeticOperators/AddDecimal.cs: -------------------------------------------------------------------------------- 1 | using Aptacode.Expressions.GenericArithmeticOperators; 2 | 3 | namespace Aptacode.Expressions.Decimal.DecimalArithmeticOperators; 4 | 5 | public record AddDecimal 6 | (IExpression Lhs, IExpression Rhs) : Add(Lhs, Rhs); -------------------------------------------------------------------------------- /Expressions/Decimal/DecimalArithmeticOperators/DecimalAritmeticOperatorExtensions.cs: -------------------------------------------------------------------------------- 1 | using System.Linq; 2 | using Aptacode.Expressions.GenericArithmeticOperators; 3 | 4 | namespace Aptacode.Expressions.Decimal.DecimalArithmeticOperators; 5 | 6 | public static class DecimalArithmeticOperatorExtensions 7 | { 8 | public static IExpression AddDecimal( 9 | this IExpression decimalExpression, 10 | params IExpression[] decimalExpressions) 11 | 12 | { 13 | return decimalExpressions.Aggregate(decimalExpression, 14 | (current, aggregateExpression) => new Add(current, aggregateExpression)); 15 | } 16 | 17 | public static IExpression SubtractDecimal( 18 | this IExpression decimalExpression, 19 | params IExpression[] decimalExpressions) 20 | 21 | { 22 | return decimalExpressions.Aggregate(decimalExpression, 23 | (current, aggregateExpression) => new Subtract(current, aggregateExpression)); 24 | } 25 | 26 | 27 | public static IExpression MultiplyDecimal( 28 | this IExpression decimalExpression, 29 | params IExpression[] decimalExpressions) 30 | 31 | { 32 | return decimalExpressions.Aggregate(decimalExpression, 33 | (current, aggregateExpression) => new Multiply(current, aggregateExpression)); 34 | } 35 | } -------------------------------------------------------------------------------- /Expressions/Decimal/DecimalArithmeticOperators/MultiplyDecimal.cs: -------------------------------------------------------------------------------- 1 | using Aptacode.Expressions.GenericArithmeticOperators; 2 | 3 | namespace Aptacode.Expressions.Decimal.DecimalArithmeticOperators; 4 | 5 | public record MultiplyDecimal 6 | (IExpression Lhs, IExpression Rhs) : Multiply(Lhs, Rhs); -------------------------------------------------------------------------------- /Expressions/Decimal/DecimalArithmeticOperators/SubtractDecimal.cs: -------------------------------------------------------------------------------- 1 | using Aptacode.Expressions.GenericArithmeticOperators; 2 | 3 | namespace Aptacode.Expressions.Decimal.DecimalArithmeticOperators; 4 | 5 | public record SubtractDecimal : Subtract 6 | { 7 | public SubtractDecimal(IExpression lhs, IExpression rhs) : 8 | base(lhs, rhs) 9 | { 10 | } 11 | } -------------------------------------------------------------------------------- /Expressions/Double/ConstantDouble.cs: -------------------------------------------------------------------------------- 1 | using Aptacode.Expressions.GenericExpressions; 2 | 3 | namespace Aptacode.Expressions.Double; 4 | 5 | public record ConstantDouble(double Value) : ConstantExpression(Value); -------------------------------------------------------------------------------- /Expressions/Double/DoubleArithmeticOperators/AddDouble.cs: -------------------------------------------------------------------------------- 1 | using Aptacode.Expressions.GenericArithmeticOperators; 2 | 3 | namespace Aptacode.Expressions.Double.DoubleArithmeticOperators; 4 | 5 | public record AddDouble 6 | (IExpression Lhs, IExpression Rhs) : Add(Lhs, Rhs); -------------------------------------------------------------------------------- /Expressions/Double/DoubleArithmeticOperators/DoubleAritmeticOperatorExtensions.cs: -------------------------------------------------------------------------------- 1 | using System.Linq; 2 | using Aptacode.Expressions.GenericArithmeticOperators; 3 | 4 | namespace Aptacode.Expressions.Double.DoubleArithmeticOperators; 5 | 6 | public static class DoubleArithmeticOperatorExtensions 7 | { 8 | public static IExpression AddDouble( 9 | this IExpression doubleExpression, 10 | params IExpression[] doubleExpressions) 11 | 12 | { 13 | return doubleExpressions.Aggregate(doubleExpression, 14 | (current, aggregateExpression) => new Add(current, aggregateExpression)); 15 | } 16 | 17 | public static IExpression SubtractDouble( 18 | this IExpression doubleExpression, 19 | params IExpression[] doubleExpressions) 20 | 21 | { 22 | return doubleExpressions.Aggregate(doubleExpression, 23 | (current, aggregateExpression) => new Subtract(current, aggregateExpression)); 24 | } 25 | 26 | 27 | public static IExpression MultiplyDouble( 28 | this IExpression doubleExpression, 29 | params IExpression[] doubleExpressions) 30 | 31 | { 32 | return doubleExpressions.Aggregate(doubleExpression, 33 | (current, aggregateExpression) => new Multiply(current, aggregateExpression)); 34 | } 35 | } -------------------------------------------------------------------------------- /Expressions/Double/DoubleArithmeticOperators/MultiplyDouble.cs: -------------------------------------------------------------------------------- 1 | using Aptacode.Expressions.GenericArithmeticOperators; 2 | 3 | namespace Aptacode.Expressions.Double.DoubleArithmeticOperators; 4 | 5 | public record MultiplyDouble 6 | (IExpression Lhs, IExpression Rhs) : Multiply(Lhs, Rhs); -------------------------------------------------------------------------------- /Expressions/Double/DoubleArithmeticOperators/SubtractDouble.cs: -------------------------------------------------------------------------------- 1 | using Aptacode.Expressions.GenericArithmeticOperators; 2 | 3 | namespace Aptacode.Expressions.Double.DoubleArithmeticOperators; 4 | 5 | public record SubtractDouble 6 | (IExpression Lhs, IExpression Rhs) : Subtract(Lhs, Rhs); -------------------------------------------------------------------------------- /Expressions/ExpressionFactory.cs: -------------------------------------------------------------------------------- 1 | using Aptacode.Expressions.Bool; 2 | using Aptacode.Expressions.Bool.EqualityOperators; 3 | using Aptacode.Expressions.Bool.LogicalOperators; 4 | using Aptacode.Expressions.Bool.RelationalOperators; 5 | using Aptacode.Expressions.Color; 6 | using Aptacode.Expressions.Decimal; 7 | using Aptacode.Expressions.Decimal.DecimalArithmeticOperators; 8 | using Aptacode.Expressions.Double; 9 | using Aptacode.Expressions.Double.DoubleArithmeticOperators; 10 | using Aptacode.Expressions.Float; 11 | using Aptacode.Expressions.Float.FloatArithmeticOperators; 12 | using Aptacode.Expressions.GenericArithmeticOperators; 13 | using Aptacode.Expressions.GenericExpressions; 14 | using Aptacode.Expressions.Guid; 15 | using Aptacode.Expressions.Integer; 16 | using Aptacode.Expressions.Integer.IntegerArithmeticOperators; 17 | using Aptacode.Expressions.List; 18 | using Aptacode.Expressions.List.IntegerListOperators; 19 | using Aptacode.Expressions.List.ListOperators; 20 | using Aptacode.Expressions.String; 21 | using Aptacode.Expressions.String.StringOperators; 22 | 23 | namespace Aptacode.Expressions; 24 | 25 | /// 26 | /// A class to write expressions more concisely by using factory methods. 27 | /// 28 | /// 29 | public class ExpressionFactory 30 | { 31 | #region Constant Expressions 32 | 33 | public ConstantExpression Expression(TType value) 34 | { 35 | return new ConstantExpression(value); 36 | } 37 | 38 | public ConstantInteger Int(int value) 39 | { 40 | return new ConstantInteger(value); 41 | } 42 | 43 | public ConstantFloat Float(float value) 44 | { 45 | return new ConstantFloat(value); 46 | } 47 | 48 | public ConstantDouble Double(double value) 49 | { 50 | return new ConstantDouble(value); 51 | } 52 | 53 | public ConstantDecimal Decimal(decimal value) 54 | { 55 | return new ConstantDecimal(value); 56 | } 57 | 58 | public ConstantBool Bool(bool value) 59 | { 60 | return new ConstantBool(value); 61 | } 62 | 63 | public ConstantColor Color(System.Drawing.Color value) 64 | { 65 | return new ConstantColor(value); 66 | } 67 | 68 | public ConstantString String(string value) 69 | { 70 | return new ConstantString(value); 71 | } 72 | 73 | public ConstantGuid Guid(System.Guid value) 74 | { 75 | return new ConstantGuid(value); 76 | } 77 | 78 | public ConstantList List(TType[] value) 79 | { 80 | return new ConstantList(value); 81 | } 82 | 83 | #endregion 84 | 85 | #region Conditional Expressions 86 | 87 | public ConditionalExpression Conditional(IExpression condition, 88 | IExpression passExpression, 89 | IExpression failExpression) 90 | { 91 | return new ConditionalExpression(condition, passExpression, failExpression); 92 | } 93 | 94 | public IExpression Conditional(IExpression condition, 95 | IExpression passExpression, 96 | IExpression failExpression) 97 | { 98 | return new ConditionalExpression(condition, passExpression, failExpression); 99 | } 100 | 101 | public ConditionalExpression Conditional(IExpression condition, 102 | IExpression passExpression, 103 | IExpression failExpression) 104 | { 105 | return new ConditionalExpression(condition, passExpression, failExpression); 106 | } 107 | 108 | public ConditionalExpression ConditionalDouble(IExpression condition, 109 | IExpression passExpression, 110 | IExpression failExpression) 111 | { 112 | return new ConditionalExpression(condition, passExpression, failExpression); 113 | } 114 | 115 | public ConditionalExpression Conditional(IExpression condition, 116 | IExpression passExpression, 117 | IExpression failExpression) 118 | { 119 | return new ConditionalExpression(condition, passExpression, failExpression); 120 | } 121 | 122 | public ConditionalExpression Conditional(IExpression condition, 123 | IExpression passExpression, 124 | IExpression failExpression) 125 | { 126 | return new ConditionalExpression(condition, passExpression, failExpression); 127 | } 128 | 129 | public ConditionalExpression Conditional(IExpression condition, 130 | IExpression passExpression, 131 | IExpression failExpression) 132 | { 133 | return new ConditionalExpression(condition, passExpression, failExpression); 134 | } 135 | 136 | public ConditionalExpression Conditional(IExpression condition, 137 | IExpression passExpression, 138 | IExpression failExpression) 139 | { 140 | return new ConditionalExpression(condition, passExpression, failExpression); 141 | } 142 | 143 | public ConditionalListExpression ConditionalList(IExpression condition, 144 | IListExpression passExpression, 145 | IListExpression failExpression) 146 | { 147 | return new ConditionalListExpression(condition, passExpression, failExpression); 148 | } 149 | 150 | #endregion 151 | 152 | #region Arithmetic Operators 153 | 154 | #region Generic 155 | 156 | public Add Add(IExpression lhs, 157 | IExpression rhs) 158 | { 159 | return new Add(lhs, rhs); 160 | } 161 | 162 | public Multiply Multiply(IExpression lhs, 163 | IExpression rhs) 164 | { 165 | return new Multiply(lhs, rhs); 166 | } 167 | 168 | public Subtract Subtract(IExpression lhs, IExpression rhs) 169 | { 170 | return new Subtract(lhs, rhs); 171 | } 172 | 173 | #endregion 174 | 175 | #region Integer 176 | 177 | public AddInteger AddInteger(IExpression lhs, IExpression rhs) 178 | { 179 | return new AddInteger(lhs, rhs); 180 | } 181 | 182 | public MultiplyInteger MultiplyInteger(IExpression lhs, 183 | IExpression rhs) 184 | { 185 | return new MultiplyInteger(lhs, rhs); 186 | } 187 | 188 | public SubtractInteger SubtractInteger(IExpression lhs, 189 | IExpression rhs) 190 | { 191 | return new SubtractInteger(lhs, rhs); 192 | } 193 | 194 | #endregion 195 | 196 | #region Float 197 | 198 | public AddFloat AddFloat(IExpression lhs, IExpression rhs) 199 | { 200 | return new AddFloat(lhs, rhs); 201 | } 202 | 203 | public MultiplyFloat 204 | MultiplyFloat(IExpression lhs, IExpression rhs) 205 | { 206 | return new MultiplyFloat(lhs, rhs); 207 | } 208 | 209 | public SubtractFloat 210 | SubtractFloat(IExpression lhs, IExpression rhs) 211 | { 212 | return new SubtractFloat(lhs, rhs); 213 | } 214 | 215 | #endregion 216 | 217 | #region Double 218 | 219 | public AddDouble AddDouble(IExpression lhs, IExpression rhs) 220 | { 221 | return new AddDouble(lhs, rhs); 222 | } 223 | 224 | public MultiplyDouble 225 | MultiplyFloat(IExpression lhs, IExpression rhs) 226 | { 227 | return new MultiplyDouble(lhs, rhs); 228 | } 229 | 230 | public SubtractDouble 231 | SubtractDouble(IExpression lhs, IExpression rhs) 232 | { 233 | return new SubtractDouble(lhs, rhs); 234 | } 235 | 236 | #endregion 237 | 238 | #region Decimal 239 | 240 | public AddDecimal AddDecimal(IExpression lhs, 241 | IExpression rhs) 242 | { 243 | return new AddDecimal(lhs, rhs); 244 | } 245 | 246 | public MultiplyDecimal MultiplyFloat(IExpression lhs, 247 | IExpression rhs) 248 | { 249 | return new MultiplyDecimal(lhs, rhs); 250 | } 251 | 252 | public SubtractDecimal SubtractDecimal(IExpression lhs, 253 | IExpression rhs) 254 | { 255 | return new SubtractDecimal(lhs, rhs); 256 | } 257 | 258 | #endregion 259 | 260 | #region String 261 | 262 | public ConcatString Concat(IExpression lhs, 263 | IExpression rhs) 264 | { 265 | return new ConcatString(lhs, rhs); 266 | } 267 | 268 | #endregion 269 | 270 | #endregion 271 | 272 | #region Logical Operators 273 | 274 | public And And(IExpression lhs, IExpression rhs) 275 | { 276 | return new And(lhs, rhs); 277 | } 278 | 279 | public Or Or(IExpression lhs, IExpression rhs) 280 | { 281 | return new Or(lhs, rhs); 282 | } 283 | 284 | public Not Not(IExpression lhs) 285 | { 286 | return new Not(lhs); 287 | } 288 | 289 | public XOr XOr(IExpression lhs, IExpression rhs) 290 | { 291 | return new XOr(lhs, rhs); 292 | } 293 | 294 | #endregion 295 | 296 | #region Relational Operators 297 | 298 | public GreaterThan GreaterThan(IExpression lhs, 299 | IExpression rhs) 300 | { 301 | return new GreaterThan(lhs, rhs); 302 | } 303 | 304 | public GreaterThanOrEqualTo GreaterThanOrEqualTo( 305 | IExpression lhs, 306 | IExpression rhs) 307 | { 308 | return new GreaterThanOrEqualTo(lhs, rhs); 309 | } 310 | 311 | public LessThan LessThan(IExpression lhs, 312 | IExpression rhs) 313 | { 314 | return new LessThan(lhs, rhs); 315 | } 316 | 317 | public LessThanOrEqualTo LessThanOrEqualTo(IExpression lhs, 318 | IExpression rhs) 319 | { 320 | return new LessThanOrEqualTo(lhs, rhs); 321 | } 322 | 323 | #endregion 324 | 325 | #region Equality Operators 326 | 327 | public EqualTo EqualTo(IExpression lhs, 328 | IExpression rhs) 329 | { 330 | return new EqualTo(lhs, rhs); 331 | } 332 | 333 | public NotEqualTo NotEqualTo(IExpression lhs, 334 | IExpression rhs) 335 | { 336 | return new NotEqualTo(lhs, rhs); 337 | } 338 | 339 | #endregion 340 | 341 | #region List Operators 342 | 343 | public ConcatList Concat(IListExpression lhs, 344 | IListExpression rhs) 345 | { 346 | return new ConcatList(lhs, rhs); 347 | } 348 | 349 | public First First(IListExpression list) 350 | { 351 | return new First(list); 352 | } 353 | 354 | public Count Count(IListExpression list) 355 | { 356 | return new Count(list); 357 | } 358 | 359 | public Last Last(IListExpression list) 360 | { 361 | return new Last(list); 362 | } 363 | 364 | public TakeFirst TakeFirst(IListExpression list, 365 | IExpression count) 366 | { 367 | return new TakeFirst(list, count); 368 | } 369 | 370 | public TakeLast TakeLast(IListExpression list, 371 | IExpression count) 372 | { 373 | return new TakeLast(list, count); 374 | } 375 | 376 | public Append Append(IListExpression list, 377 | IExpression element) 378 | { 379 | return new Append(list, element); 380 | } 381 | 382 | #endregion 383 | } -------------------------------------------------------------------------------- /Expressions/Expressions.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | net6.0 5 | Aptacode.Expressions 6 | Aptacode.Expressions 7 | Timothy Jones, Thomas Schmidt 8 | Aptacode 9 | MIT 10 | MIT 11 | https://github.com/Aptacode/Expressions 12 | https://github.com/Aptacode/Expressions 13 | 1.0.13 14 | 1.0.13 15 | 1.0.13 16 | enable 17 | 10.0 18 | Logo.ico 19 | Logo256.png 20 | A light, cross platform & flexible .net library for creating, storing and dynamically evaluating expression trees using C# 21 | Expression Interpreter Aptacode 22 | 23 | 24 | 25 | 26 | True 27 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /Expressions/Float/ConstantFloat.cs: -------------------------------------------------------------------------------- 1 | using Aptacode.Expressions.GenericExpressions; 2 | 3 | namespace Aptacode.Expressions.Float; 4 | 5 | public record ConstantFloat(float Value) : ConstantExpression(Value); -------------------------------------------------------------------------------- /Expressions/Float/FloatArithmeticOperators/AddFloat.cs: -------------------------------------------------------------------------------- 1 | using Aptacode.Expressions.GenericArithmeticOperators; 2 | 3 | namespace Aptacode.Expressions.Float.FloatArithmeticOperators; 4 | 5 | public record AddFloat 6 | (IExpression Lhs, IExpression Rhs) : Add(Lhs, Rhs); -------------------------------------------------------------------------------- /Expressions/Float/FloatArithmeticOperators/FloatAritmeticOperatorExtensions.cs: -------------------------------------------------------------------------------- 1 | using System.Linq; 2 | using Aptacode.Expressions.GenericArithmeticOperators; 3 | 4 | namespace Aptacode.Expressions.Float.FloatArithmeticOperators; 5 | 6 | public static class FloatArithmeticOperatorExtensions 7 | { 8 | public static IExpression AddFloat( 9 | this IExpression floatExpression, 10 | params IExpression[] floatExpressions) 11 | 12 | { 13 | return floatExpressions.Aggregate(floatExpression, 14 | (current, aggregateExpression) => new Add(current, aggregateExpression)); 15 | } 16 | 17 | public static IExpression SubtractFloat( 18 | this IExpression floatExpression, 19 | params IExpression[] floatExpressions) 20 | 21 | { 22 | return floatExpressions.Aggregate(floatExpression, 23 | (current, aggregateExpression) => new Subtract(current, aggregateExpression)); 24 | } 25 | 26 | 27 | public static IExpression MultiplyFloat( 28 | this IExpression floatExpression, 29 | params IExpression[] floatExpressions) 30 | 31 | { 32 | return floatExpressions.Aggregate(floatExpression, 33 | (current, aggregateExpression) => new Multiply(current, aggregateExpression)); 34 | } 35 | } -------------------------------------------------------------------------------- /Expressions/Float/FloatArithmeticOperators/MultiplyFloat.cs: -------------------------------------------------------------------------------- 1 | using Aptacode.Expressions.GenericArithmeticOperators; 2 | 3 | namespace Aptacode.Expressions.Float.FloatArithmeticOperators; 4 | 5 | public record MultiplyFloat 6 | (IExpression Lhs, IExpression Rhs) : Multiply(Lhs, Rhs); -------------------------------------------------------------------------------- /Expressions/Float/FloatArithmeticOperators/SubtractFloat.cs: -------------------------------------------------------------------------------- 1 | using Aptacode.Expressions.GenericArithmeticOperators; 2 | 3 | namespace Aptacode.Expressions.Float.FloatArithmeticOperators; 4 | 5 | public record SubtractFloat 6 | (IExpression Lhs, IExpression Rhs) : Subtract(Lhs, Rhs); -------------------------------------------------------------------------------- /Expressions/GenericArithmeticOperators/Add.cs: -------------------------------------------------------------------------------- 1 | using Aptacode.Expressions.GenericExpressions; 2 | 3 | namespace Aptacode.Expressions.GenericArithmeticOperators; 4 | 5 | public record Add 6 | (IExpression Lhs, IExpression Rhs) : BinaryExpression(Lhs, Rhs) 7 | 8 | { 9 | public override TType Interpret(TContext context) 10 | { 11 | dynamic dynamic1 = Lhs.Interpret(context); 12 | dynamic dynamic2 = Rhs.Interpret(context); 13 | return dynamic1 + dynamic2; 14 | } 15 | } -------------------------------------------------------------------------------- /Expressions/GenericArithmeticOperators/Extensions/GenericAritmeticOperatorExtensions.cs: -------------------------------------------------------------------------------- 1 | using System.Linq; 2 | 3 | namespace Aptacode.Expressions.GenericArithmeticOperators.Extensions; 4 | 5 | public static class GenericArithmeticOperatorExtensions 6 | { 7 | public static IExpression Add( 8 | this IExpression expression, 9 | params IExpression[] expressions) 10 | 11 | { 12 | return expressions.Aggregate(expression, 13 | (current, aggregateExpression) => new Add(current, aggregateExpression)); 14 | } 15 | 16 | public static IExpression Subtract( 17 | this IExpression expression, 18 | params IExpression[] expressions) 19 | 20 | { 21 | return expressions.Aggregate(expression, 22 | (current, aggregateExpression) => new Subtract(current, aggregateExpression)); 23 | } 24 | 25 | public static IExpression Multiply( 26 | this IExpression expression, 27 | params IExpression[] expressions) 28 | 29 | { 30 | return expressions.Aggregate(expression, 31 | (current, aggregateExpression) => new Multiply(current, aggregateExpression)); 32 | } 33 | } -------------------------------------------------------------------------------- /Expressions/GenericArithmeticOperators/Multiply.cs: -------------------------------------------------------------------------------- 1 | using Aptacode.Expressions.GenericExpressions; 2 | 3 | namespace Aptacode.Expressions.GenericArithmeticOperators; 4 | 5 | public record Multiply(IExpression Lhs, IExpression Rhs) : 6 | BinaryExpression(Lhs, 7 | Rhs) 8 | 9 | { 10 | public override TType Interpret(TContext context) 11 | { 12 | dynamic dynamic1 = Lhs.Interpret(context); 13 | dynamic dynamic2 = Rhs.Interpret(context); 14 | return dynamic1 * dynamic2; 15 | } 16 | } -------------------------------------------------------------------------------- /Expressions/GenericArithmeticOperators/Subtract.cs: -------------------------------------------------------------------------------- 1 | using Aptacode.Expressions.GenericExpressions; 2 | 3 | namespace Aptacode.Expressions.GenericArithmeticOperators; 4 | 5 | public record Subtract 6 | (IExpression Lhs, IExpression Rhs) : BinaryExpression(Lhs, Rhs) 7 | 8 | { 9 | public override TType Interpret(TContext context) 10 | { 11 | dynamic dynamic1 = Lhs.Interpret(context); 12 | dynamic dynamic2 = Rhs.Interpret(context); 13 | return dynamic1 - dynamic2; 14 | } 15 | } -------------------------------------------------------------------------------- /Expressions/GenericExpressions/BinaryExpression.cs: -------------------------------------------------------------------------------- 1 | using Aptacode.Expressions.Visitor; 2 | 3 | namespace Aptacode.Expressions.GenericExpressions; 4 | 5 | public abstract record BinaryExpression(IExpression Lhs, 6 | IExpression Rhs) : IExpression 7 | { 8 | public abstract TType Interpret(TContext context); 9 | 10 | public void Visit(IExpressionVisitor visitor) 11 | { 12 | visitor.Visit(this); 13 | } 14 | } -------------------------------------------------------------------------------- /Expressions/GenericExpressions/ConditionalExpression.cs: -------------------------------------------------------------------------------- 1 | namespace Aptacode.Expressions.GenericExpressions; 2 | 3 | /// 4 | /// The class for a conditional expression of any type. 5 | /// 6 | /// 7 | /// 8 | public record ConditionalExpression(IExpression Condition, 9 | IExpression PassExpression, IExpression FailExpression) : 10 | TernaryExpression(Condition, 11 | PassExpression, FailExpression) 12 | { 13 | /// 14 | /// Constructor to initialise a conditional expression. 15 | /// 16 | /// The boolean expression to be evaluated. 17 | /// The expression returned on the condition evaluating to true. 18 | /// The expression returned on the condition evaluating to false. 19 | public override TType Interpret(TContext context) 20 | { 21 | return Condition.Interpret(context) 22 | ? PassExpression.Interpret(context) 23 | : FailExpression.Interpret(context); 24 | } 25 | } -------------------------------------------------------------------------------- /Expressions/GenericExpressions/ConstantExpression.cs: -------------------------------------------------------------------------------- 1 | using Aptacode.Expressions.Visitor; 2 | 3 | namespace Aptacode.Expressions.GenericExpressions; 4 | 5 | /// 6 | /// The class for a constant expression of any type. 7 | /// 8 | /// 9 | /// 10 | public record ConstantExpression(TType Value) : TerminalExpression 11 | { 12 | public override TType Interpret(TContext context) 13 | { 14 | return Value; 15 | } 16 | 17 | public new void Visit(IExpressionVisitor visitor) 18 | { 19 | visitor.Visit(this); 20 | } 21 | } -------------------------------------------------------------------------------- /Expressions/GenericExpressions/TerminalExpression.cs: -------------------------------------------------------------------------------- 1 | using Aptacode.Expressions.Visitor; 2 | 3 | namespace Aptacode.Expressions.GenericExpressions; 4 | 5 | public abstract record TerminalExpression : IExpression 6 | { 7 | public abstract TType Interpret(TContext context); 8 | 9 | public void Visit(IExpressionVisitor visitor) 10 | { 11 | visitor.Visit(this); 12 | } 13 | } -------------------------------------------------------------------------------- /Expressions/GenericExpressions/TernaryExpression.cs: -------------------------------------------------------------------------------- 1 | using Aptacode.Expressions.Visitor; 2 | 3 | namespace Aptacode.Expressions.GenericExpressions; 4 | 5 | public abstract record TernaryExpression(IExpression Condition, 6 | IExpression PassExpression, IExpression FailExpression) : IExpression 7 | { 8 | public abstract T2 Interpret(TContext context); 9 | 10 | public void Visit(IExpressionVisitor visitor) 11 | { 12 | visitor.Visit(this); 13 | } 14 | } -------------------------------------------------------------------------------- /Expressions/GenericExpressions/UnaryExpression.cs: -------------------------------------------------------------------------------- 1 | using Aptacode.Expressions.Visitor; 2 | 3 | namespace Aptacode.Expressions.GenericExpressions; 4 | 5 | public abstract record UnaryExpression 6 | (IExpression Expression) : IExpression 7 | { 8 | public abstract TType Interpret(TContext context); 9 | 10 | public void Visit(IExpressionVisitor visitor) 11 | { 12 | visitor.Visit(this); 13 | } 14 | } -------------------------------------------------------------------------------- /Expressions/Guid/ConstantGuid.cs: -------------------------------------------------------------------------------- 1 | using Aptacode.Expressions.GenericExpressions; 2 | 3 | namespace Aptacode.Expressions.Guid; 4 | 5 | public record ConstantGuid(System.Guid Value) : ConstantExpression(Value); -------------------------------------------------------------------------------- /Expressions/IExpression.cs: -------------------------------------------------------------------------------- 1 | using Aptacode.Expressions.Visitor; 2 | 3 | namespace Aptacode.Expressions; 4 | 5 | /// 6 | /// The base class for an expression. 7 | /// 8 | /// The object type of the expression. 9 | /// The context of the expression. 10 | public interface IExpression 11 | { 12 | /// 13 | /// The method called on an expression to evaluate it. 14 | /// 15 | /// The context in which to evaluate the expression. 16 | /// 17 | TType Interpret(TContext context); 18 | 19 | void Visit(IExpressionVisitor visitor); 20 | } -------------------------------------------------------------------------------- /Expressions/Integer/ConstantInteger.cs: -------------------------------------------------------------------------------- 1 | using Aptacode.Expressions.GenericExpressions; 2 | 3 | namespace Aptacode.Expressions.Integer; 4 | 5 | public record ConstantInteger(int Value) : ConstantExpression(Value); -------------------------------------------------------------------------------- /Expressions/Integer/IntegerArithmeticOperators/AddInteger.cs: -------------------------------------------------------------------------------- 1 | using Aptacode.Expressions.GenericArithmeticOperators; 2 | 3 | namespace Aptacode.Expressions.Integer.IntegerArithmeticOperators; 4 | 5 | public record AddInteger 6 | (IExpression Lhs, IExpression Rhs) : Add(Lhs, Rhs); -------------------------------------------------------------------------------- /Expressions/Integer/IntegerArithmeticOperators/IntegerAritmeticOperatorExtensions.cs: -------------------------------------------------------------------------------- 1 | using System.Linq; 2 | using Aptacode.Expressions.GenericArithmeticOperators; 3 | 4 | namespace Aptacode.Expressions.Integer.IntegerArithmeticOperators; 5 | 6 | public static class IntegerArithmeticOperatorExtensions 7 | { 8 | public static IExpression AddInteger( 9 | this IExpression integerExpression, 10 | params IExpression[] integerExpressions) 11 | 12 | { 13 | return integerExpressions.Aggregate(integerExpression, 14 | (current, aggregateExpression) => new Add(current, aggregateExpression)); 15 | } 16 | 17 | public static IExpression SubtracInteger( 18 | this IExpression integerExpression, 19 | params IExpression[] integerExpressions) 20 | 21 | { 22 | return integerExpressions.Aggregate(integerExpression, 23 | (current, aggregateExpression) => new Subtract(current, aggregateExpression)); 24 | } 25 | 26 | 27 | public static IExpression MultiplyInteger( 28 | this IExpression integerExpression, 29 | params IExpression[] integerExpressions) 30 | 31 | { 32 | return integerExpressions.Aggregate(integerExpression, 33 | (current, aggregateExpression) => new Multiply(current, aggregateExpression)); 34 | } 35 | } -------------------------------------------------------------------------------- /Expressions/Integer/IntegerArithmeticOperators/MultiplyInteger.cs: -------------------------------------------------------------------------------- 1 | using Aptacode.Expressions.GenericArithmeticOperators; 2 | 3 | namespace Aptacode.Expressions.Integer.IntegerArithmeticOperators; 4 | 5 | public record MultiplyInteger 6 | (IExpression Lhs, IExpression Rhs) : Multiply(Lhs, Rhs); -------------------------------------------------------------------------------- /Expressions/Integer/IntegerArithmeticOperators/SubtractInteger.cs: -------------------------------------------------------------------------------- 1 | using Aptacode.Expressions.GenericArithmeticOperators; 2 | 3 | namespace Aptacode.Expressions.Integer.IntegerArithmeticOperators; 4 | 5 | public record SubtractInteger 6 | (IExpression Lhs, IExpression Rhs) : Subtract(Lhs, Rhs); -------------------------------------------------------------------------------- /Expressions/List/BinaryListExpression.cs: -------------------------------------------------------------------------------- 1 | using Aptacode.Expressions.Visitor; 2 | 3 | namespace Aptacode.Expressions.List; 4 | 5 | public abstract record BinaryListExpression(IListExpression Lhs, 6 | IListExpression Rhs) : IListExpression 7 | 8 | { 9 | public abstract TType[] Interpret(TContext context); 10 | 11 | public void Visit(IExpressionVisitor visitor) 12 | { 13 | visitor.Visit(this); 14 | } 15 | } -------------------------------------------------------------------------------- /Expressions/List/ConditionalListExpression.cs: -------------------------------------------------------------------------------- 1 | namespace Aptacode.Expressions.List; 2 | 3 | /// 4 | /// The class for a conditional list expression of any type. 5 | /// 6 | /// 7 | /// 8 | public record ConditionalListExpression(IExpression Condition, 9 | IListExpression PassExpression, IListExpression FailExpression) : 10 | TernaryListExpression(Condition, 11 | PassExpression, FailExpression) 12 | 13 | { 14 | /// 15 | /// Constructor to initialise a conditional list expression. 16 | /// 17 | /// The boolean expression to be evaluated. 18 | /// The list expression returned on the condition evaluating to true. 19 | /// The list expression returned on the condition evaluating to false. 20 | public override TType[] Interpret(TContext context) 21 | { 22 | return Condition.Interpret(context) 23 | ? PassExpression.Interpret(context) 24 | : FailExpression.Interpret(context); 25 | } 26 | } -------------------------------------------------------------------------------- /Expressions/List/ConstantList.cs: -------------------------------------------------------------------------------- 1 | namespace Aptacode.Expressions.List; 2 | 3 | /// 4 | /// The class for a constant list expression containing expressions of any type. 5 | /// 6 | /// 7 | /// 8 | public record ConstantList(TType[] Value) : TerminalListExpression 9 | 10 | { 11 | public override TType[] Interpret(TContext context) 12 | { 13 | return Value; 14 | } 15 | } -------------------------------------------------------------------------------- /Expressions/List/IListExpression.cs: -------------------------------------------------------------------------------- 1 | namespace Aptacode.Expressions.List; 2 | 3 | /// 4 | /// The base class for a list expression, an expression that is a list of expressions. 5 | /// 6 | /// 7 | /// 8 | public interface IListExpression : IExpression 9 | { 10 | } -------------------------------------------------------------------------------- /Expressions/List/IntegerListOperators/Count.cs: -------------------------------------------------------------------------------- 1 | namespace Aptacode.Expressions.List.IntegerListOperators; 2 | 3 | /// 4 | /// The class for the operation of returning the number of expressions in a list expression. 5 | /// 6 | /// 7 | /// 8 | public record Count 9 | (IListExpression Expression) : UnaryListIntegerExpression(Expression) 10 | 11 | { 12 | public override int Interpret(TContext context) 13 | { 14 | return Expression.Interpret(context).Length; 15 | } 16 | } -------------------------------------------------------------------------------- /Expressions/List/IntegerListOperators/Extensions/IntegerListOperatorExtensions.cs: -------------------------------------------------------------------------------- 1 | namespace Aptacode.Expressions.List.IntegerListOperators.Extensions; 2 | 3 | public static class IntegerListOperatorExtensions 4 | { 5 | public static Count Count( 6 | this IListExpression expression) 7 | { 8 | return new Count(expression); 9 | } 10 | } -------------------------------------------------------------------------------- /Expressions/List/ListOperators/Append.cs: -------------------------------------------------------------------------------- 1 | using System.Linq; 2 | 3 | namespace Aptacode.Expressions.List.ListOperators; 4 | 5 | /// 6 | /// The class for the operation of appending an expression to a list expression. 7 | /// 8 | /// 9 | /// 10 | public record Append(IListExpression Expression, 11 | IExpression ElementExpression) : UnaryListExpression(Expression) 12 | 13 | { 14 | public override TType[] Interpret(TContext context) 15 | { 16 | return Expression.Interpret(context).Concat(Enumerable.Repeat(ElementExpression.Interpret(context), 1)) 17 | .ToArray(); 18 | } 19 | } -------------------------------------------------------------------------------- /Expressions/List/ListOperators/ConcatList.cs: -------------------------------------------------------------------------------- 1 | using System.Linq; 2 | 3 | namespace Aptacode.Expressions.List.ListOperators; 4 | 5 | /// 6 | /// The class for operation of concatenating two list expressions. 7 | /// 8 | /// 9 | /// 10 | public record ConcatList 11 | (IListExpression Lhs, IListExpression Rhs) : 12 | BinaryListExpression(Lhs, Rhs) 13 | 14 | { 15 | public override TType[] Interpret(TContext context) 16 | { 17 | return Lhs.Interpret(context).Concat(Rhs.Interpret(context)).ToArray(); 18 | } 19 | } -------------------------------------------------------------------------------- /Expressions/List/ListOperators/Extensions/ListOperatorExtensions.cs: -------------------------------------------------------------------------------- 1 | using System.Linq; 2 | 3 | namespace Aptacode.Expressions.List.ListOperators.Extensions; 4 | 5 | public static class ListOperatorExtensions 6 | { 7 | public static First First( 8 | this IListExpression expression) 9 | { 10 | return new First(expression); 11 | } 12 | 13 | public static Last Last( 14 | this IListExpression expression) 15 | { 16 | return new Last(expression); 17 | } 18 | 19 | public static TakeFirst TakeFirst( 20 | this IListExpression expression, 21 | IExpression count) 22 | { 23 | return new TakeFirst(expression, count); 24 | } 25 | 26 | public static TakeLast TakeLast( 27 | this IListExpression expression, 28 | IExpression count) 29 | { 30 | return new TakeLast(expression, count); 31 | } 32 | 33 | public static IListExpression ConcatList( 34 | this IListExpression expression, 35 | params IListExpression[] expressions) 36 | 37 | { 38 | return expressions.Aggregate(expression, 39 | (current, listExpression) => new ConcatList(current, listExpression)); 40 | } 41 | 42 | public static GetValue GetValue( 43 | this IListExpression expression, 44 | IExpression index) 45 | { 46 | return new GetValue(expression, index); 47 | } 48 | } -------------------------------------------------------------------------------- /Expressions/List/ListOperators/First.cs: -------------------------------------------------------------------------------- 1 | namespace Aptacode.Expressions.List.ListOperators; 2 | 3 | /// 4 | /// The class for the operation of getting the first expression in a list expression. 5 | /// 6 | /// 7 | /// 8 | public record First 9 | (IListExpression Expression) : UnaryListItemExpression(Expression) 10 | 11 | { 12 | public override TType Interpret(TContext context) 13 | { 14 | var list = Expression.Interpret(context); 15 | return list.Length != 0 ? list[0] : default; 16 | } 17 | } -------------------------------------------------------------------------------- /Expressions/List/ListOperators/GetValue.cs: -------------------------------------------------------------------------------- 1 | namespace Aptacode.Expressions.List.ListOperators; 2 | 3 | /// 4 | /// The class for the operation of getting an expression at a given index in a list expression. 5 | /// 6 | /// 7 | /// 8 | public record GetValue(IListExpression Expression, 9 | IExpression IndexExpression) : UnaryListItemExpression(Expression) 10 | 11 | { 12 | public override TType Interpret(TContext context) 13 | { 14 | var list = Expression.Interpret(context); 15 | var index = IndexExpression.Interpret(context); 16 | 17 | return list.Length <= index ? list[0] : Expression.Interpret(context)[IndexExpression.Interpret(context)]; 18 | } 19 | } -------------------------------------------------------------------------------- /Expressions/List/ListOperators/Last.cs: -------------------------------------------------------------------------------- 1 | using System.Linq; 2 | 3 | namespace Aptacode.Expressions.List.ListOperators; 4 | 5 | /// 6 | /// The class for the operation of getting the last expression in a list expression. 7 | /// 8 | /// 9 | /// 10 | public record Last 11 | (IListExpression Expression) : UnaryListItemExpression(Expression) 12 | 13 | { 14 | public override TType Interpret(TContext context) 15 | { 16 | var list = Expression.Interpret(context); 17 | return list.Length != 0 ? list.Last() : default; 18 | } 19 | } -------------------------------------------------------------------------------- /Expressions/List/ListOperators/TakeFirst.cs: -------------------------------------------------------------------------------- 1 | using System.Linq; 2 | 3 | namespace Aptacode.Expressions.List.ListOperators; 4 | 5 | /// 6 | /// The class for the operation of getting the first n expressions in a list expression. 7 | /// 8 | /// 9 | /// 10 | public record TakeFirst(IListExpression Expression, 11 | IExpression CountExpression) : UnaryListExpression(Expression) 12 | 13 | { 14 | public override TType[] Interpret(TContext context) 15 | { 16 | var list = Expression.Interpret(context); 17 | var count = CountExpression.Interpret(context); 18 | 19 | return list.Length <= count 20 | ? list 21 | : Expression.Interpret(context).Take(CountExpression.Interpret(context)).ToArray(); 22 | } 23 | } -------------------------------------------------------------------------------- /Expressions/List/ListOperators/TakeLast.cs: -------------------------------------------------------------------------------- 1 | using System.Linq; 2 | using Aptacode.Expressions.Utilities; 3 | 4 | namespace Aptacode.Expressions.List.ListOperators; 5 | 6 | /// 7 | /// The class for the operation of getting the last m expressions in a list expression. 8 | /// 9 | /// 10 | /// 11 | public record TakeLast(IListExpression Expression, 12 | IExpression CountExpression) : UnaryListExpression(Expression) 13 | 14 | { 15 | public override TType[] Interpret(TContext context) 16 | { 17 | var list = Expression.Interpret(context); 18 | var count = CountExpression.Interpret(context); 19 | 20 | if (list.Length <= count) 21 | { 22 | return list; 23 | } 24 | 25 | return Expression.Interpret(context) 26 | .TakeLastItems(CountExpression.Interpret(context)).ToArray(); 27 | } 28 | } -------------------------------------------------------------------------------- /Expressions/List/TerminalListExpression.cs: -------------------------------------------------------------------------------- 1 | using Aptacode.Expressions.Visitor; 2 | 3 | namespace Aptacode.Expressions.List; 4 | 5 | public abstract record TerminalListExpression : IListExpression 6 | 7 | { 8 | public abstract TType[] Interpret(TContext context); 9 | 10 | public void Visit(IExpressionVisitor visitor) 11 | { 12 | visitor.Visit(this); 13 | } 14 | } -------------------------------------------------------------------------------- /Expressions/List/TernaryListExpression.cs: -------------------------------------------------------------------------------- 1 | using Aptacode.Expressions.Visitor; 2 | 3 | namespace Aptacode.Expressions.List; 4 | 5 | public abstract record TernaryListExpression(IExpression Condition, 6 | IListExpression PassExpression, 7 | IListExpression FailExpression) : IListExpression 8 | 9 | { 10 | public abstract T2[] Interpret(TContext context); 11 | 12 | public void Visit(IExpressionVisitor visitor) 13 | { 14 | visitor.Visit(this); 15 | } 16 | } -------------------------------------------------------------------------------- /Expressions/List/UnaryListExpression.cs: -------------------------------------------------------------------------------- 1 | using Aptacode.Expressions.Visitor; 2 | 3 | namespace Aptacode.Expressions.List; 4 | 5 | public abstract record UnaryListExpression 6 | (IListExpression Expression) : IListExpression 7 | 8 | { 9 | public abstract TType[] Interpret(TContext context); 10 | 11 | public void Visit(IExpressionVisitor visitor) 12 | { 13 | visitor.Visit(this); 14 | } 15 | } -------------------------------------------------------------------------------- /Expressions/List/UnaryListIntegerExpression.cs: -------------------------------------------------------------------------------- 1 | using Aptacode.Expressions.Visitor; 2 | 3 | namespace Aptacode.Expressions.List; 4 | 5 | public abstract record UnaryListIntegerExpression 6 | (IListExpression Expression) : IExpression 7 | 8 | { 9 | public abstract int Interpret(TContext context); 10 | 11 | public void Visit(IExpressionVisitor visitor) 12 | { 13 | visitor.Visit(this); 14 | } 15 | } -------------------------------------------------------------------------------- /Expressions/List/UnaryListItemExpression.cs: -------------------------------------------------------------------------------- 1 | using Aptacode.Expressions.Visitor; 2 | 3 | namespace Aptacode.Expressions.List; 4 | 5 | public abstract record UnaryListItemExpression 6 | (IListExpression Expression) : IExpression 7 | 8 | { 9 | public abstract TType Interpret(TContext context); 10 | 11 | public void Visit(IExpressionVisitor visitor) 12 | { 13 | visitor.Visit(this); 14 | } 15 | } -------------------------------------------------------------------------------- /Expressions/Logo.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Aptacode/Expressions/92a1f1249fa5dd80f32efb997855eb7cf4747d6c/Expressions/Logo.ico -------------------------------------------------------------------------------- /Expressions/String/ConstantString.cs: -------------------------------------------------------------------------------- 1 | using Aptacode.Expressions.GenericExpressions; 2 | 3 | namespace Aptacode.Expressions.String; 4 | 5 | public record ConstantString(string Value) : ConstantExpression(Value); -------------------------------------------------------------------------------- /Expressions/String/StringOperators/ConcatString.cs: -------------------------------------------------------------------------------- 1 | using Aptacode.Expressions.GenericArithmeticOperators; 2 | 3 | namespace Aptacode.Expressions.String.StringOperators; 4 | 5 | public record ConcatString 6 | (IExpression Lhs, IExpression Rhs) : Add(Lhs, Rhs); -------------------------------------------------------------------------------- /Expressions/String/StringOperators/StringOperatorExtensions.cs: -------------------------------------------------------------------------------- 1 | using System.Linq; 2 | using Aptacode.Expressions.GenericArithmeticOperators; 3 | 4 | namespace Aptacode.Expressions.String.StringOperators; 5 | 6 | public static class StringOperatorExtensions 7 | { 8 | public static IExpression ConcatString( 9 | this IExpression stringExpression, 10 | params IExpression[] stringExpressions) 11 | 12 | { 13 | return stringExpressions.Aggregate(stringExpression, 14 | (current, aggregateExpression) => new Add(current, aggregateExpression)); 15 | } 16 | } -------------------------------------------------------------------------------- /Expressions/Utilities/EnumerableExtensions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | 5 | namespace Aptacode.Expressions.Utilities; 6 | 7 | public static class EnumerableExtensions 8 | { 9 | public static IEnumerable TakeLastItems(this IEnumerable source, int count) 10 | { 11 | var tempList = source as T[] ?? source.ToArray(); 12 | return tempList.Skip(Math.Max(0, tempList.Length - count)); 13 | } 14 | } -------------------------------------------------------------------------------- /Expressions/Visitor/ExpressionVisitor.cs: -------------------------------------------------------------------------------- 1 | using Aptacode.Expressions.Bool; 2 | using Aptacode.Expressions.GenericExpressions; 3 | using Aptacode.Expressions.List; 4 | 5 | namespace Aptacode.Expressions.Visitor; 6 | 7 | public class ExpressionVisitor : IExpressionVisitor 8 | { 9 | #region Integer 10 | 11 | public virtual void Schedule(IExpression expression) 12 | 13 | { 14 | switch (expression) 15 | { 16 | case BinaryExpression binaryExpression: 17 | Visit(binaryExpression); 18 | break; 19 | case ConditionalExpression ternaryExpression: 20 | Visit(ternaryExpression); 21 | break; 22 | case TerminalExpression terminalExpression: 23 | Visit(terminalExpression); 24 | break; 25 | case UnaryListIntegerExpression listExpression: 26 | Visit(listExpression); 27 | break; 28 | } 29 | } 30 | 31 | public virtual void Visit(BinaryExpression expression) 32 | 33 | { 34 | expression.Lhs.Visit(this); 35 | expression.Rhs.Visit(this); 36 | } 37 | 38 | public virtual void Visit(ConditionalExpression expression) 39 | 40 | { 41 | expression.Condition.Visit(this); 42 | expression.FailExpression.Visit(this); 43 | expression.PassExpression.Visit(this); 44 | } 45 | 46 | public virtual void Visit(TerminalExpression expression) 47 | { 48 | } 49 | 50 | public void Visit(TernaryExpression expression) 51 | { 52 | expression.Condition.Visit(this); 53 | expression.PassExpression.Visit(this); 54 | expression.FailExpression.Visit(this); 55 | } 56 | 57 | public virtual void Visit(UnaryExpression expression) 58 | 59 | { 60 | expression.Expression.Visit(this); 61 | } 62 | 63 | public virtual void Visit(UnaryListIntegerExpression expression) 64 | 65 | { 66 | expression.Expression.Visit(this); 67 | } 68 | 69 | #endregion 70 | 71 | #region Bool 72 | 73 | public virtual void Schedule(IExpression expression) 74 | { 75 | switch (expression) 76 | { 77 | case NaryBoolExpression naryBoolExpression: 78 | Visit(naryBoolExpression); 79 | break; 80 | } 81 | } 82 | 83 | public virtual void Visit(NaryBoolExpression expression) 84 | { 85 | foreach (var innerExpression in expression.Expressions) 86 | { 87 | innerExpression.Visit(this); 88 | } 89 | } 90 | 91 | public virtual void Visit(BinaryBoolComparison expression) 92 | 93 | { 94 | expression.Lhs.Visit(this); 95 | expression.Rhs.Visit(this); 96 | } 97 | 98 | #endregion 99 | 100 | #region List 101 | 102 | public virtual void Schedule(IListExpression expression) 103 | 104 | { 105 | switch (expression) 106 | { 107 | case UnaryListExpression unaryListExpression: 108 | Visit(unaryListExpression); 109 | break; 110 | case BinaryListExpression binaryListExpression: 111 | Visit(binaryListExpression); 112 | break; 113 | case ConditionalListExpression ternaryListExpression: 114 | Visit(ternaryListExpression); 115 | break; 116 | case TerminalListExpression terminalListExpression: 117 | Visit(terminalListExpression); 118 | break; 119 | } 120 | } 121 | 122 | public virtual void Visit(UnaryListExpression expression) 123 | 124 | { 125 | expression.Expression.Visit(this); 126 | } 127 | 128 | public virtual void Visit(BinaryListExpression expression) 129 | 130 | { 131 | expression.Lhs.Visit(this); 132 | expression.Rhs.Visit(this); 133 | } 134 | 135 | public virtual void Visit(TernaryListExpression expression) 136 | 137 | { 138 | expression.Condition.Visit(this); 139 | expression.FailExpression.Visit(this); 140 | expression.PassExpression.Visit(this); 141 | } 142 | 143 | public virtual void Visit(TerminalListExpression expression) 144 | { 145 | } 146 | 147 | public void Visit(UnaryListItemExpression expression) 148 | 149 | { 150 | expression.Expression.Visit(this); 151 | } 152 | 153 | #endregion 154 | } -------------------------------------------------------------------------------- /Expressions/Visitor/IExpressionVisitor.cs: -------------------------------------------------------------------------------- 1 | using Aptacode.Expressions.Bool; 2 | using Aptacode.Expressions.GenericExpressions; 3 | using Aptacode.Expressions.List; 4 | 5 | namespace Aptacode.Expressions.Visitor; 6 | 7 | public interface IExpressionVisitor 8 | { 9 | #region List 10 | 11 | void Visit(UnaryListExpression expression); 12 | 13 | void Visit(BinaryListExpression expression); 14 | 15 | void Visit(TernaryListExpression expression); 16 | 17 | void Visit(TerminalListExpression expression); 18 | 19 | void Visit(UnaryListItemExpression expression); 20 | 21 | void Visit(UnaryListIntegerExpression expression); 22 | 23 | #endregion 24 | 25 | #region Integer 26 | 27 | void Visit(UnaryExpression expression); 28 | 29 | void Visit(BinaryExpression expression); 30 | 31 | void Visit(ConditionalExpression expression); 32 | 33 | void Visit(TerminalExpression expression); 34 | 35 | void Visit(TernaryExpression expression); 36 | 37 | #endregion 38 | 39 | #region Bool 40 | 41 | void Visit(BinaryBoolComparison expression); 42 | 43 | void Visit(NaryBoolExpression expression); 44 | 45 | #endregion 46 | } -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 Aptacode 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |

2 |

3 | 4 |
5 |

6 | 7 | 8 | [![tests](https://github.com/Aptacode/Expressions/actions/workflows/test.yml/badge.svg)](https://github.com/Aptacode/Expressions/actions/workflows/test.yml) 9 | [![code metrics](https://github.com/Aptacode/Geometry/actions/workflows/metrics.yml/badge.svg)](https://github.com/Aptacode/Geometry/blob/main/CODE_METRICS.md) 10 | [![code quality](https://app.codacy.com/project/badge/Grade/fbc700bba83c476da496c11e718f9ad4)](https://www.codacy.com/gh/Aptacode/Expressions/dashboard?utm_source=github.com&utm_medium=referral&utm_content=Aptacode/Expressions&utm_campaign=Badge_Grade) 11 | [![nuget](https://img.shields.io/nuget/v/Aptacode.Expressions.svg?style=flat&color=brightgreen)](https://www.nuget.org/packages/Aptacode.Expressions/) 12 | ![last commit](https://img.shields.io/github/last-commit/Aptacode/Expressions?style=flat&cacheSeconds=86000&color=brightgreen) 13 | [![License: MIT](https://img.shields.io/badge/License-MIT-brightgreen.svg)](https://opensource.org/licenses/MIT) 14 | 15 | Whilst originally designed to be used to represent and determine connection weights in [StateNet](https://github.com/Aptacode/StateNet), Expressions is a C# library used for writing and evaluating [expressions](https://en.wikipedia.org/wiki/Expression_(computer_science)) in a given context. 16 | 17 | ## Overview 18 | 19 | Expressions can be used to write simple expressions: 20 | 21 | ```csharp 22 | var Expression = new ConstantInteger(1) //An expression representing the int value 1 23 | ``` 24 | 25 | As well as more complex nested expressions: 26 | 27 | ```csharp 28 | var Expression = new And( //An expression following the usual boolean logic of the 'and' operator 29 | new GreaterThan( //An expression for the comparison operator >, this will evaluate to true as 4 > 1 30 | new ConstantInteger(4), new ConstantInteger(1)), 31 | new EqualTo(new ConstantInteger(1), new ConstantInteger(1))); //An expression for the equality operator. 32 | ``` 33 | To evaluate these expressions into the correct context, the Expressions library utilises the Interpreter design pattern; Every expression type has an `.Interpret(context)` method. When called on a given context, any non-terminal expressions will recursively call `.Interpret(context)` (passing through the same context) on the expressions within them until a terminal expression is reached. Terminal expressions can then be evaluated to their respective values and value types in the given context. These in turn are passed on to the containing non-terminal expressions until the expression is completely evaluated. 34 | 35 | 36 | ## ExpressionFactory 37 | 38 | Building complex expressions manually can be a bit messy syntactically and so there is also an `ExpressionFactory` class. 39 | 40 | ```csharp 41 | public readonly ExpressionFactory _ex = new ExpressionFactory(); 42 | var one = _ex.Int(1); //Creates a new ConstantInteger expression with value 1 43 | var true = new _ex.Bool(true); //Creates a new ConstantBool expression with value true 44 | var SevenIsGreaterThanFive = new _ex.GreaterThan(_ex.Int(7), _ex.Int(5)); //This is much tidier than the basic implementation 45 | ``` 46 | 47 | A more complicated example highlights the improvement in conciseness: 48 | 49 | ```csharp 50 | public readonly ExpressionFactory _expressions = new ExpressionFactory(); 51 | var fibListExpression = _expressions.List(new int[] { 1, 1, 2, 3, 5, 8 }); 52 | 53 | for(int i = 0; i < 20; i++) 54 | { 55 | fibListExpression = _expressions.List(_expressions.ConditionalList(_expressions.LessThan(_expressions.Last(fibListExpression), _expressions.Int(100)), 56 | _expressions.Append(fibListExpression, 57 | _expressions.Add(_expressions.First(_expressions.TakeLast(fibListExpression, _expressions.Int(2))), 58 | _expressions.Last(_expressions.TakeLast(fibListExpression, _expressions.Int(2))))), 59 | fibListExpression).Interpret(_context)); //An expression that when intepreted will add the next number in the fibonacci sequence to the list as long as that number is less than 100 and return the list as an expression or will just return the list as an expression if the next number is greater than 100. 60 | } 61 | 62 | 63 | var fibLessThan100 = fibListExpression.Interpret(_context); //Interpreting the expression above will return a list of containing the numbers in the Fibonacci sequence less than 100. 64 | ``` 65 | 66 | ## Fluent API 67 | 68 | In the above example operators on our expressions such as `_expressions.Add()` are to the left of a pair of expressions `(lhs, rhs)` that is acted on by an operator i.e 69 | 70 | ```csharp 71 | var addEx = _expressions.Add(_expressions.Int(2), _expressions.Int(2); 72 | ``` 73 | 74 | Using the roman alphabet we are more used to reading from left to right and so the above expression can still be a little tricky to read, especially when the arguments are also complicated expressions. To improve this we also have a more fluent API for our operators. With this the above expression becomes: 75 | 76 | ```csharp 77 | var addEx = _expressions.Int(2).Add(_expressions.Int(2)); 78 | ``` 79 | 80 | ## Usage and Examples 81 | 82 | ### Constant Expressions 83 | 84 | Constant expressions of any type can be created using the generic `ConstantExpression`: 85 | 86 | ```csharp 87 | var ConstantExpression = new ConstantExpression(TType a); //An expression 'a' of some generic type 88 | ``` 89 | And also using the `ExpressionFactory`: 90 | 91 | ```csharp 92 | public readonly ExpressionFactory _expressions = new ExpressionFactory(); 93 | 94 | var ConstantExpression = _expressions.Expression(TType a); 95 | ``` 96 | 97 | We can also create various type specific constant expressions: 98 | 99 | ```csharp 100 | var ConstantFloatEx = _expressions.Float(3.14f); // An expression representing the float value 3.14 101 | var ConstantColorEx = _expressions.Color(System.Drawing.Color.Red); // An expression representing the color red 102 | var ConstantGuidEx = _expressions.Guid(Guid.NewGuid()); // An expression representing a constant guid 103 | ``` 104 | 105 | We can also make constant lists that can be used to represent expressions of lists of any generic type: 106 | 107 | ```csharp 108 | var ConstantListExpression = _expressions.List(TType[] list); //An expression representing a list of some generic type 109 | ``` 110 | 111 | ### Arithmetic Operators 112 | 113 | Arithmetic operations can act on expressions of any type with the `GenericArithmeticOperators`, though care must be exercised to ensure [the operators are implemented on the given type properly](https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/operators/operator-overloading): 114 | 115 | ```csharp 116 | var AddExpression = new Add(IExpression a, IExpression b); //An expression representing addition on the expressions a & b: a + b 117 | ``` 118 | 119 | With the fluent API and `ExpressionFactory` we also have: 120 | 121 | ```csharp 122 | public readonly ExpressionFactory _expressions = new ExpressionFactory(); 123 | 124 | var SubtractExpression = _ex.Expression(a).Subtract(_ex.Expression(b)); //An expression representing subtraction on the expressions a & b: a - b 125 | var MultiplyExpression = _ex.Expression(a).Multiply(_ex.Expression(b));; //An expression representing multiplication on the expressions a & b: a * b 126 | ``` 127 | 128 | Above we can see that the type can be inferred by the operator but if we want to be more explicit again there are also type specific variations of these operators: 129 | 130 | ```csharp 131 | var AddFloatExpression = _expressions.Float(2.72f).AddFloat(_expressions.Float(1.41f)); //An expression representing addition of two floats: 2.72 + 1.41 132 | var SubtractDecimalExpression = _expressions.Decimal(2.6m).SubtractDecimal(_expressions.Decimal(1.9m)); //An expression respresenting subtraction of the right float from the left: 2.6 - 1.3 133 | var MultiplyDoubleExpression =_expressions.Double(1.2).MultiplyDouble(_expressions.Double(3.4)); //An expression representing the multiplication of two doubles: 1.2 * 3.4 134 | ``` 135 | 136 | There is also the special case of string concatenation that can be considered as the addition operator acting on string expressions: 137 | 138 | ```csharp 139 | var ConcatStringExpression = _expressions.String(foo).ConcatString(_expressions.String(bar)); //An expression representing the concatenation (addition) of two string expressions: 'foo' + 'bar' 140 | ``` 141 | 142 | ### Boolean Relational Operators and Equality Operators 143 | 144 | Similarly to the arithmetic operators, expressions with boolean relational operators can be made on any given type, though - again - care must be taken to ensure the [operators are properly implemented on the type](https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/operators/comparison-operators#operator-overloadability): 145 | 146 | ```csharp 147 | var GreaterThanExpression = new GreaterThan(IExpression a, IExpression b); // An expression representing the comparison 'a > b' 148 | ``` 149 | 150 | Using the the fluent API and `ExpressionFactory`: 151 | 152 | ```csharp 153 | public readonly ExpressionFactory _expressions = new ExpressionFactory(); 154 | 155 | 156 | var LessThanExpression = _expressions.Expression(a).LessThan(_expressions.Expression(b)); //An expression representing the comparison a < b 157 | var GreaterThanOrEqualToExpression = _expressions.Expression(a).GreaterThan(_expressions.Expression(b)); // An expression representing the comparison a >= b 158 | var LessThanOrEqualToExpression = _expressions.Expression(a).LessThanOrEqualTo(_expressions.Expression(b)); // An expression representing the comparison a <= b 159 | ``` 160 | 161 | Similarly, expressions with boolean equality operators can be made on any given type: 162 | 163 | ```csharp 164 | var EqualToExpression = _expressions.Expression(a).EqualTo(_expressions.Expression(b)); //An expression represent the comparison 'a == b' 165 | var NotEqualToExpression = _expressions.Expression(a).NotEqualTo(_expressions.Expression(b)); //An expression represent the comparison 'a != b' 166 | ``` 167 | 168 | ### Boolean Logical Operators 169 | 170 | For boolean expressions we have the usual boolean logical operators. Using the fluent API and `ExpressionFactory`: 171 | 172 | ```csharp 173 | public readonly ExpressionFactory _expressions = new ExpressionFactory(); 174 | 175 | var OrExpression = _expressions.Bool(true).Or(_expressions.Bool(false)); //An expression representing the boolean expression 'true OR false' 176 | var NotExpression = _expressions.Bool(true).Not(); //An expression representing the boolean expression 'NOT true' 177 | var AndExpression = _expressions.Bool(true).And(_expressions.Bool(false)); //An expression representing the boolean expression 'true AND false' 178 | var XOrExpression = _expressions.Bool(true).XOr(_expressions.Bool(false)); //An expression representing the boolean expression 'true XOR false' 179 | ``` 180 | 181 | There are also the `All` and `Any` operations that are equivalent to the boolean logic operations NAND and NOR, respectively: 182 | 183 | ```csharp 184 | var AllExpression = _expressions.Bool(true).All(_expressions.Bool(true), _expressions.Bool(false)); //An expression respresenting the boolean expression 'true AND true AND false' 185 | var AnyExpression = _expressions.Bool(true).Any(_expressions.Bool(true), _expressions.Bool(false)); //An expression respresenting the boolean expression 'true OR true OR false' 186 | ``` 187 | 188 | 189 | ### List Operators 190 | 191 | For list expressions we also have some of the usual list operations. Using the fluent API and `ExpressionFactory`: 192 | 193 | ```csharp 194 | public readonly ExpressionFactory _expressions = new ExpressionFactory(); 195 | 196 | var list1 = new TType[] { a, b }; 197 | var list2 = new TType[] { c, d }; 198 | var ConcatListExpression = _expressions.List(list1).ConcatList(list2); //A list expression representing the concatenation of two list expressions 'list1 + list2' 199 | var FirstExpression = _expressions.List(list1).First(); //An expression representing the first item in the list 200 | var LastExpression = _expressions.List(list1).Last(); //An expression representing the last item in the list 201 | var TakeFirstExpression = _expressions.List(list1).TakeFirst(_expressions.Int(n)); //A list expression of the first n items in 'list1' 202 | var TakeLastExpression = _expressions.List(list1).TakeLast(_expressions.Int(m)); //A list expression of the last m items in 'list1' 203 | var CountExpression = _expressions.List(list1).Count(); //An integer expression representing the number of items in the list 204 | ``` 205 | 206 | ## License 207 | [MIT](https://choosealicense.com/licenses/mit/) 208 | -------------------------------------------------------------------------------- /Resources/Banner.afdesign: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Aptacode/Expressions/92a1f1249fa5dd80f32efb997855eb7cf4747d6c/Resources/Banner.afdesign -------------------------------------------------------------------------------- /Resources/Banner.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Aptacode/Expressions/92a1f1249fa5dd80f32efb997855eb7cf4747d6c/Resources/Banner.jpg -------------------------------------------------------------------------------- /Resources/Banner.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Aptacode/Expressions/92a1f1249fa5dd80f32efb997855eb7cf4747d6c/Resources/Banner.png -------------------------------------------------------------------------------- /Resources/Logo.afdesign: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Aptacode/Expressions/92a1f1249fa5dd80f32efb997855eb7cf4747d6c/Resources/Logo.afdesign -------------------------------------------------------------------------------- /Resources/Logo.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Aptacode/Expressions/92a1f1249fa5dd80f32efb997855eb7cf4747d6c/Resources/Logo.ico -------------------------------------------------------------------------------- /Resources/Logo128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Aptacode/Expressions/92a1f1249fa5dd80f32efb997855eb7cf4747d6c/Resources/Logo128.png -------------------------------------------------------------------------------- /Resources/Logo256.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Aptacode/Expressions/92a1f1249fa5dd80f32efb997855eb7cf4747d6c/Resources/Logo256.png --------------------------------------------------------------------------------