1 | package dmg.cells.nucleus ; |
2 | |
3 | /** |
4 | * |
5 | * |
6 | * @author Patrick Fuhrmann |
7 | * @version 0.1, 15 Feb 1998 |
8 | */ |
9 | public class CellEvent { |
10 | private Object _source ; |
11 | private int _type ; |
12 | |
13 | public final static int EXCEPTION_EVENT = 1 ; |
14 | public final static int REMOVAL_EVENT = 2 ; |
15 | public final static int CELL_CREATED_EVENT = 3 ; |
16 | public final static int CELL_DIED_EVENT = 4 ; |
17 | public final static int CELL_EXPORTED_EVENT = 5 ; |
18 | public final static int CELL_UNEXPORTED_EVENT = 6 ; |
19 | public final static int CELL_ROUTE_ADDED_EVENT = 7 ; |
20 | public final static int CELL_ROUTE_DELETED_EVENT = 8 ; |
21 | public final static int OTHER_EVENT = 9 ; |
22 | |
23 | public CellEvent( ) { |
24 | this(null, OTHER_EVENT); |
25 | } |
26 | |
27 | public CellEvent( Object source , int type ) { |
28 | _source = source ; |
29 | _type = type ; |
30 | } |
31 | |
32 | public Object getSource() { |
33 | return _source ; |
34 | } |
35 | |
36 | public void setSource( Object source ){ _source = source ; } |
37 | public int getEventType(){ return _type ; } |
38 | public String toString(){ |
39 | String m ; |
40 | switch( _type ){ |
41 | case CELL_CREATED_EVENT : m = "CELL_CREATED_EVENT" ; break ; |
42 | case CELL_EXPORTED_EVENT : m = "CELL_EXPORTED_EVENT" ; break ; |
43 | case CELL_DIED_EVENT : m = "CELL_DIED_EVENT" ; break ; |
44 | case CELL_ROUTE_ADDED_EVENT : m = "CELL_ROUTE_ADDED_EVENT" ; break ; |
45 | case CELL_ROUTE_DELETED_EVENT : m = "CELL_ROUTE_DELETED_EVENT" ; break ; |
46 | default : m = "UNKNOWN" ; |
47 | } |
48 | return "Event("+m+","+_source.toString()+")" ; |
49 | } |
50 | } |