net.sf.molae.pipe.binop
Class ConstantSecondFactorTransformer

java.lang.Object
  |
  +--net.sf.molae.pipe.binop.ConstantSecondFactorTransformer
All Implemented Interfaces:
Transformer, TwoWayTransformer

public final class ConstantSecondFactorTransformer
extends Object
implements TwoWayTransformer

A transformer based on a binary operation where the second operand is constant.


Constructor Summary
ConstantSecondFactorTransformer(BinaryFunction operation, Object factor)
          Constructs a ConstantSecondFactorTransformer object.
 
Method Summary
 boolean isRetrievable(Object input)
          Indicates if the origin of the specified object can be calculated.
 Object retransform(Object input)
          Calculates the transformation origin of the specified object (optional operation).
 Object transform(Object input)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConstantSecondFactorTransformer

public ConstantSecondFactorTransformer(BinaryFunction operation,
                                       Object factor)
Constructs a ConstantSecondFactorTransformer object.
Parameters:
operation - the underlying binary function
factor - the constant value of the second factor
Method Detail

transform

public Object transform(Object input)
Specified by:
transform in interface Transformer

retransform

public Object retransform(Object input)
Description copied from interface: TwoWayTransformer
Calculates the transformation origin of the specified object (optional operation). This is the inverse mapping of transform. If implemented, it must at least be ensured that
 transform(retransform(input)).equals(input)
 
for all objects, for that the retransformation is defined (that is retransform(input) does not throw an exception).
This implies that the retransformation is defined on a subset of the image of the transformation.
Specified by:
retransform in interface TwoWayTransformer
Following copied from interface: net.sf.molae.pipe.trafo.TwoWayTransformer
Parameters:
input - the object for which the transformation origin is searched.
Returns:
the transformation origin of the specified object.
Throws:
IllegalArgumentException - if the retransformation for the input object is not defined
ClassCastException - if the retransformation is not defined for the class of the input element
UnsupportedOperationException - if not implemented.

isRetrievable

public boolean isRetrievable(Object input)
Description copied from interface: TwoWayTransformer
Indicates if the origin of the specified object can be calculated. This requires that:
  1. retransform is implemented for this object and does not throw an exception.
  2. The object x returned by retransform is unique, or more formally: transform(o1).equals(transform(o2)) &rArr o1.equals(o2)
This implies that
 retransform(transform(input)).equals(input)
 
for all objects where the retransformation is defined.
Specified by:
isRetrievable in interface TwoWayTransformer
Following copied from interface: net.sf.molae.pipe.trafo.TwoWayTransformer
Parameters:
input - the object for which the transformation origin is searched.
Returns:
true if the origin of the specified object can be calculated.