Class Boolean

java.lang.Object
org.episteme.core.mathematics.numbers.integers.Boolean
All Implemented Interfaces:
Comparable<Boolean>, Iterable<Boolean>, AbelianMonoid<Boolean>, Magma<Boolean>, Monoid<Boolean>, Lattice<Boolean>, Semiring<Boolean>, FiniteSet<Boolean>, Set<Boolean>

public final class Boolean extends Object implements Semiring<Boolean>, Lattice<Boolean>, FiniteSet<Boolean>, Comparable<Boolean>
Boolean algebraic type - matches Real/Integer pattern.

Uses singleton pattern + instance methods (like Real). Fastest implementation: singletons + primitive operations.

* @author Silvere Martin-Michiellot
Since:
1.0
Author:
Gemini AI (Google DeepMind)
  • Field Details

    • TRUE

      public static final Boolean TRUE
    • FALSE

      public static final Boolean FALSE
  • Method Details

    • of

      public static Boolean of(boolean value)
    • booleanValue

      public boolean booleanValue()
    • add

      public Boolean add(Boolean other)
    • multiply

      public Boolean multiply(Boolean other)
    • not

      public Boolean not()
    • xor

      public Boolean xor(Boolean other)
    • add

      public Boolean add(Boolean a, Boolean b)
      Description copied from interface: AbelianMonoid
      Returns the sum of two elements (additive notation).

      Delegates to Magma.operate(Object, Object).

      Specified by:
      add in interface AbelianMonoid<Boolean>
      Parameters:
      a - the first addend
      b - the second addend
      Returns:
      a + b
    • zero

      public Boolean zero()
      Description copied from interface: AbelianMonoid
      Returns the additive identity (zero element).

      Delegates to AbelianMonoid.identity().

      Specified by:
      zero in interface AbelianMonoid<Boolean>
      Returns:
      the zero element
    • multiply

      public Boolean multiply(Boolean a, Boolean b)
      Description copied from interface: Semiring
      Returns the product of two elements.

      Multiplication must be associative and distribute over addition.

      Specified by:
      multiply in interface Semiring<Boolean>
      Parameters:
      a - the first factor
      b - the second factor
      Returns:
      a × b
    • one

      public Boolean one()
      Description copied from interface: Semiring
      Returns the multiplicative identity (one element).

      Satisfies: 1 × a = a × 1 = a for all elements a.

      Specified by:
      one in interface Semiring<Boolean>
      Returns:
      the multiplicative identity
    • isMultiplicationCommutative

      public boolean isMultiplicationCommutative()
      Description copied from interface: Semiring
      Tests whether multiplication is commutative in this semiring.
      Specified by:
      isMultiplicationCommutative in interface Semiring<Boolean>
      Returns:
      true if multiplication commutes
    • join

      public Boolean join(Boolean a, Boolean b)
      Description copied from interface: Lattice
      The join operation (∨, least upper bound).
      Specified by:
      join in interface Lattice<Boolean>
      Parameters:
      a - first operand
      b - second operand
      Returns:
      a ∨ b
    • meet

      public Boolean meet(Boolean a, Boolean b)
      Description copied from interface: Lattice
      The meet operation (∧, greatest lower bound).
      Specified by:
      meet in interface Lattice<Boolean>
      Parameters:
      a - first operand
      b - second operand
      Returns:
      a ∧ b
    • contains

      public boolean contains(Boolean element)
      Description copied from interface: Set
      Tests whether this set contains the specified element.

      This is the fundamental operation of a set - membership testing.

      Specified by:
      contains in interface Set<Boolean>
      Parameters:
      element - the element to test for membership
      Returns:
      true if this set contains the element, false otherwise
      See Also:
    • size

      public long size()
      Description copied from interface: FiniteSet
      Returns the number of elements in this set (its cardinality).
      Specified by:
      size in interface FiniteSet<Boolean>
      Returns:
      the cardinality of this set
    • iterator

      public Iterator<Boolean> iterator()
      Description copied from interface: FiniteSet
      Returns an iterator over the elements in this set.
      Specified by:
      iterator in interface FiniteSet<Boolean>
      Specified by:
      iterator in interface Iterable<Boolean>
      Returns:
      an iterator over the elements in this set
    • isEmpty

      public boolean isEmpty()
      Description copied from interface: Set
      Returns true if this set contains no elements.

      The empty set (∅) is a fundamental concept in set theory. It is the unique set containing no elements.

      Specified by:
      isEmpty in interface Set<Boolean>
      Returns:
      true if this set is empty
    • description

      public String description()
      Description copied from interface: Set
      Returns a human-readable description of this set.

      Examples:

      • "ℝ (Real Numbers)"
      • "ℤ/12ℤ (Integers modulo 12)"
      • "{1, 2, 3, 4, 5}"

      Specified by:
      description in interface Set<Boolean>
      Returns:
      a description of this set
    • operate

      public Boolean operate(Boolean left, Boolean right)
      Description copied from interface: Magma
      Performs the binary operation on two elements.

      This is the fundamental operation of a magma. The result must be an element of this magma (closure property).

      Properties: None required (not necessarily associative or commutative)

      Specified by:
      operate in interface Magma<Boolean>
      Parameters:
      left - the first operand
      right - the second operand
      Returns:
      the result of a ∗ b
      See Also:
    • compareTo

      public int compareTo(Boolean other)
      Specified by:
      compareTo in interface Comparable<Boolean>
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object