KickJava   Java API By Example, From Geeks To Geeks.

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


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  * GraphVertexChangeEvent.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: GraphVertexChangeEvent.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 vertex has changed, or is about to
45  * change. The event can be used either as an indication <i>after</i> the vertex
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 GraphVertexChangeEvent<V>
54     extends GraphChangeEvent
55 {
56
57     //~ Static fields/initializers --------------------------------------------
58

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

65     public static final int BEFORE_VERTEX_ADDED = 11;
66
67     /**
68      * Before vertex removed event. This event is fired before a vertex is
69      * removed from a graph.
70      */

71     public static final int BEFORE_VERTEX_REMOVED = 12;
72
73     /**
74      * Vertex added event. This event is fired after a vertex is added to a
75      * graph.
76      */

77     public static final int VERTEX_ADDED = 13;
78
79     /**
80      * Vertex removed event. This event is fired after a vertex is removed from
81      * a graph.
82      */

83     public static final int VERTEX_REMOVED = 14;
84
85     //~ Instance fields -------------------------------------------------------
86

87     /**
88      * The vertex that this event is related to.
89      */

90     protected V vertex;
91
92     //~ Constructors ----------------------------------------------------------
93

94     /**
95      * Creates a new GraphVertexChangeEvent object.
96      *
97      * @param eventSource the source of the event.
98      * @param type the type of the event.
99      * @param vertex the vertex that the event is related to.
100      */

101     public GraphVertexChangeEvent(Object JavaDoc eventSource, int type, V vertex)
102     {
103         super(eventSource, type);
104         this.vertex = vertex;
105     }
106
107     //~ Methods ---------------------------------------------------------------
108

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

114     public V getVertex()
115     {
116         return vertex;
117     }
118 }
119
Popular Tags