net.sf.molae.pipe.trafo
Class ArrayAsIntTransformer
java.lang.Object
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.
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 |
ArrayAsIntTransformer
public ArrayAsIntTransformer(int[] base)
- Constructs a new ArrayAsIntTransformer.
- Parameters:
base
- an integer array that describes the mapping of the
transformer
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.