Logo Search packages:      
Sourcecode: tablix2 version File versions  Download package

void ext_update ( ext ex,
table tab 
)

Update extension with new data from a timetable.

Parameters:
ex Pointer to the extension structure to update.
tab Pointer to the table with the new data.

Definition at line 1098 of file data.c.

References resourcetype_t::c_inuse, resourcetype_t::c_lookup, resourcetype_t::c_num, table_t::chr, ext_t::con_typeid, ext_t::connum, chromo_t::gen, chromo_t::gennum, chromo_t::restype, ext_t::tupleid, ext_t::var_typeid, and ext_t::varnum.

Referenced by table_fitness().

{
      chromo *con_chr, *var_chr;
      resourcetype *con_restype;
      int tupleid;
      int con_resid, var_resid;
      int resid;
      int n;
      
      assert(ex!=NULL);
      assert(tab!=NULL);

      for(var_resid=0;var_resid<ex->varnum;var_resid++) {
            memset(ex->tupleid[var_resid], 0xFF, sizeof(int)*ex->connum);
            /*
            for(con_resid=0;con_resid<ex->connum;con_resid++) {
                  ex->tupleid[var_resid][con_resid]=-1;
            }
            */
      }

      con_chr=&tab->chr[ex->con_typeid];
      var_chr=&tab->chr[ex->var_typeid];

      con_restype=con_chr->restype;

      if(con_restype->c_inuse) {
            /* If non trivial conflicts are defined, we must use
             * the slow way of calculating the extension */
              for(tupleid=0;tupleid<var_chr->gennum;tupleid++) {
                  var_resid=var_chr->gen[tupleid];
                  con_resid=con_chr->gen[tupleid];

                        for(n=0;n<con_restype->c_num[con_resid];n++) {
                        resid=con_restype->c_lookup[con_resid][n];
                        ex->tupleid[var_resid][resid]=tupleid;
                  }
              }
      } else {
              for(tupleid=0;tupleid<var_chr->gennum;tupleid++) {
                  var_resid=var_chr->gen[tupleid];
                  con_resid=con_chr->gen[tupleid];

                  ex->tupleid[var_resid][con_resid]=tupleid;
            }
      }
}


Generated by  Doxygen 1.6.0   Back to index