public class ISBounds extends Bounds implements java.lang.Cloneable, java.io.Serializable
Modifier and Type | Field and Description |
---|---|
protected int[] |
lower |
protected int[] |
upper |
Modifier | Constructor and Description |
---|---|
|
ISBounds(IndexSpaceID dimensions)
This constructor takes a single IndexSpaceID
that defines the dimensions of a hypercube with
lower coordinates at the origin.
|
|
ISBounds(IndexSpaceID corner1,
IndexSpaceID corner2)
This constructor takes two corner points (SpaceIDs)
that define a hypercube of arbitrary dimensionality.
|
protected |
ISBounds(int dimensionality)
This constructor just allocates space for the lower and upper arrays.
|
|
ISBounds(int[] dimensions)
This constructor takes a single integer array
that defines the dimensions of a hypercube with
lower coordinates at the origin.
|
|
ISBounds(int[] lower,
int[] upper)
This constructor takes two corner points expressed as int arrays
that define a hypercube of arbitrary dimensionality.
|
|
ISBounds(int dim,
int[] bounds)
This constructor allocates an ISBounds of the dimensionality
defined by the first argument.
|
|
ISBounds(ISBounds bounds)
Construct a copy of the argument bounds.
|
Modifier and Type | Method and Description |
---|---|
ISBounds |
boundingVolume(ISBounds db)
Deprecated.
Use setToBoundingVolume( ISBounds )
|
java.lang.Object |
clone()
Return a copy of this ISBounds object
|
boolean |
contains(IndexSpaceID id)
Returns true if this Bounds contains the coordinates contained in the integer array.
|
boolean |
contains(int[] coords)
Returns true if this Bounds contains the coordinates contained in the integer array.
|
boolean |
contains(ISBounds b2)
Returns true if this Bounds completely contains the argument bounds.
|
boolean |
containsExcludeUpper(IndexSpaceID id)
Returns true if this Bounds contains the coordinates represented in the IndexSpaceID.
|
boolean |
containsExcludeUpper(int[] coords)
Returns true if this Bounds contains the coordinates represented in the integer array.
|
ISBounds |
copy()
Return a copy of this ISBounds object
|
ISBounds |
copy(ISBounds b)
Deprecated.
Use set( ISBounds )
|
ISBounds |
copyAndMove(int[] distance)
Create a copy of this bounds moved by the relative amount specified
by the argument.
|
ISBounds |
copyAndMove(ISBounds b,
int[] distance)
Deprecated.
Use setAndMove( ISBounds, int[] )
|
ISBounds |
copyAndMoveCenterTo(IndexSpaceID loc)
Create a copy of this bounds moved the center to
the specified location.
|
ISBounds |
copyAndMoveCenterTo(int[] loc)
Create a copy of this bounds moved the center to
the specified location.
|
ISBounds |
copyAndMoveTo(int[] loc)
Create a copy of this bounds moved the lower left corner to
the specified location.
|
ISBounds |
copyAndMoveTo(ISBounds b,
int[] destination)
Deprecated.
Use setAndMoveTo( ISBounds, int[] )
|
static ISBounds |
copyAndMoveToOrigin(ISBounds bounds)
Deprecated.
Use bounds.copyToOrigin( )
|
ISBounds |
copyExpandBy(int n)
Return a new ISBounds that has upper and lower coordinates that are
moved outward by the specified distance.
|
ISBounds |
copyExpandByFactor(int factor)
Return a new ISBounds that has upper and lower coordinates that have been
expanded by a given multiple.
|
ISBounds |
copyIncreasedBy(int n)
Return a new ISBounds that has upper coordinates that are increased
by the specified amount from the upper coordinates of this ISBounds.
|
IntegerIndexSpaceID |
copyLower()
Return an IndexSpaceID representing the lower bounds.
|
ISBounds |
copyLower(int[] lower)
Deprecated.
Use setLower( int [] )
|
int[] |
copyLowerArray()
Return a reference to the integer array
representing the lower bounds.
|
int[] |
copyLowerArray(int[] arr)
Copy the lower bound coordinates into the
array argument.
|
ISBounds |
copyReducedBy(int n)
Return a new ISBounds that has upper coordinates that are reduced
by the specified amount from the upper coordinates of this ISBounds.
|
ISBounds |
copyScaled(double[] scales)
Return a new ISBounds with dimensions that have been scaled by the
the argument array.
|
ISBounds |
copyScaled(float[] scales)
Return a new ISBounds with dimensions that have been scaled by the
the argument array.
|
ISBounds |
copyScaled(int[] scales)
Return a new ISBounds with dimensions that have been scaled by the
the argument array.
|
ISBounds |
copyShrinkBy(int n)
Return a new ISBounds that has upper and lower coordinates that are
moved inward by the specified distance.
|
ISBounds |
copyShrinkByFactor(int factor)
Return a new ISBounds that has upper and lower coordinates that have been
reduced by a given multiple.
|
ISBounds |
copyTo(IndexSpaceID lower)
create a new ISBounds from this one with lower bounds at specified
IndexSpace position and upper bounds defined by the size of this ISBounds.
|
ISBounds |
copyTo(int[] lowerArray)
create a new ISBounds from this one with lower bounds at specified
position and upper bounds defined by the size of this ISBounds.
|
ISBounds |
copyToOrigin()
create a new ISBounds from this one with lower bounds at the origin, and
upper bounds defined by the size of this ISBounds.
|
IntegerIndexSpaceID |
copyUpper()
Return an IndexSpaceID representing the upper bounds.
|
ISBounds |
copyUpper(int[] upper)
Deprecated.
Use setUpper( int [] )
"this" is returned for convenience of use.
|
int[] |
copyUpperArray()
Return a copy of the integer array
representing the upper bounds.
|
int[] |
copyUpperArray(int[] arr)
Copy the upper bound coordinates into the
array argument.
|
static ISBounds |
createAtOrigin(IndexSpaceID id)
create a new ISBounds with lower bounds at the origin, and
upper bounds with the specified IndexSpaceID.
|
static ISBounds |
createAtOrigin(int[] coords)
Create a new ISBounds with lower bounds at the origin, and
upper bounds with coordinates corresponding
to the integer array argument.
|
static ISBounds |
createCentered(IndexSpaceID shape,
IndexSpaceID center)
Create a new ISBounds with its center at the ISID specified
by the second argument and whose dimensions are the same as
the dimensions of the 1st argument.
|
static ISBounds |
createCentered(int[] shape,
int[] center)
Create a new ISBounds with its center at the ISID specified
by the second argument and whose dimensions are given by the 1st argument.
|
static ISBounds |
createCentered(ISBounds shape,
IndexSpaceID center)
Create a new ISBounds with its center at the ISID specified
by the second argument and whose dimensions are the same as
the dimensions of the 1st argument.
|
int |
dim()
Return dimensionality of Bounds.
|
boolean |
equals(ISBounds b)
Return true if parameter is equal to this object, false otherwise.
|
boolean |
equalShape(ISBounds b)
Return true if parameter has the same size in all dimensions as
this object, false otherwise.
|
protected boolean |
equalShapeAfterProject(ISBounds b)
Returns true if the passed bounds has the same shape as this
bounds after the higher dimensioned bounds is projected along
any dimension that is of length 1.
|
ISBounds |
expand(int n)
Deprecated.
Use copyExpandBy( int )
|
void |
expandByFactor(int factor)
Modifies this ISBounds with upper and lower coordinates that have been
increased by a given multiple.
|
int |
getDimension(int axis)
Return the length of the axis specified as an argument.
|
IndexSpaceID |
getDimensions()
Return an IndexSpaceID with axis values denoting the size
of each corresponding dimension of the ISBounds.
|
int[] |
getDimensions(int[] dimensions)
Fill the argument array with coordinate values denoting the size
of each corresponding dimension of the ISBounds.
|
int[] |
getDimensionsArray()
Return an int array with axis values denoting the size
of each corresponding dimension of the ISBounds.
|
IntegerIndexSpaceID |
getLower()
Return an IndexSpaceID representing the lower bounds.
|
int |
getLower(int axis)
Return an int representing the lower bound of the specified dimension.
|
int[] |
getLowerArray()
Return a reference to the integer array
representing the upper bounds.
|
int[] |
getLowerArray(int[] arr)
Deprecated.
Use copyLowerArray( int [] )
|
IntegerIndexSpaceID |
getUpper()
Return an IndexSpaceID representing the upper bounds.
|
int |
getUpper(int axis)
Return an int representing the upper bound of the specified dimension.
|
int[] |
getUpperArray()
Return a reference to the integer array
representing the upper bounds.
|
int[] |
getUpperArray(int[] arr)
Deprecated.
Use copyUpperArray( int [] )
|
IndexSpaceID |
getVertex(int vertexNumber,
IndexSpaceID id)
Fills the second argument with the coordinates of the specified
vertex.
|
int[] |
getVertex(int vertexNumber,
int[] coords)
Fills the second argument with the coordinates of the specified
vertex.
|
boolean |
hasSameShape(ISBounds b)
Returns true if the argument bounds has the same shape as this ISBounds, and false otherwise.
|
ISBounds |
increase(int n)
Deprecated.
Use copyIncreasedBy( int )
|
ISBounds |
increaseByOne()
Deprecated.
Use copyIncreasedBy( 1 )
|
void |
increaseByOne(ISBounds b)
Deprecated.
rdb: I find the semantics very confusing. One would expect
that the this object would be the one changed, not the argument object.
Why do we need this? It is exactly the same as b.increaseByOne();
All other similar methods either change "this" or
return a new object (except increaseByOne(ISB)).
|
ISBounds |
intersection(ISBounds b2)
Returns the intersecton of this object with the ISBounds argument.
|
boolean |
intersects(ISBounds b2)
If the intersection of this with the argument is non-empty, the method returns
true, and false otherwise.
|
ISBounds |
intersectWith(ISBounds b2)
Updates this ISBounds to the intersection of itself with the argument.
|
boolean |
isSlice(IndexSpaceID dimensionsID,
int axis)
Returns true if the argument IndexSpaceId represents the dimensions of
a slice of this ISBounds of arbitrary thickness in the specified axis.
|
long |
longVolume()
Return the total volume of the ISBounds as a long.
|
static void |
main(java.lang.String[] args)
For debugging.
|
ISBounds |
makeRelativeTo(IndexSpaceID localOrigin)
Translate this ISBounds in space so it is expressed in
the local coordinate system whose origin is at the
IndexSpaceId passed as an argument.
|
ISBounds |
makeRelativeTo(int[] localOrigin)
Translate this ISBounds in space so it is expressed in
the local coordinate system whose origin is at the
IndexSpaceId passed as an argument.
|
ISBounds |
move(IndexSpaceID distance)
Translate the ISBounds object
in space by the value of the parameter IndexSpaceID.
|
ISBounds |
move(int[] distance)
Translate the ISBounds object
in space by the coordinates in the integer array argument.
|
ISBounds |
move(int axis,
int distance)
Translate the ISBounds object
in space along the specified axis by the specified distance.
|
ISBounds |
moveCenterTo(IndexSpaceID location)
Translate the ISBounds object in space so that the
center is moved to the coordinates specified
in the integer array argument.
|
ISBounds |
moveCenterTo(int[] location)
Translate the ISBounds object in space so that the
center is moved to the coordinates specified
in the integer array argument.
|
ISBounds |
moveTo(IndexSpaceID location)
Translate the ISBounds object in space so that the
lower left corner is moved to the location specified
by the parameter IndexSpaceID.
|
ISBounds |
moveTo(int[] location)
Translate the ISBounds object in space so that the
lower left corner is moved to the coordinates specified
int the integer array argument.
|
ISBounds |
moveToOrigin()
Translate this ISBounds in space so that the lower
point is now at the origin.
|
static ISBounds |
newBoundsAtOrigin(IndexSpaceID id)
Deprecated.
Use createAtOrigin( isid )
|
ISBounds |
project(int axis)
Returns a new ISBounds which is the projection of this ISBounds onto a
plane orthogonal to the specified axis.
|
ISBounds |
reduce(int n)
Deprecated.
Use copyReducedBy( int )
|
ISBounds |
reduceByOne()
Deprecated.
Use copyReducedBy( 1 )
|
void |
reduceByOne(ISBounds b)
Deprecated.
rdb: I find the semantics very confusing. One would expect
that the this object would be the one changed, not the argument object.
Especially since our other similar methods either change "this" or
return a new object (except decreaseByOne(ISB)).
|
ISBounds |
set(ISBounds b)
Copy the upper and lower bounds of the argument ISBounds into this object.
|
ISBounds |
setAndMove(ISBounds b,
int[] distance)
Set the bounds of this object so it is the same shape as the ISBounds
argument, but translated to the location represented by the array argument.
|
ISBounds |
setAndMoveTo(ISBounds b,
int[] destination)
Set the bounds of this object so it is the same shape as the ISBounds
argument, but translated to the location represented by the array argument.
|
ISBounds |
setLower(IndexSpaceID lower)
Set the lower bounds to the coordinates represented
by the IndexSpaceID argument.
|
ISBounds |
setLower(int[] lower)
Set the lower bounds to the coordinates represented
by the integer array argument.
|
ISBounds |
setLower(int axis,
int newValue)
set the lower bounds of a given axis specified in the argument
"this" is returned for convenience of use.
|
ISBounds |
setToBoundingVolume(ISBounds db)
Updates this ISBounds object to be the
bounding volume of this ISBounds and the parameter
ISBounds.
|
ISBounds |
setUpper(IndexSpaceID upper)
Set the upper bounds to the coordinates represented
by the IndexSpaceID argument.
|
ISBounds |
setUpper(int[] upper)
Set the upper bounds to the coordinates represented
by the integer array argument.
|
ISBounds |
setUpper(int axis,
int newValue)
Set the upper bounds of a given axis specified in the argument
"this" is returned for convenience of use.
|
void |
shrinkByFactor(int factor)
Modifies this ISBounds with upper and lower coordinates that have been
reduced by a given multiple.
|
ISBounds |
slice(int axis,
int coordinate)
Returns a new ISBounds which is a slice of this ISBounds of thickness 1 in a plane orthogonal
to the specified axis, having the given coordinate value for that axis.
|
void |
split(ISBounds lowerBounds,
ISBounds upperBounds,
int splitAxis,
int splitAxisCoord)
The two argument bounds are set to represent two portions of this ISBounds
split by a plane orthogonal to the splitAxis, at the coordinate value
contained in splitAxisCoord.
|
java.lang.String |
toString()
Return a String representing the object.
|
java.lang.String |
toString(java.lang.String indent)
Return a String representing the object indented by the argument string.
|
int |
volume()
Return the total volume of the ISBounds as an integer.
|
public ISBounds(IndexSpaceID corner1, IndexSpaceID corner2)
public ISBounds(IndexSpaceID dimensions)
public ISBounds(int[] dimensions)
public ISBounds(int[] lower, int[] upper)
public ISBounds(ISBounds bounds)
protected ISBounds(int dimensionality)
public ISBounds(int dim, int[] bounds)
public static ISBounds newBoundsAtOrigin(IndexSpaceID id)
public static ISBounds createAtOrigin(IndexSpaceID id)
public static ISBounds createAtOrigin(int[] coords)
public static ISBounds createCentered(ISBounds shape, IndexSpaceID center)
public static ISBounds createCentered(IndexSpaceID shape, IndexSpaceID center)
public static ISBounds createCentered(int[] shape, int[] center)
public final ISBounds copyTo(IndexSpaceID lower)
public final ISBounds copyTo(int[] lowerArray)
public final ISBounds copyToOrigin()
public final ISBounds copy()
public java.lang.Object clone()
public final ISBounds copy(ISBounds b)
public final ISBounds set(ISBounds b)
public final ISBounds copyAndMoveTo(ISBounds b, int[] destination)
public final ISBounds setAndMoveTo(ISBounds b, int[] destination)
public final ISBounds copyAndMove(ISBounds b, int[] distance)
public final ISBounds copyAndMove(int[] distance)
public final ISBounds copyAndMoveTo(int[] loc)
public final ISBounds copyAndMoveCenterTo(int[] loc)
public final ISBounds copyAndMoveCenterTo(IndexSpaceID loc)
public final ISBounds setAndMove(ISBounds b, int[] distance)
public final ISBounds copyLower(int[] lower)
public final ISBounds copyUpper(int[] upper)
public final ISBounds setLower(IndexSpaceID lower)
public final ISBounds setUpper(IndexSpaceID upper)
public final ISBounds setLower(int[] lower)
public final ISBounds setUpper(int[] upper)
public final ISBounds setUpper(int axis, int newValue)
public final ISBounds setLower(int axis, int newValue)
public final IntegerIndexSpaceID copyLower()
public final IntegerIndexSpaceID getLower()
public final int getLower(int axis)
public final int getUpper(int axis)
public final IntegerIndexSpaceID copyUpper()
public final IntegerIndexSpaceID getUpper()
public final int[] getLowerArray()
public final int[] copyLowerArray()
public final int[] getLowerArray(int[] arr)
public final int[] copyLowerArray(int[] arr)
public final int[] getUpperArray()
public final int[] copyUpperArray()
public final int[] getUpperArray(int[] arr)
public final int[] copyUpperArray(int[] arr)
public boolean equals(ISBounds b)
public boolean equalShape(ISBounds b)
protected boolean equalShapeAfterProject(ISBounds b)
b
- public final int volume()
public final long longVolume()
public final IndexSpaceID getDimensions()
public final ISBounds increase(int n)
public final ISBounds copyIncreasedBy(int n)
public final int[] getDimensionsArray()
public final int[] getDimensions(int[] dimensions)
public final int getDimension(int axis)
public ISBounds project(int axis)
public ISBounds slice(int axis, int coordinate)
public boolean isSlice(IndexSpaceID dimensionsID, int axis)
public void split(ISBounds lowerBounds, ISBounds upperBounds, int splitAxis, int splitAxisCoord)
public int[] getVertex(int vertexNumber, int[] coords)
public IndexSpaceID getVertex(int vertexNumber, IndexSpaceID id)
public final boolean hasSameShape(ISBounds b)
public final ISBounds expand(int n)
public final void expandByFactor(int factor)
public final ISBounds copyExpandByFactor(int factor)
public final ISBounds copyExpandBy(int n)
public final ISBounds reduceByOne()
public final void reduceByOne(ISBounds b)
public final ISBounds reduce(int n)
public final ISBounds copyReducedBy(int n)
public final void shrinkByFactor(int factor)
public final ISBounds copyShrinkByFactor(int factor)
public final ISBounds copyShrinkBy(int n)
public final ISBounds increaseByOne()
public final void increaseByOne(ISBounds b)
public final ISBounds copyScaled(double[] scales)
public final ISBounds copyScaled(float[] scales)
public final ISBounds copyScaled(int[] scales)
public final ISBounds move(IndexSpaceID distance)
public final ISBounds move(int[] distance)
public final ISBounds move(int axis, int distance)
public final ISBounds moveTo(IndexSpaceID location)
public final ISBounds moveTo(int[] location)
public final ISBounds moveCenterTo(int[] location)
public final ISBounds moveCenterTo(IndexSpaceID location)
public ISBounds moveToOrigin()
public ISBounds makeRelativeTo(IndexSpaceID localOrigin)
public ISBounds makeRelativeTo(int[] localOrigin)
public static final ISBounds copyAndMoveToOrigin(ISBounds bounds)
public final ISBounds boundingVolume(ISBounds db)
public ISBounds setToBoundingVolume(ISBounds db)
public boolean intersects(ISBounds b2)
public ISBounds intersection(ISBounds b2)
public ISBounds intersectWith(ISBounds b2)
public boolean contains(ISBounds b2)
public boolean containsExcludeUpper(int[] coords)
public boolean containsExcludeUpper(IndexSpaceID id)
public boolean contains(IndexSpaceID id)
public boolean contains(int[] coords)
public java.lang.String toString()
public java.lang.String toString(java.lang.String indent)
public static void main(java.lang.String[] args)