Coverage details for edu.uci.ics.jung.graph.decorators.EdgeWeightLabellerStringer

LineHitsSource
1 /*
2 * Copyright (c) 2003, the JUNG Project and the Regents of the University
3 * of California
4 * All rights reserved.
5 *
6 * This software is open-source under the BSD license; see either
7 * "license.txt" or
8 * http://jung.sourceforge.net/license.txt for a description.
9 */
10 /*
11  * Created on Jun 13, 2003
12  *
13  */
14 package edu.uci.ics.jung.graph.decorators;
15  
16 import java.text.NumberFormat;
17  
18 import edu.uci.ics.jung.graph.ArchetypeEdge;
19  
20 /**
21  *
22  * An EdgeStringer provides a string Label for any edge: the
23  * String is the Weight produced by the EdgeWeightLabeller that
24  * it takes as input.
25  *
26  * @author danyelf
27  *
28  */
29 public class EdgeWeightLabellerStringer implements EdgeStringer {
30  
31     protected EdgeWeightLabeller ewl;
32     protected NumberFormat numberFormat;
33  
340    public EdgeWeightLabellerStringer( EdgeWeightLabeller ewl ) {
350        this.ewl = ewl;
360        if (numberFormat == null ) {
370            numberFormat = prepareNumberFormat();
38         }
390    }
40     
41     protected NumberFormat prepareNumberFormat() {
420        NumberFormat nf = NumberFormat.getInstance();
430        return nf;
44     }
45     
46     /**
47      * @see edu.uci.ics.jung.graph.decorators.EdgeStringer#getLabel(ArchetypeEdge)
48      */
49     public String getLabel(ArchetypeEdge e) {
500        return numberFormat.format(ewl.getWeight(e));
51     }
52    
53 }

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.