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.defaultobserver;
00032
00033 import org.objectweb.proactive.benchmarks.timit.util.observing.Event;
00034 import org.objectweb.proactive.benchmarks.timit.util.observing.EventData;
00035 import org.objectweb.proactive.benchmarks.timit.util.observing.EventObservable;
00036 import org.objectweb.proactive.benchmarks.timit.util.observing.EventObserver;
00037
00042 public class DefaultEventObserver implements EventObserver {
00043
00047 private static final long serialVersionUID = 1090600979208050233L;
00048 private DefaultEventData eventData;
00049 private String name;
00050
00052 public DefaultEventObserver(String name) {
00053 this(name,DefaultEventData.SUM,DefaultEventData.SUM);
00054 }
00055 public DefaultEventObserver(String name, int collapseOperation,
00056 int notifyOperation) {
00057 this.eventData = new DefaultEventData(name, collapseOperation,
00058 notifyOperation);
00059 this.name = name;
00060 }
00061
00062 public void update(EventObservable o, Object arg) {
00063 if (arg instanceof Event && ((Event) arg).getObserver() == this) {
00064 this.eventData.performNotifyOperation(((Event) arg).getValue());
00065 }
00066 }
00067
00068 public EventData getEventData() {
00069 return this.eventData;
00070 }
00071
00072
00076 public String getName() {
00077 return this.name;
00078 }
00079 }