Class FieldIntervalND<T extends Comparable<T>>

All Implemented Interfaces:
Interval<T>

public class FieldIntervalND<T extends Comparable<T>> extends RingIntervalND<T>
N-dimensional interval over a Field (elements support full arithmetic).

Extends RingIntervalND by requiring elements to form a Field structure, enabling operations that depend on division (like computing the center/midpoint of each dimension).

A Field requires all Ring operations plus:

  • Division: (a / b) for b ≠ 0
  • Multiplicative inverse

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

    • FieldIntervalND

      public FieldIntervalND(T[] min, T[] max, boolean[] closedLeft, boolean[] closedRight, BinaryOperator<T> adder, BinaryOperator<T> subtractor, BinaryOperator<T> divider, Function<Integer,T> fromInt)
      Creates an N-dimensional Field 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
      adder - function to compute (a + b)
      subtractor - function to compute (a - b)
      divider - function to compute (a / b)
      fromInt - function to create element from integer (for computing 2 in midpoint)
    • FieldIntervalND

      public FieldIntervalND(T[] min, T[] max, BinaryOperator<T> adder, BinaryOperator<T> subtractor, BinaryOperator<T> divider, Function<Integer,T> fromInt)
      Creates a closed N-dimensional Field interval [min, max].
    • FieldIntervalND

      public FieldIntervalND(T min, T max, boolean closedLeft, boolean closedRight, BinaryOperator<T> adder, BinaryOperator<T> subtractor, BinaryOperator<T> divider, Function<Integer,T> fromInt)
      Creates a 1-dimensional Field interval.
    • FieldIntervalND

      public FieldIntervalND(T min, T max, BinaryOperator<T> adder, BinaryOperator<T> subtractor, BinaryOperator<T> divider, Function<Integer,T> fromInt)
      Creates a closed 1-dimensional Field interval [min, max].
  • Method Details

    • getMidpoint

      public T getMidpoint(int dimension)
      Returns the midpoint (center) in the specified dimension.

      Computed as (min + max) / 2 using the Field's arithmetic operations.

      Parameters:
      dimension - the dimension index (0-based)
      Returns:
      the midpoint value in that dimension
    • getMidpoints

      public T[] getMidpoints()
      Returns the midpoints (center) in all dimensions.
      Returns:
      array of midpoint values for each dimension
    • getAdder

      public BinaryOperator<T> getAdder()
      Returns the adder operator.
    • getDivider

      public BinaryOperator<T> getDivider()
      Returns the divider operator.
    • getFromInt

      public Function<Integer,T> getFromInt()
      Returns the fromInt converter.
    • 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 RingIntervalND<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 RingIntervalND<T extends Comparable<T>>
      Parameters:
      other - the interval to union with
      Returns:
      the bounding interval