| Line | Hits | Source |
|---|---|---|
| 1 | /* | |
| 2 | * Copyright (c) 2004, the JUNG Project and the Regents of the University of | |
| 3 | * California All rights reserved. | |
| 4 | * | |
| 5 | * This software is open-source under the BSD license; see either "license.txt" | |
| 6 | * or http://jung.sourceforge.net/license.txt for a description. | |
| 7 | * | |
| 8 | * Created on Jul 6, 2004 | |
| 9 | */ | |
| 10 | package edu.uci.ics.jung.utils; | |
| 11 | ||
| 12 | import edu.uci.ics.jung.graph.ArchetypeGraph; | |
| 13 | import edu.uci.ics.jung.graph.ArchetypeVertex; | |
| 14 | import edu.uci.ics.jung.graph.Graph; | |
| 15 | import edu.uci.ics.jung.graph.Vertex; | |
| 16 | import edu.uci.ics.jung.graph.decorators.StringLabeller; | |
| 17 | ||
| 18 | /** | |
| 19 | * Maps one vertex to another based on their common label in specified | |
| 20 | * <code>StringLabeller</code> instances. | |
| 21 | * | |
| 22 | * @author Joshua O'Madadhain | |
| 23 | */ | |
| 24 | public class StringLabellerVertexMapper extends AbstractVertexMapper | |
| 25 | { | |
| 26 | protected StringLabeller sl_d; | |
| 27 | protected StringLabeller sl_s; | |
| 28 | ||
| 29 | public StringLabellerVertexMapper(ArchetypeGraph dest) | |
| 30 | { | |
| 31 | 0 | super(dest); |
| 32 | 0 | this.sl_d = StringLabeller.getLabeller((Graph)dest); |
| 33 | 0 | this.sl_s = null; |
| 34 | 0 | } |
| 35 | ||
| 36 | public StringLabellerVertexMapper(StringLabeller sl_src, | |
| 37 | StringLabeller sl_dest) | |
| 38 | { | |
| 39 | 0 | super(null); |
| 40 | 0 | this.sl_d = sl_dest; |
| 41 | 0 | this.sl_s = sl_src; |
| 42 | 0 | } |
| 43 | ||
| 44 | /** | |
| 45 | * see VertexMapper#getMappedVertex(edu.uci.ics.jung.graph.ArchetypeVertex) | |
| 46 | */ | |
| 47 | public ArchetypeVertex getMappedVertex(ArchetypeVertex v) | |
| 48 | { | |
| 49 | 0 | if (sl_s == null) |
| 50 | 0 | sl_s = StringLabeller.getLabeller((Graph)v.getGraph()); |
| 51 | 0 | String label = sl_s.getLabel((Vertex)v); |
| 52 | 0 | return sl_d.getVertex(label); |
| 53 | } | |
| 54 | } |
|
this report was generated by version 1.0.5 of jcoverage. |
copyright © 2003, jcoverage ltd. all rights reserved. |