Line | Hits | Source |
---|---|---|
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 | ||
34 | 0 | public EdgeWeightLabellerStringer( EdgeWeightLabeller ewl ) { |
35 | 0 | this.ewl = ewl; |
36 | 0 | if (numberFormat == null ) { |
37 | 0 | numberFormat = prepareNumberFormat(); |
38 | } | |
39 | 0 | } |
40 | ||
41 | protected NumberFormat prepareNumberFormat() { | |
42 | 0 | NumberFormat nf = NumberFormat.getInstance(); |
43 | 0 | return nf; |
44 | } | |
45 | ||
46 | /** | |
47 | * @see edu.uci.ics.jung.graph.decorators.EdgeStringer#getLabel(ArchetypeEdge) | |
48 | */ | |
49 | public String getLabel(ArchetypeEdge e) { | |
50 | 0 | return numberFormat.format(ewl.getWeight(e)); |
51 | } | |
52 | ||
53 | } |
this report was generated by version 1.0.5 of jcoverage. |
copyright © 2003, jcoverage ltd. all rights reserved. |