public class DataLocation
extends java.lang.Object
implements java.lang.Cloneable
Modifier | Constructor and Description |
---|---|
protected |
DataLocation()
Constructs a new data location.
|
|
DataLocation(double coord0)
Constructs a 1D data location from the specified coordinates.
|
|
DataLocation(double[] coords)
Constructs a data location from the specified coordinates.
|
|
DataLocation(double coord0,
double coord1)
Constructs a 2D data location from the specified coordinates.
|
|
DataLocation(int rank)
Constructs a data location with the specified rank.
|
|
DataLocation(int index,
int[] dims)
Creates a data location from an integer index and a set of
dimensions.
|
Modifier and Type | Method and Description |
---|---|
DataLocation |
ceil()
Gets the nearest data location with whole integer coordinates
greater than this location.
|
java.lang.Object |
clone() |
protected static DataLocation |
create(double[] coords)
Creates a new data location without cloning.
|
boolean |
equals(java.lang.Object o) |
DataLocation |
floor()
Gets the nearest data location with whole integer coordinates
less than this location.
|
java.lang.String |
format(boolean doRound)
Gets a formatted string for this location.
|
double |
get(int index)
Gets one data location coordinate value.
|
double[] |
getCoords()
Gets the data location coordinates as an array.
|
double[] |
getCoords(double[] coordsCopy)
Gets the data location coordinates as an array.
|
int |
getIndex(int[] dims)
Translates a data location into an integer index.
|
int |
getRank()
Gets the data location dimension rank.
|
int |
hashCode() |
boolean |
increment(int[] stride,
DataLocation start,
DataLocation end)
Increments this location by the specified stride.
|
boolean |
increment(int[] stride,
int[] dims)
Increments this location by the specified stride.
|
boolean |
isContained(DataLocation min,
DataLocation max)
Tests if this data location is contained between a minimum and a
maximum.
|
boolean |
isContained(int[] dims)
Tests if this data location is contained within the specified
dimensions.
|
boolean |
isInvalid()
Checks if this data location is invalid.
|
boolean |
isValid()
Checks if this data location is valid.
|
void |
markInvalid()
Marks this location as invalid.
|
DataLocation |
round()
Gets the nearest data location with whole integer coordinates.
|
void |
set(int index,
double coord)
Sets one data location coordinate value.
|
void |
setCoords(DataLocation source)
Sets the data location coordinates from another location.
|
void |
setCoords(double[] coords)
Sets the data location coordinates from an array.
|
void |
setCoords(int[] coords)
Sets the data location coordinates from an array.
|
java.lang.String |
toString() |
DataLocation |
transform(java.awt.geom.AffineTransform affine)
Transforms this data location using an affine transform.
|
void |
transformInPlace(java.awt.geom.AffineTransform affine)
Transforms this data location in place using an affine transform.
|
DataLocation |
translate(double[] trans)
Performs a translation on this data location.
|
DataLocation |
translate(double trans0,
double trans1)
Performs a 2D translation on this data location.
|
DataLocation |
truncate(int[] dims)
Truncates the data location to the nearest edge.
|
public DataLocation(int rank)
rank
- the data location rank.public DataLocation(double coord0)
coord0
- the 0 index coordinate value.public DataLocation(double coord0, double coord1)
coord0
- the 0 index coordinate value.coord1
- the 1 index coordinate value.public DataLocation(double[] coords)
coords
- the data location coordinates.public DataLocation(int index, int[] dims)
index
- the integer index.dims
- the dimension lengths along each dimension.protected DataLocation()
public java.lang.String format(boolean doRound)
doRound
- the rounding flag, true if rounding to the nearest
integer coordinate is desired.public DataLocation round()
public DataLocation floor()
public DataLocation ceil()
public java.lang.Object clone()
clone
in class java.lang.Object
public double get(int index)
index
- the dimension index.public void set(int index, double coord)
index
- the dimension index.coord
- the coordinate value.public double[] getCoords(double[] coordsCopy)
coordsCopy
- the array of coordinates to fill, or null to create a
new array.public double[] getCoords()
public void setCoords(double[] coords)
coords
- the array of coordinate values, one per dimension.
If the array does not match the location rank, no operation is
performed.public void setCoords(int[] coords)
coords
- the array of coordinate values, one per dimension.
If the array does not match the location rank, no operation is
performed.public void setCoords(DataLocation source)
source
- the source coordinate data location. If the source
location does not match in rank, no operation is performed.public int getRank()
public boolean isContained(DataLocation min, DataLocation max)
min
- the minimum location.max
- the maximum location.public boolean isContained(int[] dims)
dims
- the dimensions for testing.public DataLocation truncate(int[] dims)
dims
- the dimension sizes.public int getIndex(int[] dims)
dims
- the dimension lengths along each dimension.public java.lang.String toString()
toString
in class java.lang.Object
public void transformInPlace(java.awt.geom.AffineTransform affine)
affine
- the affine transform to use.public DataLocation transform(java.awt.geom.AffineTransform affine)
affine
- the affine transform to use.public DataLocation translate(double trans0, double trans1)
trans0
- the translation for index 0.trans1
- the translation for index 1.public DataLocation translate(double[] trans)
trans
- the translation array. Each component of the
translation array is added to the coordinate values.public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
protected static DataLocation create(double[] coords)
public boolean isValid()
markInvalid()
public boolean isInvalid()
markInvalid()
public void markInvalid()
isValid()
,
isInvalid()
public boolean increment(int[] stride, int[] dims)
stride
- the data location stride in each dimension.dims
- the dimension lengths along each dimension.increment(int[],DataLocation,DataLocation)
public boolean increment(int[] stride, DataLocation start, DataLocation end)
stride
- the data location stride in each dimension.start
- the data location window start.end
- the data location window end.increment(int[],int[])
public int hashCode()
hashCode
in class java.lang.Object