net.sf.molae.pipe.trafo
Class TransformedTransformer<S,I,T>

java.lang.Object
  extended by net.sf.molae.pipe.trafo.TransformedTransformer<S,I,T>
All Implemented Interfaces:
TwoWayTransformer<S,T>

public final class TransformedTransformer<S,I,T>
extends Object
implements TwoWayTransformer<S,T>

The concatenation of two transformers.

Since:
1.1

Constructor Summary
TransformedTransformer(TwoWayTransformer<S,I> t1, TwoWayTransformer<I,T> t2)
          Constructs a TransformedTransformer object.
 
Method Summary
 boolean isRetrievable(T input)
          Indicates if the origin of the specified object can be calculated.
 S retransform(T input)
          Calculates the transformation origin of the specified object (optional operation).
 T transform(S input)
          Transforms the input object (leaving it unchanged) into some output object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TransformedTransformer

public TransformedTransformer(TwoWayTransformer<S,I> t1,
                              TwoWayTransformer<I,T> t2)
Constructs a TransformedTransformer object.

Parameters:
t1 - first transformer
t2 - second transformer
Throws:
NullPointerException - if any of the specified objects is null.
Method Detail

transform

public T transform(S input)
Description copied from interface: TwoWayTransformer
Transforms the input object (leaving it unchanged) into some output object.

Specified by:
transform in interface TwoWayTransformer<S,T>
Parameters:
input - the object to be transformed, should be left unchanged
Returns:
a transformed object

retransform

public S retransform(T 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<S,T>
Parameters:
input - the object for which the transformation origin is searched.
Returns:
the transformation origin of the specified object.

isRetrievable

public boolean isRetrievable(T 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<S,T>
Parameters:
input - the object for which the transformation origin is searched.
Returns:
true if the origin of the specified object can be calculated.