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.event; | |
11 | ||
12 | import java.util.EventObject; | |
13 | ||
14 | import edu.uci.ics.jung.graph.ArchetypeEdge; | |
15 | import edu.uci.ics.jung.graph.ArchetypeGraph; | |
16 | import edu.uci.ics.jung.graph.ArchetypeVertex; | |
17 | import edu.uci.ics.jung.graph.Element; | |
18 | ||
19 | /** | |
20 | * An event which indicates that a change in the graph structure has occurred. Every | |
21 | * graph listener when notified of a change is passed a GraphEvent which contains a | |
22 | * reference to the object (Node, Edge, or EventSequence) that was involved in the | |
23 | * change as well as the graph whose structure was changed. | |
24 | * @author Scott White | |
25 | */ | |
26 | public class GraphEvent extends EventObject { | |
27 | private Element mGraphElement; | |
28 | ||
29 | public GraphEvent(ArchetypeGraph g, Element graphElement) { | |
30 | 120 | super(g); |
31 | 120 | mGraphElement = graphElement; |
32 | 120 | } |
33 | ||
34 | public Element getGraphElement() { | |
35 | 133 | return mGraphElement; |
36 | } | |
37 | ||
38 | public ArchetypeGraph getGraph() { | |
39 | 24 | return (ArchetypeGraph) getSource(); |
40 | } | |
41 | ||
42 | public String toString() { | |
43 | 0 | String geType = null; |
44 | 0 | if (mGraphElement instanceof ArchetypeVertex) { |
45 | 0 | geType = "vertex"; |
46 | 0 | } else if (mGraphElement instanceof ArchetypeEdge) { |
47 | 0 | geType = "edge"; |
48 | } | |
49 | 0 | return "Graph Element type: " + geType; |
50 | } | |
51 | } |
this report was generated by version 1.0.5 of jcoverage. |
copyright © 2003, jcoverage ltd. all rights reserved. |