# Coverage details for edu.uci.ics.jung.graph.decorators.NumericDecorator

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 |  | `package edu.uci.ics.jung.graph.decorators;`
11 |  | ``
12 |  | `import edu.uci.ics.jung.utils.UserDataContainer;`
13 |  | ``
14 |  | `/**`
15 |  | `* Decorator for any value type that extends the java.lang.Number class`
16 |  | `* @author Scott White`
17 |  | `*/`
18 |  | `public class NumericDecorator extends Decorator {`
19 |  | ``
20 |  | `/**`
21 |  | `* Constructs and initializes the decorator`
22 |  | `* @param key`
23 |  | `* @param copyAction`
24 |  | `*/`
25 |  | `public NumericDecorator(Object key,UserDataContainer.CopyAction copyAction) {`
26 | 36 | `super(key,copyAction);`
27 | 36 | `}`
28 |  | ``
29 |  | `/**`
30 |  | `* Retrieves the decorated value for the given graph/vertex/edge as an integer`
31 |  | `* @param udc the graph/vertex/edge`
32 |  | `* @return the integer value`
33 |  | `*/`
34 |  | `public int intValue(UserDataContainer udc) {`
35 | 0 | `return ((Number) udc.getUserDatum(getKey())).intValue();`
36 |  | `}`
37 |  | ``
38 |  | `/**`
39 |  | `* Returns the decorated value as Number`
40 |  | `* @param udc the graph/vertex/edge`
41 |  | `* @return the value`
42 |  | `*/`
43 |  | `public Number getValue(UserDataContainer udc) {`
44 | 1181 | `return (Number) udc.getUserDatum(getKey());`
45 |  | `}`
46 |  | ``
47 |  | `/**`
48 |  | `* Sets the value for a given graph/vertex/edge`
49 |  | `* @param value the value to be stored`
50 |  | `* @param udc the graph/vertex/edge being decorated`
51 |  | `*/`
52 |  | `public void setValue(Number value, UserDataContainer udc) {`
53 | 288 | `udc.setUserDatum(getKey(),value,getCopyAction());`
54 | 288 | `}`
55 |  | `}`

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.