compareTo

public int compareTo(@NotNull() @NotNull() Box<T> o)

Note that in classical interval arithmetic no total ordering relation is defined over intervals. Nevertheless, a strict partial ordering does exist, so I decided to support it, and to make the function total by failing at runtime when a comparison cannot be made. A summary of the logic is the following:

  • this.sup < o.inf => compare
  • this.inf > o.sup => compare
  • o is null || o is contained in this => error

Return

a number corresponding to the result of the comparison

Parameters

o

target interval of the comparison

Throws

if the specified object is null

if the specified object's type prevents it

if the interval cannot be compared