Class RingIntervalND<T extends Comparable<T>>

java.lang.Object
org.episteme.core.mathematics.algebra.intervals.OrderedSetIntervalND<T>
org.episteme.core.mathematics.algebra.intervals.RingIntervalND<T>
All Implemented Interfaces:
Interval<T>
Direct Known Subclasses:
FieldIntervalND

public class RingIntervalND<T extends Comparable<T>> extends OrderedSetIntervalND<T>
N-dimensional interval over a Ring (elements support addition and subtraction).

Extends the capabilities of OrderedSetIntervalND by requiring elements to form a Ring structure, enabling operations that depend on subtraction (like computing the width/extent in each dimension).

A Ring requires:

  • Addition: (a + b)
  • Additive inverse/subtraction: (a - b)
  • Multiplication: (a × b)
  • Additive identity (zero)
  • Multiplicative identity (one)

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

    • RingIntervalND

      public RingIntervalND(T[] min, T[] max, boolean[] closedLeft, boolean[] closedRight, BinaryOperator<T> subtractor)
      Creates an N-dimensional Ring interval with specified bounds.
      Parameters:
      min - array of minimum values for each dimension
      max - array of maximum values for each dimension
      closedLeft - array indicating if left endpoints are closed
      closedRight - array indicating if right endpoints are closed
      subtractor - function to compute (a - b) for elements
    • RingIntervalND

      public RingIntervalND(T[] min, T[] max, BinaryOperator<T> subtractor)
      Creates a closed N-dimensional Ring interval [min, max].
    • RingIntervalND

      public RingIntervalND(T min, T max, boolean closedLeft, boolean closedRight, BinaryOperator<T> subtractor)
      Creates a 1-dimensional Ring interval.
    • RingIntervalND

      public RingIntervalND(T min, T max, BinaryOperator<T> subtractor)
      Creates a closed 1-dimensional Ring interval [min, max].
  • Method Details

    • getWidth

      public T getWidth(int dimension)
      Returns the width (extent) in the specified dimension.

      Computed as max - min using the Ring's subtraction operation.

      Parameters:
      dimension - the dimension index (0-based)
      Returns:
      the width (max - min) in that dimension
    • getWidths

      public T[] getWidths()
      Returns the widths in all dimensions.
      Returns:
      array of widths for each dimension
    • getSubtractor

      public BinaryOperator<T> getSubtractor()
      Returns the subtraction operator used by this interval.
      Returns:
      the binary subtraction operator
    • intersection

      public Interval<T> intersection(Interval<T> other)
      Description copied from interface: Interval
      Returns the intersection of this interval with another.
      Specified by:
      intersection in interface Interval<T extends Comparable<T>>
      Overrides:
      intersection in class OrderedSetIntervalND<T extends Comparable<T>>
      Parameters:
      other - the interval to intersect with
      Returns:
      the intersection interval, or null if empty
    • boundingInterval

      public Interval<T> boundingInterval(Interval<T> other)
      Description copied from interface: Interval
      Returns the smallest interval containing both this and another interval.
      Specified by:
      boundingInterval in interface Interval<T extends Comparable<T>>
      Overrides:
      boundingInterval in class OrderedSetIntervalND<T extends Comparable<T>>
      Parameters:
      other - the interval to union with
      Returns:
      the bounding interval