Ignore:
Timestamp:
07/20/16 01:17:14 (8 years ago)
Author:
Maciej Komosinski
Message:

Renamed: get/setGene -> get/setGenes, setGeneOnly -> setGenesAssumingSameFormat

File:
1 edited

Legend:

Unmodified
Added
Removed
  • cpp/frams/genetics/genman.cpp

    r532 r534  
    198198int GenMan::testValidity(Geno &g, bool &canvalidate)
    199199{
    200         SString ggs=g.getGene();
     200        SString ggs=g.getGenes();
    201201        const char *gg = ggs.c_str();
    202202        GenoOperators *gf = getOper_f(g.getFormat());
     
    210210        if (check1 == GENOPER_NOOPER) //disaster: cannot check because there is no check operator
    211211        {
    212                 g.setGeneOnly(g2); free(g2); canvalidate = false; return GENOPER_NOOPER;
     212                g.setGenesAssumingSameFormat(g2); free(g2); canvalidate = false; return GENOPER_NOOPER;
    213213        }
    214214        int check2 = gf->checkValidity(g2, "validated");
    215         if (check2 == GENOPER_OK) g.setGeneOnly(g2);
     215        if (check2 == GENOPER_OK) g.setGenesAssumingSameFormat(g2);
    216216        free(g2);
    217217        if (check2 == GENOPER_OK) return check1;
     
    237237        if (gf == NULL)
    238238                return Geno(SString::empty(), -1, SString::empty(), SString::sprintf("GENOPER_NOOPER: Validate(): don't know how to handle genetic format %c", format));
    239         char *g2 = strdup(geny.getGene().c_str()); //copy for validation
     239        char *g2 = strdup(geny.getGenes().c_str()); //copy for validation
    240240        int res = gf->validate(g2, geny.getName().c_str());
    241241        SString sg2 = g2;
     
    263263        while (!ok)
    264264        {
    265                 char *gn = strdup(gv.getGene().c_str()); //copy for mutation
     265                char *gn = strdup(gv.getGenes().c_str()); //copy for mutation
    266266                chg = 0;
    267267                if (gf->mutate(gn, chg, method) == GENOPER_OK)
     
    284284                if (!ok && (count - pcount > 100))
    285285                {
    286                         logPrintf("GenMan", "Mutate", 2, "Tried 100x and failed: %s", g.getGene().c_str());
     286                        logPrintf("GenMan", "Mutate", 2, "Tried 100x and failed: %s", g.getGenes().c_str());
    287287                        return Geno("", -1, "", "GENOPER_OPFAIL: Mutate() tried 100x and failed");
    288288                }
    289289        }
    290290        mutchg += chg;
    291         if (history) saveLink(g.getGene().c_str(), "", gv.getGene().c_str(), chg);
     291        if (history) saveLink(g.getGenes().c_str(), "", gv.getGenes().c_str(), chg);
    292292        SString mutinfo;
    293293        if (extmutinfo == 0) mutinfo = SString::sprintf("%.2f%% mutation of '%s'", 100 * chg, g.getName().c_str()); else
     
    324324        {
    325325                float chg1, chg2;
    326                 char *g1n = strdup(g1.getGene().c_str()); //copy for crossover
    327                 char *g2n = strdup(g2.getGene().c_str()); //copy for crossover
     326                char *g1n = strdup(g1.getGenes().c_str()); //copy for crossover
     327                char *g2n = strdup(g2.getGenes().c_str()); //copy for crossover
    328328                chg1 = chg2 = 0;
    329329                if (gf->crossOver(g1n, g2n, chg1, chg2) == GENOPER_OK)
     
    351351                if (!ok && (count - pcount > 100))
    352352                {
    353                         logPrintf("GenMan", "CrossOver", 2, "Tried 100x and failed: %s and %s", g1.getGene().c_str(), g2.getGene().c_str());
     353                        logPrintf("GenMan", "CrossOver", 2, "Tried 100x and failed: %s and %s", g1.getGenes().c_str(), g2.getGenes().c_str());
    354354                        return Geno("", -1, "", "GENOPER_OPFAIL: CrossOver() tried 100x and failed");
    355355                }
     
    357357        // result in g1v
    358358        xochg += chg;
    359         if (history) saveLink(g1.getGene().c_str(), g2.getGene().c_str(), g1v.getGene().c_str(), chg);
     359        if (history) saveLink(g1.getGenes().c_str(), g2.getGenes().c_str(), g1v.getGenes().c_str(), chg);
    360360        SString xoinfo = SString::sprintf("Crossing over of '%s' (%.2f%%) and '%s' (%.2f%%)",
    361361                g1.getName().c_str(), 100 * chg, g2.getName().c_str(), 100 * (1 - chg));
     
    369369        if (format != g2.getFormat()) return GENOPER_NOOPER;
    370370        GenoOperators *gf = getOper_f(format);
    371         if (!gf) return GENOPER_NOOPER; else return gf->similarity(g1.getGene().c_str(), g2.getGene().c_str());
     371        if (!gf) return GENOPER_NOOPER; else return gf->similarity(g1.getGenes().c_str(), g2.getGenes().c_str());
    372372}
    373373
     
    380380        GenoOperators *gf = getOper_f(format);
    381381        if (!gf) return GENSTYLE_CS(0, 0); //black & valid
    382         else return gf->style(G->getGene().c_str(), pos);
     382        else return gf->style(G->getGenes().c_str(), pos);
    383383}
    384384
     
    399399        }
    400400        GenoOperators *gf = getOper_f(format);
    401         SString geny=G->getGene();
     401        SString geny=G->getGenes();
    402402        for (unsigned int pos = 0; pos < strlen(g); pos++)
    403403        {
Note: See TracChangeset for help on using the changeset viewer.