Page MenuHomeDevCentral

Provide boolean object to compute
ClosedPublic

Authored by dereckson on Jul 2 2023, 18:16.
Tags
None
Referenced Files
F3787635: D3222.id8257.diff
Tue, Nov 26, 18:55
Unknown Object (File)
Sat, Nov 23, 03:34
Unknown Object (File)
Sat, Nov 23, 03:33
Unknown Object (File)
Fri, Nov 22, 23:00
Unknown Object (File)
Wed, Nov 20, 13:58
Unknown Object (File)
Wed, Nov 20, 13:42
Unknown Object (File)
Sun, Nov 17, 17:11
Unknown Object (File)
Sun, Nov 17, 16:52
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 Passed
Unit
Tests Passed
Branch
booleans
Build Status
Buildable 5079
Build 5360: arc lint + arc unit