Package elki.index.tree.spatial
Class SpatialPointLeafEntry
- java.lang.Object
-
- elki.index.tree.spatial.SpatialPointLeafEntry
-
- All Implemented Interfaces:
FeatureVector<java.lang.Number>
,NumberVector
,SpatialComparable
,LeafEntry
,SpatialEntry
,java.io.Externalizable
,java.io.Serializable
- Direct Known Subclasses:
DeLiCluLeafEntry
,RdKNNLeafEntry
public class SpatialPointLeafEntry extends java.lang.Object implements LeafEntry, SpatialEntry, NumberVector
Represents an entry in a leaf node of a spatial index. A SpatialLeafEntry consists of an id (representing the unique id of the underlying data object) and the values of the underlying data object.- Since:
- 0.1
- Author:
- Elke Achtert
- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface elki.data.NumberVector
NumberVector.Factory<V extends NumberVector>
-
-
Field Summary
Fields Modifier and Type Field Description private DBID
id
Holds the id of the object (node or data object) represented by this entry.private static long
serialVersionUID
Serial version.private double[]
values
The values of the underlying data object.-
Fields inherited from interface elki.data.FeatureVector
TYPE
-
Fields inherited from interface elki.data.NumberVector
ATTRIBUTE_SEPARATOR, FIELD, FIELD_1D, FIELD_2D, VARIABLE_LENGTH
-
-
Constructor Summary
Constructors Constructor Description SpatialPointLeafEntry()
Empty constructor for serialization purposes.SpatialPointLeafEntry(DBID id, double[] values)
Constructs a new LeafEntry object with the given parameters.SpatialPointLeafEntry(DBID id, NumberVector vector)
Constructor from number vector.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description double
doubleValue(int dimension)
Returns the value in the specified dimension as double.boolean
equals(java.lang.Object obj)
DBID
getDBID()
Get the DBID of this leaf entry.int
getDimensionality()
Returns the dimensionality of the object.int
hashCode()
long
longValue(int dimension)
Returns the value in the specified dimension as long.void
readExternal(java.io.ObjectInput in)
Calls the super method and reads the values of this entry from the specified input stream.double[]
toArray()
Returns a double array copy of this vector.void
writeExternal(java.io.ObjectOutput out)
Calls the super method and writes the values of this entry to the specified stream.-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface elki.data.FeatureVector
toString
-
Methods inherited from interface elki.data.NumberVector
byteValue, floatValue, getMax, getMin, getValue, intValue, shortValue
-
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
Serial version.- See Also:
- Constant Field Values
-
id
private DBID id
Holds the id of the object (node or data object) represented by this entry.
-
values
private double[] values
The values of the underlying data object.
-
-
Constructor Detail
-
SpatialPointLeafEntry
public SpatialPointLeafEntry()
Empty constructor for serialization purposes.
-
SpatialPointLeafEntry
public SpatialPointLeafEntry(DBID id, double[] values)
Constructs a new LeafEntry object with the given parameters.- Parameters:
id
- the unique id of the underlying data objectvalues
- the values of the underlying data object
-
SpatialPointLeafEntry
public SpatialPointLeafEntry(DBID id, NumberVector vector)
Constructor from number vector.- Parameters:
id
- Object idvector
- Number vector
-
-
Method Detail
-
getDBID
public DBID getDBID()
Description copied from interface:LeafEntry
Get the DBID of this leaf entry.
-
getDimensionality
public int getDimensionality()
Description copied from interface:SpatialComparable
Returns the dimensionality of the object.- Specified by:
getDimensionality
in interfaceFeatureVector<java.lang.Number>
- Specified by:
getDimensionality
in interfaceSpatialComparable
- Returns:
- the dimensionality
-
writeExternal
public void writeExternal(java.io.ObjectOutput out) throws java.io.IOException
Calls the super method and writes the values of this entry to the specified 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 values 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.
-
doubleValue
public double doubleValue(int dimension)
Description copied from interface:NumberVector
Returns the value in the specified dimension as double.Note: this might seem redundant with respect to
getValue(dim).doubleValue()
, but usually this is much more efficient due to boxing/unboxing cost.- Specified by:
doubleValue
in interfaceNumberVector
- Parameters:
dimension
- the desired dimension, where 0 ≤ dimension <this.getDimensionality()
- Returns:
- the value in the specified dimension
-
longValue
public long longValue(int dimension)
Description copied from interface:NumberVector
Returns the value in the specified dimension as long.Note: this might seem redundant with respect to
getValue(dim).longValue()
, but usually this is much more efficient due to boxing/unboxing cost.- Specified by:
longValue
in interfaceNumberVector
- Parameters:
dimension
- the desired dimension, where 0 ≤ dimension <this.getDimensionality()
- Returns:
- the value in the specified dimension
-
toArray
public double[] toArray()
Description copied from interface:NumberVector
Returns a double array copy of this vector.- Specified by:
toArray
in interfaceNumberVector
- Returns:
- Copy as
double[]
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
-