Coverage details for edu.uci.ics.jung.visualization.DefaultSettableVertexLocationFunction

LineHitsSource
1 /*
2  * Created on Jul 21, 2005
3  *
4  * Copyright (c) 2005, 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.visualization;
13  
14 import java.awt.geom.Point2D;
15 import java.util.HashMap;
16 import java.util.Iterator;
17 import java.util.Map;
18  
19 import edu.uci.ics.jung.graph.ArchetypeVertex;
20  
21 /**
22  * A <code>Map</code>-based implementation of
23  * <code>SettableVertexLocationFunction</code>.
24  *
25  * @author Joshua O'Madadhain
26  */
27 public class DefaultSettableVertexLocationFunction implements
28         SettableVertexLocationFunction
29 {
30     protected Map v_locations;
31     protected boolean normalized;
32     
33     public DefaultSettableVertexLocationFunction()
341    {
351        v_locations = new HashMap();
361    }
37     
380    public DefaultSettableVertexLocationFunction(VertexLocationFunction vlf) {
390        v_locations = new HashMap();
400        for(Iterator iterator=vlf.getVertexIterator(); iterator.hasNext(); ) {
410            ArchetypeVertex v = (ArchetypeVertex)iterator.next();
420            v_locations.put(v, vlf.getLocation(v));
43         }
440    }
45     
46     public void setLocation(ArchetypeVertex v, Point2D location)
47     {
485        v_locations.put(v, location);
495    }
50     
51     public Point2D getLocation(ArchetypeVertex v)
52     {
5310        return (Point2D)v_locations.get(v);
54     }
55  
56     public void reset()
57     {
580        v_locations.clear();
590    }
60     
61     public Iterator getVertexIterator()
62     {
630        return v_locations.keySet().iterator();
64     }
65 }

this report was generated by version 1.0.5 of jcoverage.
visit www.jcoverage.com for updates.

copyright © 2003, jcoverage ltd. all rights reserved.
Java is a trademark of Sun Microsystems, Inc. in the United States and other countries.