TrustGrapher
r52
A playabale simulator for modelling trust between agents
|
00001 /* 00002 * Created on Jul 19, 2005 00003 * 00004 * Copyright (c) 2005, the JUNG Project and the Regents of the University 00005 * of California 00006 * All rights reserved. 00007 * 00008 * This software is open-source under the BSD license; see either 00009 * "license.txt" or 00010 * http://jung.sourceforge.net/license.txt for a description. 00011 */ 00012 package cu.trustGrapher.visualizer; 00013 00014 import java.awt.Dimension; 00015 import java.awt.geom.Point2D; 00016 import java.util.Date; 00017 import java.util.Random; 00018 00019 import org.apache.commons.collections15.Transformer; 00020 00033 public class VertexPlacer<V> implements Transformer<V,Point2D> { 00034 00035 Dimension d; 00036 Random random; 00037 00038 public VertexPlacer(Dimension d) { 00039 this(d, new Date().getTime()); 00040 } 00041 00042 public VertexPlacer(final Dimension d, long seed) { 00043 this.d = d; 00044 this.random = new Random(seed); 00045 } 00046 00047 public Point2D transform(V v) { 00048 return new Point2D.Double(random.nextDouble() * d.width, random.nextDouble() * d.height); 00049 } 00050 }