com.taco.util
Class ConstantIntMapper

java.lang.Object
  extended by com.taco.util.ConstantIntMapper
All Implemented Interfaces:
IIntMapper, java.io.Serializable, java.lang.Cloneable

public final class ConstantIntMapper
extends java.lang.Object
implements IIntMapper, java.lang.Cloneable, java.io.Serializable

An implementation of IIntMapper that maps all integers to a single constant.

See Also:
Serialized Form

Field Summary
static ConstantIntMapper NEGATIVE_ONE
          An instance that always returns -1.
static ConstantIntMapper ONE
          An instance that always returns 1.
static ConstantIntMapper ZERO
          An instance that always returns 0.
 
Constructor Summary
ConstantIntMapper(int value)
          Construct a new instance that whose map() method always returns value.
 
Method Summary
 java.lang.Object clone()
           
 int map(int x)
          Return the constant value.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ZERO

public static final ConstantIntMapper ZERO
An instance that always returns 0.


ONE

public static final ConstantIntMapper ONE
An instance that always returns 1.


NEGATIVE_ONE

public static final ConstantIntMapper NEGATIVE_ONE
An instance that always returns -1.

Constructor Detail

ConstantIntMapper

public ConstantIntMapper(int value)
Construct a new instance that whose map() method always returns value.

Method Detail

clone

public java.lang.Object clone()
Overrides:
clone in class java.lang.Object

map

public int map(int x)
Return the constant value.

Specified by:
map in interface IIntMapper