2 * Created on Jul 11, 2008
4 * Copyright (c) 2008, the JUNG Project and the Regents of the University
8 * This software is open-source under the BSD license; see either
10 * http://jung.sourceforge.net/license.txt for a description.
12 package edu.uci.ics.jung.algorithms.scoring.util;
14 import org.apache.commons.collections15.Transformer;
17 * A <code>Transformer<VEPair,Number></code> that delegates its operation to a
18 * <code>Transformer<E,Number></code>. Mainly useful for technical reasons inside
19 * AbstractIterativeScorer; in essence it allows the edge weight instance
20 * variable to be of type <code>VEPair,W</code> even if the edge weight
21 * <code>Transformer</code> only operates on edges.
23 public class DelegateToEdgeTransformer<V,E> implements
24 Transformer<VEPair<V,E>,Number>
27 * The transformer to which this instance delegates its function.
29 protected Transformer<E,? extends Number> delegate;
32 * Creates an instance with the specified delegate transformer.
33 * @param delegate the Transformer to which this instance will delegate
35 public DelegateToEdgeTransformer(Transformer<E,? extends Number> delegate)
37 this.delegate = delegate;
41 * @see Transformer#transform(Object)
43 public Number transform(VEPair<V,E> arg0)
45 return delegate.transform(arg0.getE());