| Line | Hits | Source |
|---|---|---|
| 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() | |
| 34 | 1 | { |
| 35 | 1 | v_locations = new HashMap(); |
| 36 | 1 | } |
| 37 | ||
| 38 | 0 | public DefaultSettableVertexLocationFunction(VertexLocationFunction vlf) { |
| 39 | 0 | v_locations = new HashMap(); |
| 40 | 0 | for(Iterator iterator=vlf.getVertexIterator(); iterator.hasNext(); ) { |
| 41 | 0 | ArchetypeVertex v = (ArchetypeVertex)iterator.next(); |
| 42 | 0 | v_locations.put(v, vlf.getLocation(v)); |
| 43 | } | |
| 44 | 0 | } |
| 45 | ||
| 46 | public void setLocation(ArchetypeVertex v, Point2D location) | |
| 47 | { | |
| 48 | 5 | v_locations.put(v, location); |
| 49 | 5 | } |
| 50 | ||
| 51 | public Point2D getLocation(ArchetypeVertex v) | |
| 52 | { | |
| 53 | 10 | return (Point2D)v_locations.get(v); |
| 54 | } | |
| 55 | ||
| 56 | public void reset() | |
| 57 | { | |
| 58 | 0 | v_locations.clear(); |
| 59 | 0 | } |
| 60 | ||
| 61 | public Iterator getVertexIterator() | |
| 62 | { | |
| 63 | 0 | return v_locations.keySet().iterator(); |
| 64 | } | |
| 65 | } |
|
this report was generated by version 1.0.5 of jcoverage. |
copyright © 2003, jcoverage ltd. all rights reserved. |