/*
* Created on Jul 11, 2008
*
* Copyright (c) 2008, the JUNG Project and the Regents of the University
* of California
* All rights reserved.
*
* This software is open-source under the BSD license; see either
* "license.txt" or
* http://jung.sourceforge.net/license.txt for a description.
*/
package edu.uci.ics.jung.algorithms.scoring.util;
import org.apache.commons.collections15.Transformer;
/**
* A Transformer
that delegates its operation to a
* Transformer
. Mainly useful for technical reasons inside
* AbstractIterativeScorer; in essence it allows the edge weight instance
* variable to be of type VEPair,W
even if the edge weight
* Transformer
only operates on edges.
*/
public class DelegateToEdgeTransformer implements
Transformer,Number>
{
/**
* The transformer to which this instance delegates its function.
*/
protected Transformer delegate;
/**
* Creates an instance with the specified delegate transformer.
* @param delegate the Transformer to which this instance will delegate
*/
public DelegateToEdgeTransformer(Transformer delegate)
{
this.delegate = delegate;
}
/**
* @see Transformer#transform(Object)
*/
public Number transform(VEPair arg0)
{
return delegate.transform(arg0.getE());
}
}