Line | Hits | Source |
---|---|---|
1 | /* | |
2 | * Created on Jul 18, 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 java.awt.Shape; | |
15 | ||
16 | import edu.uci.ics.jung.graph.DirectedEdge; | |
17 | import edu.uci.ics.jung.graph.Edge; | |
18 | import edu.uci.ics.jung.graph.UndirectedEdge; | |
19 | import edu.uci.ics.jung.visualization.ArrowFactory; | |
20 | ||
21 | /** | |
22 | * Returns wedge arrows for undirected edges and notched arrows | |
23 | * for directed edges, of the specified dimensions. | |
24 | * | |
25 | * @author Joshua O'Madadhain | |
26 | */ | |
27 | public class DirectionalEdgeArrowFunction implements EdgeArrowFunction | |
28 | { | |
29 | protected Shape undirected_arrow; | |
30 | protected Shape directed_arrow; | |
31 | ||
32 | public DirectionalEdgeArrowFunction(int length, int width, int notch_depth) | |
33 | 0 | { |
34 | 0 | directed_arrow = ArrowFactory.getNotchedArrow(width, length, notch_depth); |
35 | 0 | undirected_arrow = ArrowFactory.getWedgeArrow(width, length); |
36 | 0 | } |
37 | ||
38 | /** | |
39 | * @see edu.uci.ics.jung.graph.decorators.EdgeArrowFunction#getArrow(edu.uci.ics.jung.graph.Edge) | |
40 | */ | |
41 | public Shape getArrow(Edge e) | |
42 | { | |
43 | 0 | if (e instanceof DirectedEdge) |
44 | 0 | return directed_arrow; |
45 | 0 | else if (e instanceof UndirectedEdge) |
46 | 0 | return undirected_arrow; |
47 | else | |
48 | 0 | throw new IllegalArgumentException("Unrecognized edge type"); |
49 | } | |
50 | ||
51 | } |
this report was generated by version 1.0.5 of jcoverage. |
copyright © 2003, jcoverage ltd. all rights reserved. |