Initial opendaylight infrastructure commit!!
[controller.git] / third-party / net.sf.jung2 / src / main / java / edu / uci / ics / jung / algorithms / scoring / util / VertexScoreTransformer.java
1 /*
2  * Created on Jul 18, 2008
3  *
4  * Copyright (c) 2008, the JUNG Project and the Regents of the University 
5  * of California
6  * All rights reserved.
7  *
8  * This software is open-source under the BSD license; see either
9  * "license.txt" or
10  * http://jung.sourceforge.net/license.txt for a description.
11  */
12 package edu.uci.ics.jung.algorithms.scoring.util;
13
14 import org.apache.commons.collections15.Transformer;
15
16 import edu.uci.ics.jung.algorithms.scoring.VertexScorer;
17
18 /**
19  * A Transformer convenience wrapper around VertexScorer.
20  */
21 public class VertexScoreTransformer<V, S> implements Transformer<V, S>
22 {
23     /**
24      * The VertexScorer instance that provides the values returned by <code>transform</code>.
25      */
26     protected VertexScorer<V,S> vs;
27
28     /**
29      * Creates an instance based on the specified VertexScorer.
30      */
31     public VertexScoreTransformer(VertexScorer<V,S> vs)
32     {
33         this.vs = vs;
34     }
35
36     /**
37      * Returns the score for this vertex.
38      */
39     public S transform(V v)
40     {
41         return vs.getVertexScore(v);
42     }
43
44 }