at.tuwien.ifs.somtoolbox.layers
Class InputContainer

java.lang.Object
  extended by at.tuwien.ifs.somtoolbox.layers.InputContainer
Direct Known Subclasses:
Unit

public class InputContainer
extends Object

Base container for input data mapped onto units. This class holds the names and distances of input data, both sorted by ascending distance.

Version:
$Id: InputContainer.java 3587 2010-05-21 10:35:33Z mayer $
Author:
Michael Dittenbach, Khalid Latif

Field Summary
private  Vector<Double> inputDistances
           
private  Vector<String> inputNames
           
 
Constructor Summary
InputContainer()
          Default Constructor.
 
Method Summary
protected  void addMappedInput(String name, Double dist)
          Adds an input datum defined by argument name and distance to the list.
 void clearMappedInputs()
          Clears all input data.
 int getInputIndex(String name)
          Finds the index for a given input name.
 double getMappedInputDistance(int index)
          Returns the distance between this unit's weight vector and the vector of the mapped input data at the specified index.
 double getMappedInputDistance(String label)
           
 double[] getMappedInputDistances()
          Returns an array of distances between this unit's weight vector and the vectors of the mapped input data.
 String getMappedInputName(int index)
          Returns the name identifier of the mapped input data at the specified index.
 String[] getMappedInputNames()
          Returns an array of strings containing the identifiers of the mapped input data.
 Vector<String> getMappedInputNamesAsList()
           
 int getNumberOfMappedInputs()
          Returns the number of mapped input data.
 boolean isMapped(String name)
          Checks if an input datum with identifier name is mapped onto this container.
 void removeMappedInput(String label)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

inputDistances

private Vector<Double> inputDistances

inputNames

private Vector<String> inputNames
Constructor Detail

InputContainer

public InputContainer()
Default Constructor.

Method Detail

addMappedInput

protected void addMappedInput(String name,
                              Double dist)
Adds an input datum defined by argument name and distance to the list. It is inserted at a position to retain ordering by ascending distance. If two inputs have the same distance, ordering is lexicographically.

Parameters:
name - the identification string of the input datum.
dist - the distance between a unit's weight vector and the inptu datum. This value is precalcuated and independent from this class.

getNumberOfMappedInputs

public int getNumberOfMappedInputs()
Returns the number of mapped input data.

Returns:
the number of mapped input data.

clearMappedInputs

public void clearMappedInputs()
Clears all input data. This method removes all elements from the lists and sets the number variable to 0 accordingly.


getMappedInputDistances

public double[] getMappedInputDistances()
Returns an array of distances between this unit's weight vector and the vectors of the mapped input data. The array is sorted from smallest to largest distance.

Returns:
an array of distances between this unit's weight vector and the vectors of the mapped input data.

getMappedInputDistance

public double getMappedInputDistance(int index)
Returns the distance between this unit's weight vector and the vector of the mapped input data at the specified index.

See Also:
List.get(int)

getMappedInputDistance

public double getMappedInputDistance(String label)
                              throws SOMToolboxException
Throws:
SOMToolboxException

getMappedInputNames

public String[] getMappedInputNames()
Returns an array of strings containing the identifiers of the mapped input data. The array is sorted from the input with the smallest distance to the one having the largest in analogy to getMappedInputDistances().

Returns:
an array of strings containing the identifiers of the mapped input data.

getMappedInputNamesAsList

public Vector<String> getMappedInputNamesAsList()

getMappedInputName

public String getMappedInputName(int index)
Returns the name identifier of the mapped input data at the specified index.

See Also:
List.get(int)

getInputIndex

public int getInputIndex(String name)
Finds the index for a given input name.


isMapped

public boolean isMapped(String name)
Checks if an input datum with identifier name is mapped onto this container.

Parameters:
name - the name of the input datum to be checked.
Returns:
true if an input datum with identifier specified by argument name is mapped onto this unit, false otherwise.

removeMappedInput

public void removeMappedInput(String label)