469
|
1 package alice.topology.node;
|
|
2
|
|
3 import java.util.List;
|
|
4
|
470
|
5 import alice.codesegment.CloseEventCodeSegment;
|
469
|
6 import alice.codesegment.CodeSegment;
|
|
7 import alice.datasegment.CommandType;
|
|
8 import alice.datasegment.Receiver;
|
|
9
|
|
10 public class ExecuteEvent<T> extends CodeSegment {
|
|
11
|
|
12 public Receiver info = ids.create(CommandType.TAKE);
|
|
13 public Receiver info1 = ids.create(CommandType.TAKE);
|
|
14
|
|
15 public ExecuteEvent() {
|
547
|
16 info.setKey("_DEVENTLIST", this);
|
|
17 info1.setKey("_DISCONNECT", this);
|
469
|
18 }
|
|
19
|
|
20 @SuppressWarnings("unchecked")
|
|
21 @Override
|
|
22 public void run() {
|
|
23 List<Class<T>> eventList = info.asClass(List.class);
|
|
24 try {
|
|
25 for (Class<T> clazz : eventList){
|
|
26 // set MetaInfo
|
|
27 if ("CloseEventCodeSegment".equals(clazz.getSuperclass().getSimpleName())) {
|
|
28 CloseEventCodeSegment obj = (CloseEventCodeSegment) clazz.newInstance();
|
478
|
29 obj.metaInfo = info1;
|
469
|
30 obj.ids.setKey();
|
|
31 obj.ids.receive();
|
|
32 } else if ("CodeSegment".equals(clazz.getSuperclass().getSimpleName())){
|
|
33 clazz.newInstance();
|
|
34 }
|
|
35 }
|
|
36 } catch (InstantiationException e) {
|
|
37 e.printStackTrace();
|
|
38 } catch (IllegalAccessException e) {
|
|
39 e.printStackTrace();
|
|
40 } catch (SecurityException e) {
|
|
41 e.printStackTrace();
|
|
42 }
|
|
43 ods.put(info.key, info.getReceiveData());
|
|
44 }
|
|
45
|
|
46 }
|