/**
   * Instantiate and populate a pems object from the next item in the result set of a pems query.
   *
   * @param query string
   * @return PeMS
   */
  protected PeMS pemsFromQueryRS(String query) throws DatabaseException {
    PeMS pems = null;

    if (dbr.psRSNext(query)) {
      // String columns = org.apache.commons.lang.StringUtils.join(dbr.psRSColumnNames(query), ",
      // ");
      // System.out.println("columns: [" + columns + "]");

      pems = new PeMS();

      Long vdsId = dbr.psRSGetBigInt(query, "VDS_ID");
      edu.berkeley.path.model_elements.DateTime timeMeasured =
          new edu.berkeley.path.model_elements.DateTime(
              dbr.psRSGetTimestampMilliseconds(query, "MEASURE_DT"));

      Double flow = dbr.psRSGetDouble(query, "FLOW");
      Double density = dbr.psRSGetDouble(query, "DENSITY");
      Double densityError = dbr.psRSGetDouble(query, "DENSITY_ERR");
      Double speed = dbr.psRSGetDouble(query, "SPEED");
      Double speedError = dbr.psRSGetDouble(query, "SPEED_ERROR");
      Double ffSpeed = dbr.psRSGetDouble(query, "FF_SPEED");
      Double funcLoopFact = dbr.psRSGetDouble(query, "FUNC_LOOP_FACT");

      ArrayList<Double> gFactorLane = new ArrayList<Double>();

      for (int i = 0; i <= 9; i++) {
        gFactorLane.add(dbr.psRSGetDouble(query, "G_FACTOR_LANE_" + i));
      }

      pems.setVdsId(vdsId);
      pems.setTimeMeasured(timeMeasured);
      pems.setFlow(flow);
      pems.setDensity(density);
      pems.setDensityError(densityError);
      pems.setSpeed(speed);
      pems.setSpeedError(speedError);
      pems.setFreeFlowSpeed(ffSpeed);
      pems.setFuncLoopFact(funcLoopFact);
      pems.setGFactorLane(gFactorLane);
    }

    return pems;
  }
Ejemplo n.º 2
-8
 public ArrayList getSelectedMessages() {
   ArrayList list = new ArrayList();
   for (int i = 0; i < table.getRowCount(); i++) {
     if (((Boolean) table.getValueAt(i, 0)) == true) {
       list.add(msgID[i]);
     }
   }
   return list;
 }