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;
00032
00033 import java.util.Vector;
00034
00035 import org.objectweb.proactive.benchmarks.timit.util.EventStatistics;
00036
00043 public class EventDataBag implements java.io.Serializable {
00044
00048 private static final long serialVersionUID = -6689679318037025254L;
00049
00051 private int subjectRank;
00052
00054 private Vector<EventData> bag;
00055
00056 public EventDataBag() {
00057 }
00058
00060 public EventDataBag(int rank) {
00061 this.subjectRank = rank;
00062 this.bag = null;
00063 }
00064
00065 public int getSubjectRank() {
00066 return this.subjectRank;
00067 }
00068
00069 public void setBag(Vector<EventData> bag) {
00070 this.bag = bag;
00071 }
00072
00073 public Vector<EventData> getBag() {
00074 return this.bag;
00075 }
00076
00077 public EventData getEventData(int index) {
00078 return this.bag.get(index);
00079 }
00080
00081 public int size() {
00082 return this.bag.size();
00083 }
00084
00085 public EventStatistics getStats() {
00086 String[] counterName = new String[this.size()];
00087 Object[] value = new Object[this.size()];
00088
00089 for (int i = 0; i < this.size(); i++) {
00090 counterName[i] = this.getEventData(i).getName();
00091 value[i] = this.getEventData(i);
00092 }
00093
00094 return new EventStatistics(counterName, value, this.size(), this);
00095 }
00096
00097 public String toString() {
00098 String res = "";
00099 for (int i = 0; i < this.bag.size(); i++) {
00100 res += this.bag.get(i).toString() + "\n";
00101 }
00102
00103 return res;
00104 }
00105
00106 }