|
|||||||||||||||||||
Source file | Conditionals | Statements | Methods | TOTAL | |||||||||||||||
ViewerModelEvent.java | - | 0% | 0% | 0% |
|
1 | package net.sourceforge.pmd.util.viewer.model; | |
2 | ||
3 | /** | |
4 | * The event which will be sent every time the model changes | |
5 | * <p/> | |
6 | * <p/> | |
7 | * <p/> | |
8 | * <p/> | |
9 | * <p/> | |
10 | * Note: the instances will be immutable | |
11 | * <p/> | |
12 | * </p> | |
13 | * | |
14 | * @author Boris Gruschko ( boris at gruschko.org ) | |
15 | * @version $Id: ViewerModelEvent.java,v 1.5 2005/08/23 17:17:49 tomcopeland Exp $ | |
16 | */ | |
17 | public class ViewerModelEvent { | |
18 | /** | |
19 | * reason in the case of code recompilation | |
20 | */ | |
21 | public static final int CODE_RECOMPILED = 1; | |
22 | /** | |
23 | * reason in the case of node selection | |
24 | */ | |
25 | public static final int NODE_SELECTED = 2; | |
26 | /** | |
27 | * reason in the case of path extension | |
28 | */ | |
29 | public static final int PATH_EXPRESSION_APPENDED = 3; | |
30 | /** | |
31 | * reason in the case of path expression evaluation | |
32 | */ | |
33 | public static final int PATH_EXPRESSION_EVALUATED = 4; | |
34 | private Object source; | |
35 | private int reason; | |
36 | private Object parameter; | |
37 | ||
38 | /** | |
39 | * Creates an event | |
40 | * | |
41 | * @param source event's source | |
42 | * @param reason event's reason | |
43 | */ | |
44 | 0 | public ViewerModelEvent(Object source, int reason) { |
45 | 0 | this(source, reason, null); |
46 | } | |
47 | ||
48 | /** | |
49 | * Creates an event | |
50 | * | |
51 | * @param source event's source | |
52 | * @param reason event's reason | |
53 | * @param parameter parameter object | |
54 | */ | |
55 | 0 | public ViewerModelEvent(Object source, int reason, Object parameter) { |
56 | 0 | this.source = source; |
57 | 0 | this.reason = reason; |
58 | 0 | this.parameter = parameter; |
59 | } | |
60 | ||
61 | /** | |
62 | * retrieves the reason for event's occurance | |
63 | * | |
64 | * @return event's reason | |
65 | */ | |
66 | 0 | public int getReason() { |
67 | 0 | return reason; |
68 | } | |
69 | ||
70 | /** | |
71 | * retrieves the object which caused the event | |
72 | * | |
73 | * @return object that casused the event | |
74 | */ | |
75 | 0 | public Object getSource() { |
76 | 0 | return source; |
77 | } | |
78 | ||
79 | /** | |
80 | * retrieves event's parameter | |
81 | * | |
82 | * @return event's parameter | |
83 | */ | |
84 | 0 | public Object getParameter() { |
85 | 0 | return parameter; |
86 | } | |
87 | } |
|