Line | Hits | Source |
---|---|---|
1 | /* | |
2 | * Created on Oct 21, 2004 | |
3 | * | |
4 | * Copyright (c) 2004, the JUNG Project and the Regents of the University | |
5 | * of California | |
6 | * All rights reserved. | |
7 | * | |
8 | * This software is open-source under the BSD license; see either | |
9 | * "license.txt" or | |
10 | * http://jung.sourceforge.net/license.txt for a description. | |
11 | */ | |
12 | package edu.uci.ics.jung.graph.decorators; | |
13 | ||
14 | import edu.uci.ics.jung.graph.ArchetypeEdge; | |
15 | import edu.uci.ics.jung.graph.DirectedEdge; | |
16 | import edu.uci.ics.jung.graph.UndirectedEdge; | |
17 | ||
18 | /** | |
19 | * Returns the constructor-specified value for each edge type. | |
20 | * | |
21 | * @author Joshua O'Madadhain | |
22 | */ | |
23 | public class ConstantDirectionalEdgeValue implements NumberEdgeValue | |
24 | { | |
25 | protected Double undirected_closeness; | |
26 | protected Double directed_closeness; | |
27 | ||
28 | /** | |
29 | * | |
30 | * @param undirected | |
31 | * @param directed | |
32 | */ | |
33 | public ConstantDirectionalEdgeValue(double undirected, double directed) | |
34 | 0 | { |
35 | 0 | this.undirected_closeness = new Double(undirected); |
36 | 0 | this.directed_closeness = new Double(directed); |
37 | 0 | } |
38 | ||
39 | /** | |
40 | * @see edu.uci.ics.jung.graph.decorators.NumberEdgeValue#getNumber(ArchetypeEdge) | |
41 | */ | |
42 | public Number getNumber(ArchetypeEdge e) | |
43 | { | |
44 | 0 | if (e instanceof UndirectedEdge) |
45 | 0 | return undirected_closeness; |
46 | 0 | else if (e instanceof DirectedEdge) |
47 | 0 | return directed_closeness; |
48 | else | |
49 | 0 | throw new IllegalArgumentException("Edge type must be DirectedEdge or UndirectedEdge"); |
50 | } | |
51 | ||
52 | /** | |
53 | * @see edu.uci.ics.jung.graph.decorators.NumberEdgeValue#setNumber(edu.uci.ics.jung.graph.ArchetypeEdge, java.lang.Number) | |
54 | */ | |
55 | public void setNumber(ArchetypeEdge e, Number n) | |
56 | { | |
57 | 0 | throw new UnsupportedOperationException(); |
58 | } | |
59 | ||
60 | } |
this report was generated by version 1.0.5 of jcoverage. |
copyright © 2003, jcoverage ltd. all rights reserved. |