BaseExperimentWithMetrics.java

Go to the documentation of this file.
00001 package edu.rice.cs.hpc.data.experiment;
00002 
00003 import java.io.File;
00004 import java.util.List;
00005 
00006 import edu.rice.cs.hpc.data.experiment.metric.BaseMetric;
00007 import edu.rice.cs.hpc.data.util.IUserData;
00008 
00009 
00010 /****************************************************************************
00011  * 
00012  * abstract base experiment that contains metrics. <br/>
00013  * This class just load metrics without generating callers view and flat view
00014  *
00015  ****************************************************************************/
00016 public abstract class BaseExperimentWithMetrics extends BaseExperiment {
00017 
00018 
00019 
00020     protected List<BaseMetric> metrics;
00021 
00022 
00023 
00024     public void setMetrics(List<BaseMetric> metricList) {
00025 
00026         metrics = metricList;
00027     }
00028 
00029 
00030 
00032     //ACCESS TO METRICS                                                 //
00034 
00035 
00036     /*************************************************************************
00037      *  Returns the array of metrics in the experiment.
00038      ************************************************************************/
00039 
00040     public BaseMetric[] getMetrics()
00041     {
00042         return  this.metrics.toArray(new BaseMetric[0]);
00043     }
00044 
00045 
00046     /*************************************************************************
00047      *  Returns the number of metrics in the experiment.
00048      ************************************************************************/
00049 
00050     public int getMetricCount()
00051     {
00052         return this.metrics.size();
00053     }
00054 
00055 
00056 
00057 
00058     /*************************************************************************
00059      *  Returns the metric with a given index.
00060      ************************************************************************/
00061 
00062     public BaseMetric getMetric(int index)
00063     {
00064 
00065         BaseMetric metric;
00066         // laks 2010.03.03: bug fix when the database contains no metrics
00067         try {
00068             metric = this.metrics.get(index);
00069         } catch (Exception e) {
00070             // if the metric doesn't exist or the index is out of range, return null
00071             metric = null;
00072         }
00073         return metric;
00074     }
00075 
00076 
00077 
00078 
00079     /*************************************************************************
00080      *  Returns the metric with a given internal name.
00081      ************************************************************************/
00082 
00083     public BaseMetric getMetric(String name)
00084     {
00085 
00086         final int size = metrics.size();
00087         
00088         for (int i=0; i<size; i++) {
00089 
00090             final BaseMetric metric = metrics.get(i);
00091             if (metric.getShortName().equals(name))
00092                 return metrics.get(i);
00093         }
00094         return null;    
00095     }
00096     
00097 
00098 
00099 /*************************************************************************
00100  *  Returns the number of search paths in the experiment.
00101  ************************************************************************/
00102     
00103 public int getSearchPathCount()
00104 {
00105     return this.configuration.getSearchPathCount();
00106 }
00107 
00108 
00109 
00110 
00111 
00112 /*************************************************************************
00113  *  Returns the search path with a given index.
00114  ************************************************************************/
00115     
00116 public File getSearchPath(int index)
00117 {
00118     return this.configuration.getSearchPath(index);
00119 }
00120 
00121 
00122 
00123 }

Generated on 5 May 2015 for HPCVIEWER by  doxygen 1.6.1