net.sf.molae.pipe.trafo
Class ArrayAsIntTransformer

java.lang.Object
  extended by net.sf.molae.pipe.trafo.ArrayAsIntTransformer
All Implemented Interfaces:
IntTransformer

public class ArrayAsIntTransformer
extends Object
implements IntTransformer

An IntTransformer based on an array of int values.


Constructor Summary
ArrayAsIntTransformer(int[] base)
          Constructs a new ArrayAsIntTransformer.
 
Method Summary
 int transform(int input)
          Transforms the input index into some output index.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ArrayAsIntTransformer

public ArrayAsIntTransformer(int[] base)
Constructs a new ArrayAsIntTransformer.

Parameters:
base - an integer array that describes the mapping of the transformer
Method Detail

transform

public int transform(int input)
Transforms the input index into some output index. This implementation calls base[input].

Specified by:
transform in interface IntTransformer
Parameters:
input - the index to transform
Returns:
the transformation of the input index to the output index
Throws:
ArrayIndexOutOfBoundsException - if no mapping for the specified input index exists.