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 DBIDidHolds the id of the object (node or data object) represented by this entry.private static longserialVersionUIDSerial version.private double[]valuesThe 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 doubledoubleValue(int dimension)Returns the value in the specified dimension as double.booleanequals(java.lang.Object obj)DBIDgetDBID()Get the DBID of this leaf entry.intgetDimensionality()Returns the dimensionality of the object.inthashCode()longlongValue(int dimension)Returns the value in the specified dimension as long.voidreadExternal(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.voidwriteExternal(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:LeafEntryGet the DBID of this leaf entry.
-
getDimensionality
public int getDimensionality()
Description copied from interface:SpatialComparableReturns the dimensionality of the object.- Specified by:
getDimensionalityin interfaceFeatureVector<java.lang.Number>- Specified by:
getDimensionalityin interfaceSpatialComparable- Returns:
- the dimensionality
-
writeExternal
public void writeExternal(java.io.ObjectOutput out) throws java.io.IOExceptionCalls the super method and writes the values of this entry to the specified stream.- Specified by:
writeExternalin 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.ClassNotFoundExceptionCalls the super method and reads the values of this entry from the specified input stream.- Specified by:
readExternalin 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:NumberVectorReturns 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:
doubleValuein 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:NumberVectorReturns 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:
longValuein 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:NumberVectorReturns a double array copy of this vector.- Specified by:
toArrayin interfaceNumberVector- Returns:
- Copy as
double[]
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
-