1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24 package zeus.actors.event;
25
26 import zeus.util.*;
27 import zeus.concepts.*;
28
29 public class MessageHandlerEvent extends Event {
30 public static final long ADD_MASK = 1;
31 public static final long DELETE_MASK = 2;
32 public static final long FIRE_MASK = 4;
33 public static final long FAIL_MASK = 8;
34
35 protected Object destination = null;
36 protected MessageRule rule = null;
37 protected String ruleName = null;
38 protected Performative msg = null;
39 protected String method = null;
40
41 public MessageHandlerEvent(Object source, MessageRule rule, long event_mask) {
42 super(source,source,HANDLER_FIRST,HANDLER_LAST,event_mask);
43 this.rule = rule;
44 this.ruleName = rule.getName();
45 }
46
47 public MessageHandlerEvent(Object source, String rule, long event_mask) {
48 super(source,source,HANDLER_FIRST,HANDLER_LAST,event_mask);
49 this.ruleName = rule;
50 }
51
52 public MessageHandlerEvent(Object source, String rule,
53 Object destination, String method,
54 Performative msg, long event_mask) {
55 super(source,source,HANDLER_FIRST,HANDLER_LAST,event_mask);
56 this.ruleName = rule;
57 this.destination = destination;
58 this.method = method;
59 this.msg = msg;
60 }
61
62 public Performative getMessage() {
63 return msg;
64 }
65 public String getSender() {
66 return msg.getSender();
67 }
68 public String getReceiver() {
69 return msg.getReceiver();
70 }
71 public String getMessageType() {
72 return msg.getType();
73 }
74 public String getDestination() {
75 if ( destination == null ) return null;
76 return destination.getClass().getName();
77 }
78 public String getMethod() {
79 return method;
80 }
81 public String getRuleName() {
82 return ruleName;
83 }
84
85 public MessageRule getRule() {
86 return rule;
87 }
88 }