de.lmu.ifi.dbs.elki.data
Class HyperBoundingBox

java.lang.Object
  extended by de.lmu.ifi.dbs.elki.data.HyperBoundingBox
All Implemented Interfaces:
SpatialComparable, Externalizable, Serializable
Direct Known Subclasses:
CASHInterval, ModifiableHyperBoundingBox

public class HyperBoundingBox
extends Object
implements SpatialComparable, Externalizable

HyperBoundingBox represents a hyperrectangle in the multidimensional space.

See Also:
Serialized Form

Field Summary
protected  double[] max
          The coordinates of the 'upper right' (= maximum) hyper point.
protected  double[] min
          The coordinates of the 'lower left' (= minimum) hyper point.
private static long serialVersionUID
          Serial version
 
Constructor Summary
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
 boolean equals(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(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.
 String toString()
          Returns a String representation of the HyperBoundingBox.
 String toString(String pre, NumberFormat nf)
          Returns a String representation of the HyperBoundingBox.
 void writeExternal(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.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

serialVersionUID

private static final long serialVersionUID
Serial version

See Also:
Constant Field Values

min

protected double[] min
The coordinates of the 'lower left' (= minimum) hyper point.


max

protected 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 point
max - - 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 interface SpatialComparable
Parameters:
dimension - the dimension for which the coordinate should be returned, where 1 ≤ 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 interface SpatialComparable
Parameters:
dimension - the dimension for which the coordinate should be returned, where 1 ≤ 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 interface SpatialComparable
Returns:
the dimensionality of this HyperBoundingBox

toString

public String toString()
Returns a String representation of the HyperBoundingBox.

Overrides:
toString in class Object
Returns:
a string representation of this hyper bounding box

toString

public String toString(String pre,
                       NumberFormat nf)
Returns a String representation of the HyperBoundingBox.

Parameters:
nf - number format for output accuracy
pre - the prefix of each line
Returns:
a string representation of this hyper bounding box

equals

public boolean equals(Object obj)
Overrides:
equals in class Object
See Also:
Object.equals(Object)

hashCode

public int hashCode()
Overrides:
hashCode in class Object
See Also:
Object.hashCode()

writeExternal

public void writeExternal(ObjectOutput out)
                   throws 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 interface Externalizable
Parameters:
out - the stream to write the object to
Throws:
IOException - Includes any I/O exceptions that may occur

readExternal

public void readExternal(ObjectInput in)
                  throws IOException,
                         ClassNotFoundException
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 interface Externalizable
Parameters:
in - the stream to read data from in order to restore the object
Throws:
IOException - if I/O errors occur
ClassNotFoundException - If the class for an object being restored cannot be found.

Release 0.4.0 (2011-09-20_1324)