org/objectweb/proactive/benchmarks/timit/util/observing/EventDataBag.java

00001 /* 
00002  * ################################################################
00003  * 
00004  * ProActive: The Java(TM) library for Parallel, Distributed, 
00005  *            Concurrent computing with Security and Mobility
00006  * 
00007  * Copyright (C) 1997-2007 INRIA/University of Nice-Sophia Antipolis
00008  * Contact: proactive@objectweb.org
00009  * 
00010  * This library is free software; you can redistribute it and/or
00011  * modify it under the terms of the GNU Lesser General Public
00012  * License as published by the Free Software Foundation; either
00013  * version 2.1 of the License, or any later version.
00014  *  
00015  * This library is distributed in the hope that it will be useful,
00016  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00017  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00018  * Lesser General Public License for more details.
00019  * 
00020  * You should have received a copy of the GNU Lesser General Public
00021  * License along with this library; if not, write to the Free Software
00022  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
00023  * USA
00024  *  
00025  *  Initial developer(s):               The ProActive Team
00026  *                        http://www.inria.fr/oasis/ProActive/contacts.html
00027  *  Contributor(s): 
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 }

Generated on Mon Jan 22 15:16:04 2007 for ProActive by  doxygen 1.5.1