Interface RingElement<E extends RingElement<E>>

All Known Subinterfaces:
FieldElement<E>
All Known Implementing Classes:
Complex, Integer, NativeRealBig, Rational, Real, RealBig, RealDouble, RealFloat

public interface RingElement<E extends RingElement<E>>
Marker interface for elements of a ring structure.

A ring element supports addition, multiplication, and negation operations as instance methods. This interface uses F-bounded polymorphism (self-typing) to ensure type safety: operations return the same type as the implementing class.

Ring Axioms

Elements must satisfy:

    Since:
    1.0
    Author:
    Silvere Martin-Michiellot, Gemini AI (Google DeepMind)
    • Method Summary

      Modifier and Type
      Method
      Description
      add(E other)
      Returns the sum of this element and another.
      default boolean
      Checks if this element is the multiplicative identity (one).
      default boolean
      Checks if this element is the additive identity (zero).
      multiply(E other)
      Returns the product of this element and another.
      Returns the additive inverse of this element.
      one()
      Returns the multiplicative identity element (one).
      default E
      subtract(E other)
      Returns the difference of this element and another.
      Returns the additive identity element (zero).
    • Method Details

      • add

        E add(E other)
        Returns the sum of this element and another.
        Parameters:
        other - the element to add
        Returns:
        this + other
      • multiply

        E multiply(E other)
        Returns the product of this element and another.
        Parameters:
        other - the element to multiply
        Returns:
        this * other
      • negate

        E negate()
        Returns the additive inverse of this element.
        Returns:
        -this
      • subtract

        default E subtract(E other)
        Returns the difference of this element and another.

        Default implementation: this.add(other.negate())

        Parameters:
        other - the element to subtract
        Returns:
        this - other
      • zero

        E zero()
        Returns the additive identity element (zero).

        For any element e: e.add(e.zero()) = e

        Returns:
        the zero element
      • one

        E one()
        Returns the multiplicative identity element (one).

        For any element e: e.multiply(e.one()) = e

        Returns:
        the one element
      • isZero

        default boolean isZero()
        Checks if this element is the additive identity (zero).
        Returns:
        true if this equals zero()
      • isOne

        default boolean isOne()
        Checks if this element is the multiplicative identity (one).
        Returns:
        true if this equals one()