Package elki.data
Class HyperBoundingBox
- java.lang.Object
-
- elki.data.HyperBoundingBox
-
- All Implemented Interfaces:
SpatialComparable
,java.io.Externalizable
,java.io.Serializable
- Direct Known Subclasses:
CASHInterval
,ModifiableHyperBoundingBox
public class HyperBoundingBox extends java.lang.Object implements SpatialComparable, java.io.Externalizable
HyperBoundingBox represents a hyperrectangle in the multidimensional space.- Since:
- 0.1
- Author:
- Elke Achtert
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description (package private) double[]
max
The coordinates of the 'upper right' (= maximum) hyper point.(package private) double[]
min
The coordinates of the 'lower left' (= minimum) hyper point.private static long
serialVersionUID
Serial version.
-
Constructor Summary
Constructors Constructor Description HyperBoundingBox()
Empty constructor for Externalizable interface.HyperBoundingBox(double[] min, double[] max)
Creates a HyperBoundingBox for the given hyper points.HyperBoundingBox(SpatialComparable other)
Constructor, cloning an existing spatial object.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(java.lang.Object obj)
int
getDimensionality()
Returns the dimensionality of this HyperBoundingBox.double
getMax(int dimension)
Returns the coordinate at the specified dimension of the maximum hyper point.double
getMin(int dimension)
Returns the coordinate at the specified dimension of the minimum hyper point.int
hashCode()
void
readExternal(java.io.ObjectInput in)
The object implements the readExternal method to restore its contents by calling the methods of DataInput for primitive types and readObject for objects, strings and arrays.java.lang.String
toString()
Returns a String representation of the HyperBoundingBox.java.lang.String
toString(java.lang.String pre, java.text.NumberFormat nf)
Returns a String representation of the HyperBoundingBox.void
writeExternal(java.io.ObjectOutput out)
The object implements the writeExternal method to save its contents by calling the methods of DataOutput for its primitive values or calling the writeObject method of ObjectOutput for objects, strings, and arrays.
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
Serial version.- See Also:
- Constant Field Values
-
min
double[] min
The coordinates of the 'lower left' (= minimum) hyper point.
-
max
double[] max
The coordinates of the 'upper right' (= maximum) hyper point.
-
-
Constructor Detail
-
HyperBoundingBox
public HyperBoundingBox()
Empty constructor for Externalizable interface.
-
HyperBoundingBox
public HyperBoundingBox(double[] min, double[] max)
Creates a HyperBoundingBox for the given hyper points.- Parameters:
min
- - the coordinates of the minimum hyper pointmax
- - the coordinates of the maximum hyper point
-
HyperBoundingBox
public HyperBoundingBox(SpatialComparable other)
Constructor, cloning an existing spatial object.- Parameters:
other
- Object to clone
-
-
Method Detail
-
getMin
public double getMin(int dimension)
Returns the coordinate at the specified dimension of the minimum hyper point.- Specified by:
getMin
in interfaceSpatialComparable
- Parameters:
dimension
- the dimension for which the coordinate should be returned, where 0 ≤ dimension <this.getDimensionality()
- Returns:
- the coordinate at the specified dimension of the minimum hyper point
-
getMax
public double getMax(int dimension)
Returns the coordinate at the specified dimension of the maximum hyper point.- Specified by:
getMax
in interfaceSpatialComparable
- Parameters:
dimension
- the dimension for which the coordinate should be returned, where 0 ≤ dimension <this.getDimensionality()
- Returns:
- the coordinate at the specified dimension of the maximum hyper point
-
getDimensionality
public int getDimensionality()
Returns the dimensionality of this HyperBoundingBox.- Specified by:
getDimensionality
in interfaceSpatialComparable
- Returns:
- the dimensionality of this HyperBoundingBox
-
toString
public java.lang.String toString()
Returns a String representation of the HyperBoundingBox.- Overrides:
toString
in classjava.lang.Object
- Returns:
- a string representation of this hyper bounding box
-
toString
public java.lang.String toString(java.lang.String pre, java.text.NumberFormat nf)
Returns a String representation of the HyperBoundingBox.- Parameters:
nf
- number format for output accuracypre
- the prefix of each line- Returns:
- a string representation of this hyper bounding box
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
writeExternal
public void writeExternal(java.io.ObjectOutput out) throws java.io.IOException
The object implements the writeExternal method to save its contents by calling the methods of DataOutput for its primitive values or calling the writeObject method of ObjectOutput for objects, strings, and arrays.- Specified by:
writeExternal
in interfacejava.io.Externalizable
- Parameters:
out
- the stream to write the object to- Throws:
java.io.IOException
- Includes any I/O exceptions that may occur
-
readExternal
public void readExternal(java.io.ObjectInput in) throws java.io.IOException
The object implements the readExternal method to restore its contents by calling the methods of DataInput for primitive types and readObject for objects, strings and arrays. The readExternal method must read the values in the same sequence and with the same types as were written by writeExternal.- Specified by:
readExternal
in interfacejava.io.Externalizable
- Parameters:
in
- the stream to read data from in order to restore the object- Throws:
java.io.IOException
- if I/O errors occur
-
-