KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jgrapht > event > GraphEdgeChangeEvent


1 /* ==========================================
2  * JGraphT : a free Java graph-theory library
3  * ==========================================
4  *
5  * Project Info: http://jgrapht.sourceforge.net/
6  * Project Creator: Barak Naveh (http://sourceforge.net/users/barak_naveh)
7  *
8  * (C) Copyright 2003-2006, by Barak Naveh and Contributors.
9  *
10  * This library is free software; you can redistribute it and/or modify it
11  * under the terms of the GNU Lesser General Public License as published by
12  * the Free Software Foundation; either version 2.1 of the License, or
13  * (at your option) any later version.
14  *
15  * This library is distributed in the hope that it will be useful, but
16  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
17  * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
18  * License for more details.
19  *
20  * You should have received a copy of the GNU Lesser General Public License
21  * along with this library; if not, write to the Free Software Foundation,
22  * Inc.,
23  * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
24  */

25 /* -------------------------
26  * GraphEdgeChangeEvent.java
27  * -------------------------
28  * (C) Copyright 2003-2006, by Barak Naveh and Contributors.
29  *
30  * Original Author: Barak Naveh
31  * Contributor(s): Christian Hammer
32  *
33  * $Id: GraphEdgeChangeEvent.java 504 2006-07-03 02:37:26Z perfecthash $
34  *
35  * Changes
36  * -------
37  * 10-Aug-2003 : Initial revision (BN);
38  * 11-Mar-2004 : Made generic (CH);
39  *
40  */

41 package org.jgrapht.event;
42
43 /**
44  * An event which indicates that a graph edge has changed, or is about to
45  * change. The event can be used either as an indication <i>after</i> the edge
46  * has been added or removed, or <i>before</i> it is added. The type of the
47  * event can be tested using the {@link
48  * org.jgrapht.event.GraphChangeEvent#getType()} method.
49  *
50  * @author Barak Naveh
51  * @since Aug 10, 2003
52  */

53 public class GraphEdgeChangeEvent<V, E>
54     extends GraphChangeEvent
55 {
56
57     //~ Static fields/initializers --------------------------------------------
58

59     private static final long serialVersionUID = 3618134563335844662L;
60
61     /**
62      * Before edge added event. This event is fired before an edge is added to a
63      * graph.
64      */

65     public static final int BEFORE_EDGE_ADDED = 21;
66
67     /**
68      * Before edge removed event. This event is fired before an edge is removed
69      * from a graph.
70      */

71     public static final int BEFORE_EDGE_REMOVED = 22;
72
73     /**
74      * Edge added event. This event is fired after an edge is added to a graph.
75      */

76     public static final int EDGE_ADDED = 23;
77
78     /**
79      * Edge removed event. This event is fired after an edge is removed from a
80      * graph.
81      */

82     public static final int EDGE_REMOVED = 24;
83
84     //~ Instance fields -------------------------------------------------------
85

86     /**
87      * The edge that this event is related to.
88      */

89     protected E edge;
90
91     //~ Constructors ----------------------------------------------------------
92

93     /**
94      * Constructor for GraphEdgeChangeEvent.
95      *
96      * @param eventSource the source of this event.
97      * @param type the event type of this event.
98      * @param e the edge that this event is related to.
99      */

100     public GraphEdgeChangeEvent(Object JavaDoc eventSource, int type, E e)
101     {
102         super(eventSource, type);
103         edge = e;
104     }
105
106     //~ Methods ---------------------------------------------------------------
107

108     /**
109      * Returns the edge that this event is related to.
110      *
111      * @return the edge that this event is related to.
112      */

113     public E getEdge()
114     {
115         return edge;
116     }
117 }
118
Popular Tags