Skip to content

Latest commit

 

History

History
52 lines (38 loc) · 1.29 KB

README.md

File metadata and controls

52 lines (38 loc) · 1.29 KB

bool - a simple boolean expression parser

evaluates simple boolean expressions.

  • TRUE, FALSE (constants)
  • AND, OR (boolean operations)
  • NOT (negation)
  • ( ) (parens)
  • arbitrary identifiers can be provided with a simple function. Names can be alphanumeric and _, must start with character or _.

Usage

    Function<String, Boolean> valueProvider = (name) -> {
        switch(name) {
            case "foo":
            case "bar":
                return Boolean.TRUE;
            case "baz":
            default:
                return Boolean.FALSE;
        }
    };

    BoolEval eval = new BoolEval("foo AND (bar OR NOT baz)");
    boolean result = eval.evaluate(valueProvider);

Maven

<dependency>
    <groupId>de.softwareforge</groupId>
    <artifactId>bool</artifactId>
    <version>1.0.0</version>
</dependency>

Changes

Keep a Changelog v1.0.0.

Unreleased

Version 1.0.0 (2020-06-24)

Added

  • First release

Build StatusLatest Release