Coverage details for edu.uci.ics.jung.utils.StringLabellerVertexMapper

LineHitsSource
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     {
310        super(dest);
320        this.sl_d = StringLabeller.getLabeller((Graph)dest);
330        this.sl_s = null;
340    }
35  
36     public StringLabellerVertexMapper(StringLabeller sl_src,
37         StringLabeller sl_dest)
38     {
390        super(null);
400        this.sl_d = sl_dest;
410        this.sl_s = sl_src;
420    }
43     
44     /**
45      * see VertexMapper#getMappedVertex(edu.uci.ics.jung.graph.ArchetypeVertex)
46      */
47     public ArchetypeVertex getMappedVertex(ArchetypeVertex v)
48     {
490        if (sl_s == null)
500            sl_s = StringLabeller.getLabeller((Graph)v.getGraph());
510        String label = sl_s.getLabel((Vertex)v);
520        return sl_d.getVertex(label);
53     }
54 }

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.