com.quadrique.jbuildingblocks.core.dataStructure
Class JbbIntLabelToIndexMap

java.lang.Object
  extended by com.quadrique.jbuildingblocks.core.dataStructure.JbbIntLabelToIndexMap

public class JbbIntLabelToIndexMap
extends Object

A simple data structures that maintains a map between a set of label and their numeric value. It can typically be used to perform some translation/indirection i.e. to convert from fixed numeric values and their actual index


Constructor Summary
JbbIntLabelToIndexMap()
           
 
Method Summary
 void add(int label, int index)
           
 void addLabelValues(ArrayList<JbbIntLabelIntValue> labelValues)
          This is a convenience method to initialize the map by providing a list of IntLabelIntValue instances
 void clear()
           
 int getIndex(int label)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JbbIntLabelToIndexMap

public JbbIntLabelToIndexMap()
Method Detail

addLabelValues

public void addLabelValues(ArrayList<JbbIntLabelIntValue> labelValues)
                    throws Exception
This is a convenience method to initialize the map by providing a list of IntLabelIntValue instances

Parameters:
labelValues -
Throws:
Exception

clear

public void clear()

add

public void add(int label,
                int index)
         throws Exception
Parameters:
label -
index -
Throws:
Exception

getIndex

public int getIndex(int label)
             throws Exception
Parameters:
label -
Returns:
the index associated to the label
Throws:
Exception - if there is no such label in the map


Copyright © 2001-2008 Quadrique Corporation. All Rights Reserved.