1 |
package appl.parallel.event; |
2 |
|
3 |
/** |
4 |
* A {@link CommEvent} is a {@link RemoteEvent}. It gives Information about |
5 |
* Events related to Communication. |
6 |
* |
7 |
* @author Dominik Appl |
8 |
*/ |
9 |
public class CommEvent extends RemoteEvent { |
10 |
|
11 |
/** |
12 |
* The target of the event |
13 |
*/ |
14 |
protected final String target; |
15 |
|
16 |
/** |
17 |
* The source of the event |
18 |
*/ |
19 |
protected final String src; |
20 |
|
21 |
/** |
22 |
* the type of the event |
23 |
*/ |
24 |
protected final CommType type; |
25 |
|
26 |
/** |
27 |
* @author Dominik Appl |
28 |
*/ |
29 |
public enum CommType { |
30 |
/** |
31 |
* A not further specified type |
32 |
*/ |
33 |
UNDEFINED, |
34 |
/** |
35 |
* A Server has made an update from a source (possibly another server) |
36 |
*/ |
37 |
REMOTE_UPDATE, |
38 |
/** |
39 |
* A Server has executed a task (without client-server communication) |
40 |
*/ |
41 |
REMOTE_EXECUTION, |
42 |
/** |
43 |
* A Client has executed a Task (including communication) |
44 |
*/ |
45 |
CLIENT_EXECUTION, |
46 |
/** |
47 |
* A client has invoked an update |
48 |
*/ |
49 |
CLIENT_UPDATE, |
50 |
/** |
51 |
* A client has invoked a merge |
52 |
*/ |
53 |
CLIENT_MERGE, |
54 |
/** |
55 |
* Parameters were transfered |
56 |
*/ |
57 |
TRANSFER_PARAMETERS, |
58 |
/** |
59 |
* meta data was transfered |
60 |
*/ |
61 |
TRANSFER_METADATA, |
62 |
/** |
63 |
* data was transfered |
64 |
*/ |
65 |
TRANSFER_DATA, |
66 |
/** |
67 |
* Connection to servers were made |
68 |
*/ |
69 |
CONNECT, |
70 |
/** |
71 |
* The client disconnects from the servers |
72 |
*/ |
73 |
DISCONNECT, |
74 |
} |
75 |
|
76 |
/** |
77 |
* A new CommEvent |
78 |
* |
79 |
* @param src |
80 |
* the source of the event |
81 |
* @param target |
82 |
* the target |
83 |
* @param type |
84 |
* the type |
85 |
*/ |
86 |
CommEvent(String src, String target, CommType type) { |
87 |
this.target = (target == null) ? "" : target; |
88 |
this.src = (src == null) ? "" : src; |
89 |
this.type = (type == null) ? CommType.UNDEFINED : type; |
90 |
} |
91 |
|
92 |
/** |
93 |
* @return the target |
94 |
*/ |
95 |
public String getTarget() { |
96 |
return target; |
97 |
} |
98 |
|
99 |
/** |
100 |
* @return the source |
101 |
*/ |
102 |
public String getSrc() { |
103 |
return src; |
104 |
} |
105 |
|
106 |
/** |
107 |
* @return the type |
108 |
*/ |
109 |
public CommType getType() { |
110 |
return type; |
111 |
} |
112 |
|
113 |
public String typeName() { |
114 |
return type.toString(); |
115 |
} |
116 |
|
117 |
} |