Esempio n. 1
0
 /**
  * Filters a PMData's measurements by the modifier of each measurement... the format for the data
  * should be such for each modifier, there is parameter name/value pairs for each parameter name
  * supplied. the resulting list is a list of String arrays with the parameters
  *
  * @param data PMData: the PM data object
  * @param params String[]: the PM parameters
  * @return Hashtable: a table of string arrays, with the modifier as the key (or "?" if no
  *     modifier)
  */
 public static Hashtable process(PMData data, String[] params) {
   if (data != null) {
     // table for temporary storage of param lists...
     Hashtable ht = new Hashtable();
     // for each param...
     for (int i = 0; i < params.length; i++) {
       PmMeasurement[] m = data.getMeasurementList();
       for (int j = 0; j < m.length; j++) {
         if (m[j].getParameterName().equals(params[i])) {
           String mod = m[j].getModifier();
           if (mod == null) {
             mod = "?";
           }
           String[] datum = (String[]) ht.get(mod);
           if (datum == null) {
             datum = new String[params.length];
             for (int k = 0; k < params.length; k++) {
               datum[k] = "";
             }
           }
           datum[i] = m[j].getParameterValue();
           ht.put(mod, datum);
         }
       }
     }
     return ht;
   }
   return null;
 }
Esempio n. 2
0
 /**
  * Filters a PMData's measurements by the modifier of each measurement... the format for the data
  * should be such for each modifier, there is parameter name/value pairs for each parameter name
  * supplied. the resulting list is a list of String arrays with the parameters
  *
  * @param data PMData: the PM data object
  * @param params String[]: the PM parameters
  * @return Hashtable: a table of string arrays, with the modifier as the key (or "?" if no
  *     modifier)
  */
 public static Hashtable processInclude(PMData data, String[] params) {
   if (data != null) {
     Hashtable ht = new Hashtable();
     // for each measurement...
     PmMeasurement[] m = data.getMeasurementList();
     for (int i = 0; i < m.length; i++) {
       if (m[i] == null) {
         continue;
       }
       String mod = m[i].getModifier();
       if (mod == null) {
         mod = "?";
       }
       String[] datum = (String[]) ht.get(mod);
       if (datum == null) {
         datum = new String[params.length];
         for (int j = 0; j < params.length; j++) {
           datum[j] = "";
         }
       }
       for (int j = 0; j < params.length; j++) {
         if (m[i].getParameterName().equals(params[j])) {
           datum[j] = m[i].getParameterValue();
         }
       }
       ht.put(mod, datum);
     }
     return ht;
   }
   return null;
 }
Esempio n. 3
0
 /**
  * Filters a PMData's measurements by the modifier of each measurement... the format for the data
  * should be such for each modifier, there is parameter name/value pairs for each parameter name
  * supplied. the resulting list is a list of String arrays with the parameters
  *
  * @param data PMData: the PM data object
  * @param params String[]: the PM parameters
  * @param includeMod boolean: include modifier as first value if true
  * @return ArrayList: a list of string arrays
  */
 public static ArrayList processByMod(PMData data, String[] params, boolean includeMod) {
   if (data != null) {
     // table for temporary storage of param lists...
     Hashtable ht = new Hashtable();
     // for each param...
     for (int i = 0; i < params.length; i++) {
       PmMeasurement[] m = data.getMeasurementList();
       for (int j = 0; j < m.length; j++) {
         if (m[j].getParameterName().equals(params[i])) {
           String mod = m[j].getModifier();
           if (mod == null) {
             mod = "?";
           }
           String[] datum = (String[]) ht.get(mod);
           int offset = (includeMod ? 1 : 0);
           if (datum == null) {
             if (includeMod) {
               datum = new String[params.length + 1];
               datum[0] = mod;
             } else {
               datum = new String[params.length];
             }
             for (int k = 0; k < params.length; k++) {
               datum[k + offset] = "";
             }
           }
           datum[i + offset] = m[j].getParameterValue();
           ht.put(mod, datum);
         }
       }
     }
     return new ArrayList(ht.values());
   }
   return null;
 }