summaryrefslogtreecommitdiff
path: root/src/de/lmu/ifi/dbs/elki/data/HyperBoundingBox.java
diff options
context:
space:
mode:
authorErich Schubert <erich@debian.org>2012-12-14 20:45:15 +0100
committerAndrej Shadura <andrewsh@debian.org>2019-03-09 22:30:35 +0000
commit357b2761a2c0ded8cad5e4d3c1e667b7639ff7a6 (patch)
tree3dd8947bb70a67c221adc3cd4359ba1d385e2f3c /src/de/lmu/ifi/dbs/elki/data/HyperBoundingBox.java
parent4343785ebed9d4145f417d86d581f18a0d31e4ac (diff)
parentb7b404fd7a726774d442562d11659d7b5368cdb9 (diff)
Import Debian changes 0.5.5-1
elki (0.5.5-1) unstable; urgency=low * New upstream release: 0.5.5 interim release.
Diffstat (limited to 'src/de/lmu/ifi/dbs/elki/data/HyperBoundingBox.java')
-rw-r--r--src/de/lmu/ifi/dbs/elki/data/HyperBoundingBox.java30
1 files changed, 12 insertions, 18 deletions
diff --git a/src/de/lmu/ifi/dbs/elki/data/HyperBoundingBox.java b/src/de/lmu/ifi/dbs/elki/data/HyperBoundingBox.java
index feb5cace..299f329b 100644
--- a/src/de/lmu/ifi/dbs/elki/data/HyperBoundingBox.java
+++ b/src/de/lmu/ifi/dbs/elki/data/HyperBoundingBox.java
@@ -40,19 +40,19 @@ import de.lmu.ifi.dbs.elki.utilities.FormatUtil;
*/
public class HyperBoundingBox implements SpatialComparable, Externalizable {
/**
- * Serial version
+ * Serial version.
*/
private static final long serialVersionUID = 1;
/**
* The coordinates of the 'lower left' (= minimum) hyper point.
*/
- protected double[] min;
+ double[] min;
/**
* The coordinates of the 'upper right' (= maximum) hyper point.
*/
- protected double[] max;
+ double[] max;
/**
* Empty constructor for Externalizable interface.
@@ -86,37 +86,37 @@ public class HyperBoundingBox implements SpatialComparable, Externalizable {
this.min = new double[dim];
this.max = new double[dim];
for(int i = 0; i < dim; i++) {
- this.min[i] = other.getMin(i + 1);
- this.max[i] = other.getMax(i + 1);
+ this.min[i] = other.getMin(i);
+ this.max[i] = other.getMax(i);
}
}
/**
* Returns the coordinate at the specified dimension of the minimum hyper
- * point
+ * point.
*
* @param dimension the dimension for which the coordinate should be returned,
- * where 1 &le; dimension &le; <code>this.getDimensionality()</code>
+ * where 0 &le; dimension &lt; <code>this.getDimensionality()</code>
* @return the coordinate at the specified dimension of the minimum hyper
* point
*/
@Override
public double getMin(int dimension) {
- return min[dimension - 1];
+ return min[dimension];
}
/**
* Returns the coordinate at the specified dimension of the maximum hyper
- * point
+ * point.
*
* @param dimension the dimension for which the coordinate should be returned,
- * where 1 &le; dimension &le; <code>this.getDimensionality()</code>
+ * where 0 &le; dimension &lt; <code>this.getDimensionality()</code>
* @return the coordinate at the specified dimension of the maximum hyper
* point
*/
@Override
public double getMax(int dimension) {
- return max[dimension - 1];
+ return max[dimension];
}
/**
@@ -136,7 +136,7 @@ public class HyperBoundingBox implements SpatialComparable, Externalizable {
*/
@Override
public String toString() {
- return "[Min(" + FormatUtil.format(min, ",", 10) + "), Max(" + FormatUtil.format(max, ",", 10) + ")]";
+ return "[Min(" + FormatUtil.format(min, ",", FormatUtil.NF8) + "), Max(" + FormatUtil.format(max, ",", FormatUtil.NF8) + ")]";
}
/**
@@ -150,18 +150,12 @@ public class HyperBoundingBox implements SpatialComparable, Externalizable {
return pre + "[Min(" + FormatUtil.format(min, ",", nf) + "), Max(" + FormatUtil.format(max, ",", nf) + ")]";
}
- /**
- * @see Object#equals(Object)
- */
@Override
public boolean equals(Object obj) {
HyperBoundingBox box = (HyperBoundingBox) obj;
return Arrays.equals(min, box.min) && Arrays.equals(max, box.max);
}
- /**
- * @see Object#hashCode()
- */
@Override
public int hashCode() {
return 29 * Arrays.hashCode(min) + Arrays.hashCode(max);