halo.data
Class Mapping<T,U>

java.lang.Object
  extended by halo.data.Mapping<T,U>

public class Mapping<T,U>
extends java.lang.Object

Mapping of spotIDs to corresponding indices of RNA sets

Author:
Stefanie Kaufmann

Constructor Summary
Mapping()
          Constructor to initialize the Mapping
 
Method Summary
 void addMap(T spotId, U attribute)
          Add the values to the internal map as well as to the map containing the inverted values (attribute --> spotID)
 void changeMap(T spotId, U attribute)
          Change the attribute of a specific spotID
 boolean containsAttribute(U attribute)
          Returns true if the given attribute exists in the Mapping
 boolean containsSpot(T spotId)
          Returns true if the given key exists in the Mapping
 U getAttribute(T spotId)
          Retrieves the attribute for one given key
 java.util.ArrayList<T> getSpotId(U attribute)
          Retrieves the list of keys for one given attribute
static boolean isTurnReverseMapOff()
          Returns TRUE if reverse map is turned off
 java.util.Iterator<T> iterate()
          Provides an iterator to iterate over the keys of the Mapping
 java.util.Iterator<T> iterateSpots(U attr)
          Provides an iterator to iterate over the keys corresponding to a certain attribute
 int mapSize()
          Returns the size of the Mapping (=number of entries)
 void removeAllSpots(java.util.ArrayList<T> spots)
          Removes all keys given in a list
 void removeAttribute(U attribute)
          Removes all entries corresponding to a specific attribute from the Mapping
 void removeSpot(T spotId)
          Removes a given key from the Mapping
static void setTurnReverseMapOff(boolean turnReverseMapOff)
          Allows user to turn the reverse map off for attributes like present/absent calls with large numbers of equal attributes
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Mapping

public Mapping()
Constructor to initialize the Mapping

Method Detail

addMap

public void addMap(T spotId,
                   U attribute)
Add the values to the internal map as well as to the map containing the inverted values (attribute --> spotID)

Parameters:
spotId -
attribute -

removeSpot

public void removeSpot(T spotId)
Removes a given key from the Mapping

Parameters:
spotId - Key that will be removed

removeAllSpots

public void removeAllSpots(java.util.ArrayList<T> spots)
Removes all keys given in a list

Parameters:
spots - List of keys that will be removed

removeAttribute

public void removeAttribute(U attribute)
Removes all entries corresponding to a specific attribute from the Mapping

Parameters:
attribute - Attribute for which all corresponding entries will be removed

changeMap

public void changeMap(T spotId,
                      U attribute)
Change the attribute of a specific spotID

Parameters:
spotId - The spotID for which the attribute will be changed
attribute - The new attribute for the spotID

containsSpot

public boolean containsSpot(T spotId)
Returns true if the given key exists in the Mapping

Parameters:
spotId -
Returns:
true if key exists

containsAttribute

public boolean containsAttribute(U attribute)
Returns true if the given attribute exists in the Mapping

Parameters:
attribute -
Returns:
true if the attribute exists

iterate

public java.util.Iterator<T> iterate()
Provides an iterator to iterate over the keys of the Mapping

Returns:
Iterator over key-set

iterateSpots

public java.util.Iterator<T> iterateSpots(U attr)
Provides an iterator to iterate over the keys corresponding to a certain attribute

Parameters:
attr - The attribute for which the key-set will be produced

getSpotId

public java.util.ArrayList<T> getSpotId(U attribute)
Retrieves the list of keys for one given attribute

Parameters:
attribute - The attribute for which the list of keys will be given
Returns:
The list of keys corresponding to the attribute

getAttribute

public U getAttribute(T spotId)
Retrieves the attribute for one given key

Parameters:
spotId - The key for which the attribute will be given
Returns:
The attribute corresponding to the given key

isTurnReverseMapOff

public static boolean isTurnReverseMapOff()
Returns TRUE if reverse map is turned off

Returns:
TRUE if reverse map is turned off

setTurnReverseMapOff

public static void setTurnReverseMapOff(boolean turnReverseMapOff)
Allows user to turn the reverse map off for attributes like present/absent calls with large numbers of equal attributes

Parameters:
turnReverseMapOff - TRUE if reverse mapping should be turned off

mapSize

public int mapSize()
Returns the size of the Mapping (=number of entries)

Returns:
size of the Mapping