int main(int argc, char *argv[])
{
  double x,y;
  int i;
  int xyz=0;

  startgraphics();
  randinit();

  D2=4*R*R;

  for (i=0; n<N; i++)
  {
    tryInsert();
    perturb();
    if (counter>5500)
    {
      drawObjects();
      check4event();
      counter=0;
  printf(".");
    }
  }

  while(1)
  {
    drawObjects();
    check4event();
    sleep(1);
  }
}
Beispiel #2
0
unsigned int
MSInsertionControl::emitVehicles(SUMOTime time) {
    // check whether any vehicles shall be emitted within this time step
    const bool havePreChecked = MSDevice_Routing::isEnabled();
    if (myPendingEmits.empty() || (havePreChecked && myEmitCandidates.empty())) {
        return 0;
    }
    unsigned int numEmitted = 0;
    // we use buffering for the refused emits to save time
    //  for this, we have two lists; one contains previously refused emits, the second
    //  will be used to append those vehicles that will not be able to depart in this
    //  time step
    MSVehicleContainer::VehicleVector refusedEmits;

    // go through the list of previously refused vehicles, first
    MSVehicleContainer::VehicleVector::const_iterator veh;
    for (veh = myPendingEmits.begin(); veh != myPendingEmits.end(); veh++) {
        if (havePreChecked && (myEmitCandidates.count(*veh) == 0)) {
            refusedEmits.push_back(*veh);
        } else {
            numEmitted += tryInsert(time, *veh, refusedEmits);
        }
    }
    myEmitCandidates.clear();
    myPendingEmits = refusedEmits;
    return numEmitted;
}
Beispiel #3
0
bool Cache::isCached(QString path, QString &code) {
    QString hash = hashFile(path);
    QSqlQuery query(db);

    if (!tryInsert(path, hash)) {
        query.exec("SELECT GenCode FROM MedusaCache WHERE Hash='" + hash + "'");
        query.next();

        if (query.isValid()) {
            code = query.value(0).toString();
            return true;
        }
        else
            return changed(path, hash, code) ? false : true;
    }
    else
        return false;
}