public class NdRange
extends java.lang.Object
Comparable
object.
Any or all of the bounds may be missing (null); this indicates that no
bounds are in operation in that dimension, so that all values are
effectively inside it.Constructor | Description |
---|---|
NdRange(int ndim) |
Constructs a range with no bounds.
|
NdRange(java.lang.Comparable[] mins,
java.lang.Comparable[] maxs) |
Constructs a range giving its bounds.
|
Modifier and Type | Method | Description |
---|---|---|
boolean |
equals(java.lang.Object o) |
|
java.lang.Comparable[] |
getMaxs() |
Returns the array of maximum values.
|
java.lang.Comparable[] |
getMins() |
Returns the array of minimum values.
|
int |
hashCode() |
|
static NdRange |
intersection(NdRange r1,
NdRange r2) |
Returns a new range which is the intersection of two given ones.
|
boolean |
isBounded() |
Indicates whether this range has any restrictions on inclusion at all.
|
boolean |
isInside(java.lang.Object[] coords) |
Determines whether a set of coordinates is within this range.
|
static java.lang.Comparable |
max(java.lang.Comparable c1,
java.lang.Comparable c2,
boolean failNull) |
Returns the greater of two objects, with explicit null handling.
|
static java.lang.Comparable |
min(java.lang.Comparable c1,
java.lang.Comparable c2,
boolean failNull) |
Returns the lesser of two objects, with explicit null handling.
|
java.lang.String |
toString() |
Returns a human-readable description of this range.
|
static NdRange |
union(NdRange r1,
NdRange r2) |
Returns a new range which is the union of two given ones.
|
public NdRange(java.lang.Comparable[] mins, java.lang.Comparable[] maxs)
mins
- minimum boundsmaxs
- maximum boundspublic NdRange(int ndim)
ndim
- dimensionalitypublic boolean isBounded()
isInside(java.lang.Object[])
can ever return falsepublic java.lang.Comparable[] getMins()
ndim
-element array of minima, some may be nullpublic java.lang.Comparable[] getMaxs()
ndim
-element array of maxima, some may be nullpublic boolean isInside(java.lang.Object[] coords)
isBounded()
returns
false.coords
- point to assessjava.lang.ClassCastException
- if objects are not mutually comparablepublic boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object
public static NdRange intersection(NdRange r1, NdRange r2)
r1
- first ranger2
- second rangepublic static NdRange union(NdRange r1, NdRange r2)
r1
- first ranger2
- second rangepublic static java.lang.Comparable min(java.lang.Comparable c1, java.lang.Comparable c2, boolean failNull)
c1
- first objectc2
- second objectfailNull
- what happens if c1 or c2 is null; if true null is
returned, if false the non-null value is returnedjava.lang.ClassCastException
- if objects are not mutually comparablepublic static java.lang.Comparable max(java.lang.Comparable c1, java.lang.Comparable c2, boolean failNull)
c1
- first objectc2
- second objectfailNull
- what happens if c1 or c2 is null; if true null is
returned, if false the non-null value is returnedjava.lang.ClassCastException
- if objects are not mutually comparableCopyright © 2018 Central Laboratory of the Research Councils. All Rights Reserved.