|
Algorithm Development Kit 1.0 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectalgs.model.nd.Hypercube
public class Hypercube
Represents a Hypercube in the n-dimensional Cartesian plane. Note that it is an invariant that getLeft(d) ≤ getRight(d) for all dimensions d
Constructor Summary | |
---|---|
Hypercube(double[] lows,
double[] highs)
Construct an n-dimensional hypercube. |
|
Hypercube(double xlow,
double xhigh,
double ylow,
double yhigh)
Convenience method to construct a 2-dimensional Hypercube from two points. |
|
Hypercube(IHypercube cube)
Fill in values for this hypercube drawn from the IHypercube parameter. |
|
Hypercube(int dimension)
Construct an n-dimensional hypercube with origin coordinates. |
Method Summary | |
---|---|
boolean |
contains(IHypercube h)
Determine if the hypercube wholly contains the given hypercube h. |
int |
dimensionality()
Return the dimensionality of this hypercube. |
boolean |
equals(java.lang.Object o)
Determine equality by comparing coordinates on each dimension |
double |
getLeft(int d)
Return the left-coordinate in the given dimension. |
double |
getRight(int d)
Return the right-coordinate in the given dimension. |
int |
hashCode()
Meaningful hashcode function. |
boolean |
intersects(double[] rawPoint)
Determine intersection among all point coordinates (in raw, optimized form). |
boolean |
intersects(IHypercube h)
Determine if the hypercube intersects the given hypercube h. |
boolean |
intersects(IMultiPoint p)
Determine intersection among all point coordinates. |
void |
setLeft(int d,
double value)
Set the left-coordinate in the given dimension. |
void |
setRight(int d,
double value)
Set the right-coordinate in the given dimension. |
java.lang.String |
toString()
Reasonable toString method. |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public Hypercube(int dimension)
dimension
- the number of dimensions of the hypercube.public Hypercube(IHypercube cube)
cube
- The existing IHypercube object that we are to mimicpublic Hypercube(double[] lows, double[] highs)
The dimensionality is assumed to be the length of either array.
lows
- vector of low valueshighs
- vector of high values
java.lang.IllegalArgumentException
- if n is < 2 or if the arrays differ in length.public Hypercube(double xlow, double xhigh, double ylow, double yhigh)
Note that the order of these parameters is at odds with what would be found in RectangularRegion.
xlow
- x-low coordinate of a 2d hypercube.xhigh
- x-high coordinate of a 2d hypercube.ylow
- y-low coordinate of a 2d hypercube.yhigh
- y-high coordinate of a 2d hypercube.Method Detail |
---|
public int dimensionality()
dimensionality
in interface IHypercube
public double getLeft(int d)
getLeft
in interface IHypercube
d
- Desired dimensionpublic void setLeft(int d, double value)
d
- Desired dimensionvalue
- new value.public double getRight(int d)
getRight
in interface IHypercube
d
- Desired dimension.public void setRight(int d, double value)
d
- Desired dimensionvalue
- new value.public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
Object.equals(Object)
public boolean intersects(double[] rawPoint)
intersects
in interface IHypercube
rawPoint
- array of the coordinates of the target IMultiPoint
public boolean intersects(IMultiPoint p)
intersects
in interface IHypercube
p
- check for intersection among all coordinate dimensions for this IMultiPoint
.public boolean contains(IHypercube h) throws java.lang.IllegalArgumentException
The hypercube presents closed intervals on all dimensions. Note that if -INF or +INF is present, then we can take care to ensure proper containment even in face of boundless dimensions.
contains
in interface IHypercube
h
- query hypercube
If
- dimensions are not the same
java.lang.IllegalArgumentException
public boolean intersects(IHypercube h) throws java.lang.IllegalArgumentException
The hypercube presents closed intervals on all dimensions. Note that if -INF or +INF is present, then we can take care to ensure proper containment even in face of boundless dimensions.
intersects
in interface IHypercube
h
- query hypercube
If
- dimensions are not the same
java.lang.IllegalArgumentException
public java.lang.String toString()
toString
in class java.lang.Object
|
Algorithm Development Kit 1.0 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |