Package elki.index.tree.spatial
Class SpatialDirectoryEntry
- java.lang.Object
-
- elki.index.tree.spatial.SpatialDirectoryEntry
-
- All Implemented Interfaces:
SpatialComparable
,DirectoryEntry
,SpatialEntry
,java.io.Externalizable
,java.io.Serializable
- Direct Known Subclasses:
DeLiCluDirectoryEntry
,RdKNNDirectoryEntry
public class SpatialDirectoryEntry extends java.lang.Object implements DirectoryEntry, SpatialEntry
Represents an entry in a directory node of a spatial index. A SpatialDirectoryEntry consists of an id (representing the unique id of the underlying spatial node) and the minimum bounding rectangle of the underlying spatial node.- Since:
- 0.1
- Author:
- Elke Achtert
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description private int
id
Holds the id of the object (node or data object) represented by this entry.private ModifiableHyperBoundingBox
mbr
The minimum bounding rectangle of the underlying spatial node.private static long
serialVersionUID
Serialization version.
-
Constructor Summary
Constructors Constructor Description SpatialDirectoryEntry()
Empty constructor for serialization purposes.SpatialDirectoryEntry(int id, ModifiableHyperBoundingBox mbr)
Constructs a new SpatialDirectoryEntry object with the given parameters.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(java.lang.Object o)
boolean
extendMBR(SpatialComparable responsibleMBR)
Extend the MBR of this node.int
getDimensionality()
Returns the dimensionality of the object.double
getMax(int dimension)
Returns the maximum coordinate at the specified dimension.double
getMin(int dimension)
Returns the minimum coordinate at the specified dimension.int
getPageID()
Get the page ID of this directory entry.int
hashCode()
boolean
hasMBR()
Test whether this entry already has an MBR.void
readExternal(java.io.ObjectInput in)
Calls the super method and reads the MBR object of this entry from the specified input stream.void
setMBR(ModifiableHyperBoundingBox mbr)
Sets the MBR of this entry.java.lang.String
toString()
void
writeExternal(java.io.ObjectOutput out)
Calls the super method and writes the MBR object of this entry to the specified output stream.
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
Serialization version.- See Also:
- Constant Field Values
-
id
private int id
Holds the id of the object (node or data object) represented by this entry.
-
mbr
private ModifiableHyperBoundingBox mbr
The minimum bounding rectangle of the underlying spatial node.
-
-
Constructor Detail
-
SpatialDirectoryEntry
public SpatialDirectoryEntry()
Empty constructor for serialization purposes.
-
SpatialDirectoryEntry
public SpatialDirectoryEntry(int id, ModifiableHyperBoundingBox mbr)
Constructs a new SpatialDirectoryEntry object with the given parameters.- Parameters:
id
- the unique id of the underlying spatial nodembr
- the minimum bounding rectangle of the underlying spatial node
-
-
Method Detail
-
getPageID
public int getPageID()
Description copied from interface:DirectoryEntry
Get the page ID of this directory entry.- Specified by:
getPageID
in interfaceDirectoryEntry
-
getDimensionality
public int getDimensionality()
Description copied from interface:SpatialComparable
Returns the dimensionality of the object.- Specified by:
getDimensionality
in interfaceSpatialComparable
- Returns:
- the dimensionality
-
getMin
public double getMin(int dimension)
Description copied from interface:SpatialComparable
Returns the minimum coordinate at the specified dimension.- Specified by:
getMin
in interfaceSpatialComparable
- Parameters:
dimension
- the dimension for which the coordinate should be returned, where 0 ≤ dimension <getDimensionality()
- Returns:
- the coordinate at the specified dimension of the minimum hyper point of the MBR of the underlying node
-
getMax
public double getMax(int dimension)
Description copied from interface:SpatialComparable
Returns the maximum coordinate at the specified dimension.- Specified by:
getMax
in interfaceSpatialComparable
- Parameters:
dimension
- the dimension for which the coordinate should be returned, where 0 ≤ dimension <getDimensionality()
- Returns:
- the coordinate at the specified dimension of the maximum hyper point of the MBR of the underlying node
-
hasMBR
public boolean hasMBR()
Test whether this entry already has an MBR.- Returns:
- True when an MBR exists.
-
setMBR
public void setMBR(ModifiableHyperBoundingBox mbr)
Sets the MBR of this entry.- Parameters:
mbr
- the MBR to be set
-
writeExternal
public void writeExternal(java.io.ObjectOutput out) throws java.io.IOException
Calls the super method and writes the MBR object of this entry to the specified output stream.- 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, java.lang.ClassNotFoundException
Calls the super method and reads the MBR object of this entry from the specified input stream.- 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 occurjava.lang.ClassNotFoundException
- If the class for an object being restored cannot be found.
-
extendMBR
public boolean extendMBR(SpatialComparable responsibleMBR)
Extend the MBR of this node.- Parameters:
responsibleMBR
-- Returns:
- true when the MBR changed
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
-