at.tuwien.ifs.somtoolbox.data
Class InputDatum

java.lang.Object
  extended by at.tuwien.ifs.somtoolbox.data.InputDatum

public class InputDatum
extends Object

Class representing a specific input datum.

Version:
$Id: InputDatum.java 3583 2010-05-21 10:07:41Z mayer $
Author:
Michael Dittenbach, Rudolf Mayer

Field Summary
private  int dim
           
private  String label
           
private  int nonZeros
           
private  HashMap<Object,Object> properties
           
private  cern.colt.matrix.DoubleMatrix1D vector
           
 
Constructor Summary
InputDatum(String label, double[] vector)
          Constructs a new InputDatum.
InputDatum(String label, cern.colt.matrix.DoubleMatrix1D vector)
          Constructs a new InputDatum.
InputDatum(String label, cern.colt.matrix.DoubleMatrix1D vector, int nonZeros)
           
 
Method Summary
 void addProperty(Object key, Object value)
          Adds an arbitrary key/value property to the InputDatum.
(package private)  void calculateFeatureDensity()
           
 boolean equals(Object obj)
          Compares two InputDatum by both comparing the labels and vectors.
 int getDim()
          Returns the dimensionality of the vector.
 int getFeatureDensity()
           
 String getLabel()
          Returns the label of the InputDatum.
 Object getProperty(Object key)
          Returns the value of a property specified by the key or null if the key does not exist.
 cern.colt.matrix.DoubleMatrix1D getVector()
          Returns the vector of the InputDatum.
 String toString()
          Returns a String representation of this InputDatum as labelName[vector].
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

label

private String label

vector

private cern.colt.matrix.DoubleMatrix1D vector

dim

private int dim

properties

private HashMap<Object,Object> properties

nonZeros

private int nonZeros
Constructor Detail

InputDatum

public InputDatum(String label,
                  cern.colt.matrix.DoubleMatrix1D vector)
Constructs a new InputDatum.

Parameters:
label - The label of the input datum. Basically this should be a sort of unique id.
vector - The vector holding the values.

InputDatum

public InputDatum(String label,
                  double[] vector)
Constructs a new InputDatum.

Parameters:
label - The label of the input datum. Basically this should be a sort of unique id.
vector - The vector holding the values, this time as a double[].

InputDatum

public InputDatum(String label,
                  cern.colt.matrix.DoubleMatrix1D vector,
                  int nonZeros)
Method Detail

getLabel

public String getLabel()
Returns the label of the InputDatum.

Returns:
the label of the InputDatum.

getVector

public cern.colt.matrix.DoubleMatrix1D getVector()
Returns the vector of the InputDatum.

Returns:
the vector of the InputDatum.

getDim

public int getDim()
Returns the dimensionality of the vector.

Returns:
the dimensionality of the vector.

getProperty

public Object getProperty(Object key)
Returns the value of a property specified by the key or null if the key does not exist.

Parameters:
key - The property key.
Returns:
the value of this property or null

addProperty

public void addProperty(Object key,
                        Object value)
Adds an arbitrary key/value property to the InputDatum. Useful for GUIs that need to attach various information to a datum. If value is null, the property is removed.

Parameters:
key - The property key.
value - The property value.

toString

public String toString()
Returns a String representation of this InputDatum as labelName[vector].

Overrides:
toString in class Object

equals

public boolean equals(Object obj)
Compares two InputDatum by both comparing the labels and vectors.

Overrides:
equals in class Object

getFeatureDensity

public int getFeatureDensity()

calculateFeatureDensity

void calculateFeatureDensity()