mark.core.util
Class IntMap

java.lang.Object
  |
  +--mark.core.util.IntMap

public class IntMap
extends java.lang.Object

An IntMap associates integers with other integers. Call the two sets of integers l and s. l is contains integers in 0..#(l), where #(l) is the number of elements in l minus one. s contains integers in 0..#(s), where #(s) is the number of elements in s minus one. #(s) must be less than or equal to #(l). All mapping s->l exist. However, some mappings from l->s will not exitis if #(l) > #(s). These values in l map to -1 rather than a value in s.


Constructor Summary
IntMap(int[] sToLMap, int numL)
          Initializes the map.
 
Method Summary
 int mapL(int l)
          Given an l value, returns the corresponding s value.
 int mapS(int s)
          Given an s value, returns the corresponding l value.
 int numL()
          Returns the number of l values.
 int numS()
          Returns the number of s values.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IntMap

public IntMap(int[] sToLMap,
              int numL)
Initializes the map.

Method Detail

mapS

public int mapS(int s)
         throws java.lang.Exception
Given an s value, returns the corresponding l value.

Parameters:
s - the s value.
Returns:
the corresponding l value.
Throws:
java.lang.Exception - if the mapping does not exist.

mapL

public int mapL(int l)
         throws java.lang.Exception
Given an l value, returns the corresponding s value.

Parameters:
l - the l value.
Returns:
the corresponding s value.
Throws:
java.lang.Exception - if the mapping does not exist.

numS

public int numS()
Returns the number of s values.


numL

public int numL()
Returns the number of l values.