00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031 package org.objectweb.proactive.benchmarks.timit.util.observing.commobserv;
00032
00033 import org.objectweb.proactive.benchmarks.timit.util.observing.EventData;
00034 import org.objectweb.proactive.benchmarks.timit.util.observing.EventObservable;
00035 import org.objectweb.proactive.benchmarks.timit.util.observing.EventObserver;
00036
00043 public class CommEventObserver implements EventObserver {
00047 private static final long serialVersionUID = 8068073524780563668L;
00049 private CommEventData commStatData;
00050 private String name;
00051
00063 public CommEventObserver(String name, int groupSize, int subjectRank) {
00064 this.commStatData = new CommEventData(name, groupSize, subjectRank);
00065 this.name = name;
00066 }
00067
00076 public void update(EventObservable s, Object arg) {
00077 if (arg instanceof CommEvent && ((CommEvent) arg).getObserver() == this) {
00078 this.commStatData.mark(((CommEvent) arg).getDestRank(),
00079 ((CommEvent) arg).getValue());
00080
00081 }
00082 }
00083
00089 public EventData getEventData() {
00090 return this.commStatData;
00091 }
00092
00096 public String getName() {
00097 return this.name;
00098 }
00099 }