Environment for
DeveLoping
KDD-Applications
Supported by Index-Structures

de.lmu.ifi.dbs.elki.data
Class AbstractNumberVector<V extends AbstractNumberVector<V,N>,N extends Number>

java.lang.Object
  extended by de.lmu.ifi.dbs.elki.data.AbstractDatabaseObject
      extended by de.lmu.ifi.dbs.elki.data.AbstractNumberVector<V,N>
Type Parameters:
V - the concrete type of this AbstractNumberVector
N - the type of number, this AbstractNumberVector consists of (i.e., a AbstractNumberVector v of type V and dimensionality d is an element of Nd)
All Implemented Interfaces:
DatabaseObject, FeatureVector<V,N>, NumberVector<V,N>, SpatialComparable, SpatialObject
Direct Known Subclasses:
BitVector, DoubleVector, FloatVector, SparseFloatVector

public abstract class AbstractNumberVector<V extends AbstractNumberVector<V,N>,N extends Number>
extends AbstractDatabaseObject
implements NumberVector<V,N>

AbstractNumberVector is an abstract implementation of FeatureVector. Provided is an attribute separator (space), and the ID-methods as required for a DatabaseObject. The equals-method is implemented dynamically for all subclasses to satisfy the requirements as defined in DatabaseObject.equals(Object). It needs not to be overwritten except for sake of efficiency.

Author:
Arthur Zimek

Field Summary
static String ATTRIBUTE_SEPARATOR
          The String to separate attribute values in a String that represents the values.
 
Constructor Summary
AbstractNumberVector()
           
 
Method Summary
 byte byteValue(int dimension)
          Returns the value in the specified dimension as byte.
 boolean equals(Object obj)
          An Object obj is equal to this AbstractNumberVector if it is an instance of the same runtime class and is of the identical dimensionality and the values of this AbstractNumberVector are equal to the values of obj in all dimensions, respectively.
 float floatValue(int dimension)
          Returns the value in the specified dimension as float.
 double getMax(int dimension)
          Get Maximum - implementation of the SpatialComparable interface
 double getMin(int dimension)
          Get Minimum - implementation of the SpatialComparable interface
 int intValue(int dimension)
          Returns the value in the specified dimension as int.
 short shortValue(int dimension)
          Returns the value in the specified dimension as short.
 
Methods inherited from class de.lmu.ifi.dbs.elki.data.AbstractDatabaseObject
getID, setID
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface de.lmu.ifi.dbs.elki.data.NumberVector
doubleValue, getColumnVector, getRowVector, longValue, minus, multiplicate, negativeVector, newInstance, newInstance, nullVector, plus, randomInstance, randomInstance, randomInstance, scalarProduct
 
Methods inherited from interface de.lmu.ifi.dbs.elki.data.FeatureVector
getDimensionality, getValue, newInstance, newInstance, toString
 
Methods inherited from interface de.lmu.ifi.dbs.elki.data.DatabaseObject
getID, setID
 
Methods inherited from interface de.lmu.ifi.dbs.elki.index.tree.spatial.SpatialObject
getID
 
Methods inherited from interface de.lmu.ifi.dbs.elki.index.tree.spatial.SpatialComparable
getDimensionality
 

Field Detail

ATTRIBUTE_SEPARATOR

public static final String ATTRIBUTE_SEPARATOR
The String to separate attribute values in a String that represents the values.

See Also:
Constant Field Values
Constructor Detail

AbstractNumberVector

public AbstractNumberVector()
Method Detail

equals

public boolean equals(Object obj)
An Object obj is equal to this AbstractNumberVector if it is an instance of the same runtime class and is of the identical dimensionality and the values of this AbstractNumberVector are equal to the values of obj in all dimensions, respectively.

Specified by:
equals in interface DatabaseObject
Overrides:
equals in class Object
Parameters:
obj - another Object
Returns:
true if the specified Object is an instance of the same runtime class and is of the identical dimensionality and the values of this AbstractNumberVector are equal to the values of obj in all dimensions, respectively

getMin

public double getMin(int dimension)
Get Minimum - implementation of the SpatialComparable interface

Specified by:
getMin in interface SpatialComparable
Parameters:
dimension - the dimension for which the coordinate should be returned, where 1 ≤ dimension ≤ getDimensionality()
Returns:
the value at the specified dimension
See Also:
NumberVector.doubleValue(int)

getMax

public double getMax(int dimension)
Get Maximum - implementation of the SpatialComparable interface

Specified by:
getMax in interface SpatialComparable
Parameters:
dimension - the dimension for which the coordinate should be returned, where 1 ≤ dimension ≤ getDimensionality()
Returns:
the value at the specified dimension
See Also:
NumberVector.doubleValue(int)

byteValue

public byte byteValue(int dimension)
Description copied from interface: NumberVector
Returns the value in the specified dimension as byte. Note: this might seem redundant with respect to getValue(dim).byteValue(), but usually this is much more efficient due to boxing/unboxing cost.

Specified by:
byteValue in interface NumberVector<V extends AbstractNumberVector<V,N>,N extends Number>
Parameters:
dimension - the desired dimension, where 1 ≤ dimension ≤ this.getDimensionality()
Returns:
the value in the specified dimension

floatValue

public float floatValue(int dimension)
Description copied from interface: NumberVector
Returns the value in the specified dimension as float. Note: this might seem redundant with respect to getValue(dim).floatValue(), but usually this is much more efficient due to boxing/unboxing cost.

Specified by:
floatValue in interface NumberVector<V extends AbstractNumberVector<V,N>,N extends Number>
Parameters:
dimension - the desired dimension, where 1 ≤ dimension ≤ this.getDimensionality()
Returns:
the value in the specified dimension

intValue

public int intValue(int dimension)
Description copied from interface: NumberVector
Returns the value in the specified dimension as int. Note: this might seem redundant with respect to getValue(dim).intValue(), but usually this is much more efficient due to boxing/unboxing cost.

Specified by:
intValue in interface NumberVector<V extends AbstractNumberVector<V,N>,N extends Number>
Parameters:
dimension - the desired dimension, where 1 ≤ dimension ≤ this.getDimensionality()
Returns:
the value in the specified dimension

shortValue

public short shortValue(int dimension)
Description copied from interface: NumberVector
Returns the value in the specified dimension as short. Note: this might seem redundant with respect to getValue(dim).shortValue(), but usually this is much more efficient due to boxing/unboxing cost.

Specified by:
shortValue in interface NumberVector<V extends AbstractNumberVector<V,N>,N extends Number>
Parameters:
dimension - the desired dimension, where 1 ≤ dimension ≤ this.getDimensionality()
Returns:
the value in the specified dimension

Release 0.3 (2010-03-31_1612)