Proviant 1.0.1

There is a newer version of this package available.
See the version list below for details.
Install-Package Proviant -Version 1.0.1
dotnet add package Proviant --version 1.0.1
<PackageReference Include="Proviant" Version="1.0.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Proviant --version 1.0.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Proviant, 1.0.1"
#r directive can be used in F# Interactive, C# scripting and .NET Interactive. Copy this into the interactive tool or source code of the script to reference the package.
// Install Proviant as a Cake Addin
#addin nuget:?package=Proviant&version=1.0.1

// Install Proviant as a Cake Tool
#tool nuget:?package=Proviant&version=1.0.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

Proviant Build Status Nuget

Proviant is a framework which evaluate boolean-expressions with the help of the Shunting-yard algorithm.

Features

  • Calculating boolean-algebra expression
  • Generating a truth table for a boolean expression
  • Create your own expression evaluator for a specific gramma.

Supported opertaors

Operatorname Symbol Precedence Is unary
NOT 5 true
AND 4 false
NAND 4 false
OR 3 false
NOR 3 false
Material Implecation 2 false
Material Eqvivalence 1 false

Usage

Boolean Algebra

Evaluate a common boolean expression

Add using:

using Proviant;

Till now the tokens in an expression string need to be seperated by a whitespace. Create a new expression:

// A boolean expression.
string expressionString = "false or true and ( false ⇔ false )";
// Create a new BooleanAlgebraExpression instance.
var expr = new BooleanAlgebraExpression(expressionString);

// Evaluate expression.
// Result will be true.
bool result = expr.Evaluate();
Generating a truth-table
// A boolean expression.
string expressionString = "A or B and C";
// Create a new BooleanAlgebraExpression instance.
var expr = new BooleanAlgebraExpression(expressionString);

// returns TruthTable class.
var truthTable = expr.GenerateTruthTable();

The truth-table would look like:

A B C Y
0 0 0 0
0 0 1 0
0 1 0 0
0 1 1 1
1 0 0 1
1 0 1 1
1 1 0 1
1 1 1 1

1 = True
0 = False
Y = represents the evaluated result

TruthTable class documentation
Property Type Description
TruthRows TruthRows A truth row contains the state of each variable and the calculated result.
Rows int The total count of rows in this truth-table.
Colums int The total count of colums in this truth-table.
TruthRow class documentation
Property Type Description
Operands Dictionary<string, bool> A dictionary of operand and it's current state. The key is the operand. The value represents the state of the operand.
EvaluatedResult bool The evaluated result.
  • .NETStandard 2.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.1.4 2,837 3/28/2019
1.1.3 323 3/27/2019
1.1.2 282 3/25/2019
1.1.1 293 3/25/2019
1.1.0 300 3/25/2019
1.0.8 312 3/22/2019
1.0.7 286 3/21/2019
1.0.6 280 3/21/2019
1.0.5 280 3/19/2019
1.0.4 290 3/18/2019
1.0.3 284 3/18/2019
1.0.2 341 3/15/2019
1.0.1 318 3/15/2019
1.0.0 329 3/13/2019

- Added missing documentation.
- Small bug fixes and improvements.