Page MenuHomeDevCentral

Provide boolean object to compute
ClosedPublic

Authored by dereckson on Jul 2 2023, 18:16.
Tags
None
Referenced Files
F3928777: D3222.id8258.diff
Sun, Dec 22, 06:08
Unknown Object (File)
Sat, Dec 21, 20:09
Unknown Object (File)
Sat, Dec 21, 19:50
Unknown Object (File)
Sat, Dec 21, 04:35
Unknown Object (File)
Mon, Dec 16, 05:29
Unknown Object (File)
Sun, Dec 15, 04:23
Unknown Object (File)
Thu, Dec 12, 19:05
Unknown Object (File)
Sun, Dec 8, 18:17
Subscribers
None

Details

Summary

The Boolean objet allows to represent a boolean and perform logical operations.

Allow to apply the main logical operations:

  • and()
  • or()
  • not()

Allow to apply logical secondary operations:

  • xor()
  • implication()
  • equivalence()

Allow to convert to other scalar types:

  • asBool()
  • asInteger() when you need 0 or 1
  • asString() for debug representation

*Use case*

The main motivation is $result &= $callback() uses the bitwise operator &
and as such will return 0 or 1 instead of true and false.

With Boolean, $result.and($callback()) will work as expected.

Test Plan

Unit tests provided

Equivalence tables have been checked against the English Wikipedia
article Boolean algebra.

Diff Detail

Repository
rKERUALD Keruald libraries development repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable