Class OrderedSetIntervalND<T extends Comparable<T>>

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

public class OrderedSetIntervalND<T extends Comparable<T>> extends Object implements Interval<T>
N-dimensional interval over an ordered set (elements must be Comparable).

This is the most basic interval implementation, requiring only that elements support comparison operations. Suitable for any totally ordered set.

Supports containment checks, subset testing, and overlap detection.

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

    Constructors
    Constructor
    Description
    OrderedSetIntervalND(T[] min, T[] max)
    Creates a closed N-dimensional interval [min, max].
    OrderedSetIntervalND(T[] min, T[] max, boolean[] closedLeft, boolean[] closedRight)
    Creates an N-dimensional interval with specified bounds and endpoint types.
    Creates a closed 1-dimensional interval [min, max].
    OrderedSetIntervalND(T min, T max, boolean closedLeft, boolean closedRight)
    Creates a 1-dimensional interval.
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns the smallest interval containing both this and another interval.
    boolean
    Checks if this interval contains another interval entirely.
    boolean
    contains(T[] point)
    Checks if a point is contained in this interval.
    boolean
     
    int
    Returns the number of dimensions of this interval.
    getMax(int dimension)
    Returns the upper bound in the specified dimension.
    getMin(int dimension)
    Returns the lower bound in the specified dimension.
    int
     
    Returns the intersection of this interval with another.
    boolean
    isClosedLeft(int dimension)
    Returns whether the lower endpoint is closed in the specified dimension.
    boolean
    isClosedRight(int dimension)
    Returns whether the upper endpoint is closed in the specified dimension.
    boolean
    Returns whether this interval is empty.
    Returns the standard mathematical notation for this interval.
    boolean
    Checks if this interval overlaps with another.
     

    Methods inherited from class Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait

    Methods inherited from interface Interval

    isClosed, isOpen
  • Constructor Details

    • OrderedSetIntervalND

      public OrderedSetIntervalND(T[] min, T[] max, boolean[] closedLeft, boolean[] closedRight)
      Creates an N-dimensional interval with specified bounds and endpoint types.
      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
    • OrderedSetIntervalND

      public OrderedSetIntervalND(T[] min, T[] max)
      Creates a closed N-dimensional interval [min, max].
    • OrderedSetIntervalND

      public OrderedSetIntervalND(T min, T max, boolean closedLeft, boolean closedRight)
      Creates a 1-dimensional interval.
    • OrderedSetIntervalND

      public OrderedSetIntervalND(T min, T max)
      Creates a closed 1-dimensional interval [min, max].
  • Method Details

    • getDimension

      public int getDimension()
      Description copied from interface: Interval
      Returns the number of dimensions of this interval.
      Specified by:
      getDimension in interface Interval<T extends Comparable<T>>
      Returns:
      the dimensionality (1 for 1D intervals, N for ND)
    • getMin

      public T getMin(int dimension)
      Description copied from interface: Interval
      Returns the lower bound in the specified dimension.
      Specified by:
      getMin in interface Interval<T extends Comparable<T>>
      Parameters:
      dimension - the dimension index (0-based)
      Returns:
      the minimum value in that dimension
    • getMax

      public T getMax(int dimension)
      Description copied from interface: Interval
      Returns the upper bound in the specified dimension.
      Specified by:
      getMax in interface Interval<T extends Comparable<T>>
      Parameters:
      dimension - the dimension index (0-based)
      Returns:
      the maximum value in that dimension
    • isClosedLeft

      public boolean isClosedLeft(int dimension)
      Description copied from interface: Interval
      Returns whether the lower endpoint is closed in the specified dimension.
      Specified by:
      isClosedLeft in interface Interval<T extends Comparable<T>>
      Parameters:
      dimension - the dimension index (0-based)
      Returns:
      true if the interval includes its minimum value in that dimension
    • isClosedRight

      public boolean isClosedRight(int dimension)
      Description copied from interface: Interval
      Returns whether the upper endpoint is closed in the specified dimension.
      Specified by:
      isClosedRight in interface Interval<T extends Comparable<T>>
      Parameters:
      dimension - the dimension index (0-based)
      Returns:
      true if the interval includes its maximum value in that dimension
    • contains

      public boolean contains(T[] point)
      Description copied from interface: Interval
      Checks if a point is contained in this interval.
      Specified by:
      contains in interface Interval<T extends Comparable<T>>
      Parameters:
      point - array of coordinates (must match dimensionality)
      Returns:
      true if the point is within the interval bounds
    • contains

      public boolean contains(Interval<T> other)
      Description copied from interface: Interval
      Checks if this interval contains another interval entirely.
      Specified by:
      contains in interface Interval<T extends Comparable<T>>
      Parameters:
      other - the interval to check
      Returns:
      true if other is a subset of this interval
    • overlaps

      public boolean overlaps(Interval<T> other)
      Description copied from interface: Interval
      Checks if this interval overlaps with another.
      Specified by:
      overlaps in interface Interval<T extends Comparable<T>>
      Parameters:
      other - the interval to check
      Returns:
      true if the intervals share at least one point
    • 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>>
      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>>
      Parameters:
      other - the interval to union with
      Returns:
      the bounding interval
    • isEmpty

      public boolean isEmpty()
      Description copied from interface: Interval
      Returns whether this interval is empty.
      Specified by:
      isEmpty in interface Interval<T extends Comparable<T>>
      Returns:
      true if the interval contains no elements
    • notation

      public String notation()
      Description copied from interface: Interval
      Returns the standard mathematical notation for this interval.
      Specified by:
      notation in interface Interval<T extends Comparable<T>>
      Returns:
      interval notation string (e.g., "[0,1] × (2,3]")
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • equals

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

      public int hashCode()
      Overrides:
      hashCode in class Object