summaryrefslogtreecommitdiff
path: root/src/de/lmu/ifi/dbs/elki/index/tree/spatial/SpatialDirectoryEntry.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/de/lmu/ifi/dbs/elki/index/tree/spatial/SpatialDirectoryEntry.java')
-rw-r--r--src/de/lmu/ifi/dbs/elki/index/tree/spatial/SpatialDirectoryEntry.java34
1 files changed, 27 insertions, 7 deletions
diff --git a/src/de/lmu/ifi/dbs/elki/index/tree/spatial/SpatialDirectoryEntry.java b/src/de/lmu/ifi/dbs/elki/index/tree/spatial/SpatialDirectoryEntry.java
index cf83a1a2..9833e5b5 100644
--- a/src/de/lmu/ifi/dbs/elki/index/tree/spatial/SpatialDirectoryEntry.java
+++ b/src/de/lmu/ifi/dbs/elki/index/tree/spatial/SpatialDirectoryEntry.java
@@ -4,7 +4,7 @@ package de.lmu.ifi.dbs.elki.index.tree.spatial;
This file is part of ELKI:
Environment for Developing KDD-Applications Supported by Index-Structures
- Copyright (C) 2011
+ Copyright (C) 2012
Ludwig-Maximilians-Universität München
Lehr- und Forschungseinheit für Datenbanksysteme
ELKI Development Team
@@ -27,7 +27,8 @@ import java.io.IOException;
import java.io.ObjectInput;
import java.io.ObjectOutput;
-import de.lmu.ifi.dbs.elki.data.HyperBoundingBox;
+import de.lmu.ifi.dbs.elki.data.ModifiableHyperBoundingBox;
+import de.lmu.ifi.dbs.elki.data.spatial.SpatialComparable;
import de.lmu.ifi.dbs.elki.index.tree.AbstractDirectoryEntry;
/**
@@ -45,7 +46,7 @@ public class SpatialDirectoryEntry extends AbstractDirectoryEntry implements Spa
/**
* The minimum bounding rectangle of the underlying spatial node.
*/
- private HyperBoundingBox mbr;
+ private ModifiableHyperBoundingBox mbr;
/**
* Empty constructor for serialization purposes.
@@ -60,7 +61,7 @@ public class SpatialDirectoryEntry extends AbstractDirectoryEntry implements Spa
* @param id the unique id of the underlying spatial node
* @param mbr the minimum bounding rectangle of the underlying spatial node
*/
- public SpatialDirectoryEntry(int id, HyperBoundingBox mbr) {
+ public SpatialDirectoryEntry(int id, ModifiableHyperBoundingBox mbr) {
super(id);
this.mbr = mbr;
}
@@ -89,11 +90,20 @@ public class SpatialDirectoryEntry extends AbstractDirectoryEntry implements Spa
}
/**
+ * Test whether this entry already has an MBR.
+ *
+ * @return True when an MBR exists.
+ */
+ public boolean hasMBR() {
+ return (this.mbr != null);
+ }
+
+ /**
* Sets the MBR of this entry.
*
* @param mbr the MBR to be set
*/
- public void setMBR(HyperBoundingBox mbr) {
+ public void setMBR(ModifiableHyperBoundingBox mbr) {
this.mbr = mbr;
}
@@ -122,7 +132,17 @@ public class SpatialDirectoryEntry extends AbstractDirectoryEntry implements Spa
@Override
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
super.readExternal(in);
- this.mbr = new HyperBoundingBox();
+ this.mbr = new ModifiableHyperBoundingBox();
this.mbr.readExternal(in);
}
-}
+
+ /**
+ * Extend the MBR of this node.
+ *
+ * @param responsibleMBR
+ * @return true when the MBR changed
+ */
+ public boolean extendMBR(SpatialComparable responsibleMBR) {
+ return this.mbr.extend(responsibleMBR);
+ }
+} \ No newline at end of file