package view; import clustering.VertexScore; import java.awt.Color; import java.util.ArrayList; import java.util.Collection; import java.util.List; import org.apache.commons.collections15.Transformer; public class VertexPaintRankTransformer implements Transformer{ List> pagerank; V seed_node; public VertexPaintRankTransformer(List> ranking, V seed_node){ this.pagerank = ranking; this.seed_node = seed_node; } public Paint transform(V node) { if(seed_node != null){ if (seed_node.equals(node)){ return (Paint) Color.GREEN; } } double score = 0; for(VertexScore s : pagerank){ if(s.getVertex().equals(node)) score = s.getScore(); } int rgb = (int)((255 * score) / pagerank.get(0).getScore()); return (Paint) new Color(rgb,0,0); } }