Esempio n. 1
0
void FWSingle::transferParentsOneGeneration( )
{
  vector<vector<long> >::reverse_iterator stepIDIterator(IDs.rbegin());
  vector<vector<long> >::reverse_iterator stepPIDIterator(PIDs.rbegin()), nextStepPIDIterator(realPIDs.rbegin());
  stepIDIterator+=gensTransferred;
  nextStepPIDIterator+=gensTransferred;
  int i(0);
  do
  {
    vector<long>::iterator hereID( (*stepIDIterator).begin() ) ;
    vector<long>::iterator nextStepPID( (*nextStepPIDIterator).begin() );
    vector<long>::iterator herePID( (*stepPIDIterator).begin() );
    if (verbose>2)
      app_log()<<"  calculating Parent IDs for gen:"<<gensTransferred<<" step:"<<i<<"/"<<PIDs.size()-gensTransferred<<endl;
    if (verbose>2)
    {
      printIDs((*nextStepPIDIterator));
      printIDs((*stepIDIterator));
      printIDs((*stepPIDIterator));
    }
    do
    {
      if ((*herePID)==(*hereID))
      {
        (*herePID)=(*nextStepPID);
        herePID++;
      }
      else
      {
        hereID++;
        nextStepPID++;
        if (hereID==(*stepIDIterator).end())
        {
          hereID=(*stepIDIterator).begin();
          nextStepPID=(*nextStepPIDIterator).begin();
          //             if (verbose>2) app_log()<<"resetting to beginning of parents"<<endl;
        }
      }
    }
    while(herePID<(*stepPIDIterator).end());
    stepIDIterator++;
    nextStepPIDIterator++;
    stepPIDIterator++;
    i++;
  }
  while(stepIDIterator<IDs.rend());
  gensTransferred++; //number of gens backward to compare parents
  if (verbose>2)
    app_log()<<"  Finished generation block"<<endl;
}
Esempio n. 2
0
/*
    Prints a Node type
        @Param node Node to be print
*/
void printNode( Node* currentNode, int tabs) {

    if(currentNode->n_type == NODE_DONTPRINT)
           return;

    /* TODO: falta aqui um tipo acho eu */
    else if(currentNode->n_type == NODE_BOOLLIT || currentNode->n_type == NODE_INTLIT || currentNode->n_type == NODE_ID ) {
        printTabs(tabs);
        printf("%s(%s)\n",NODE_STRING[currentNode->n_type], currentNode->value);
    }
    else {
        printTabs(tabs);
        printf("%s\n", NODE_STRING[currentNode->n_type]);
        if(currentNode->n_type == NODE_VARDECL || currentNode->n_type == NODE_PARAMDECL || currentNode->n_type == NODE_METHODDECL){
            printTabs(tabs + 1);
            printf("%s\n",NODE_TYPE_NAMES[currentNode->type]);
        }
        printIDs(currentNode->id,tabs+1, currentNode->n_type, currentNode->type);
    }
        
}