Changeset 534


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

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

Location:
cpp/frams
Files:
22 edited

Legend:

Unmodified
Added
Removed
  • cpp/frams/_demos/f0_variants_test.cpp

    r391 r534  
    11// This file is a part of Framsticks SDK.  http://www.framsticks.com/
    2 // Copyright (C) 1999-2015  Maciej Komosinski and Szymon Ulatowski.
     2// Copyright (C) 1999-2016  Maciej Komosinski and Szymon Ulatowski.
    33// See LICENSE.txt for details.
    44
     
    9494        }
    9595Geno g(gen);
    96 printf("\nSource genotype: '%s'\n",g.getGene().c_str());
     96printf("\nSource genotype: '%s'\n",g.getGenes().c_str());
    9797printf("                  ( format %c %s)\n",
    9898       g.getFormat(), g.getComment().c_str());
  • cpp/frams/_demos/full_props.cpp

    r526 r534  
    11// This file is a part of Framsticks SDK.  http://www.framsticks.com/
    2 // Copyright (C) 1999-2015  Maciej Komosinski and Szymon Ulatowski.
     2// Copyright (C) 1999-2016  Maciej Komosinski and Szymon Ulatowski.
    33// See LICENSE.txt for details.
    44
     
    9797Geno f0_g;
    9898m.makeGeno(f0_g,NULL,reverse);//third arg is "handle_defaults" == whether f0 should omit default property values
    99 puts(f0_g.getGeneAndFormat().c_str());
     99puts(f0_g.getGenesAndFormat().c_str());
    100100
    101101return 0;
  • cpp/frams/_demos/genoconv_test.cpp

    r527 r534  
    5151mod.getPart(1)->p=Pt3D(0,0.2,-1);
    5252mod.close();
    53 return mod.getGeno().getGene();
     53return mod.getGeno().getGenes();
    5454}
    5555~GenoConv_Test2() {}
     
    112112{
    113113printf("Genotype:\n%s\nFormat: %c\nValid: %s\nComment: %s\n",
    114         g.getGene().c_str(),g.getFormat(),g.isValid()?"yes":"no",g.getComment().c_str());
     114        g.getGenes().c_str(),g.getFormat(),g.isValid()?"yes":"no",g.getComment().c_str());
    115115}
    116116
     
    159159        printf("conversion map:\n");
    160160        m.print();
    161         printConvMap(g1.getGene(),g2.getGene(),m);
     161        printConvMap(g1.getGenes(),g2.getGenes(),m);
    162162        printf("reverse conversion map:\n");
    163163        MultiMap rm;
    164164        rm.addReversed(m);
    165165        rm.print();
    166         printConvMap(g2.getGene(),g1.getGene(),rm);
     166        printConvMap(g2.getGenes(),g1.getGenes(),rm);
    167167        }
    168168
    169169Model mod1(g1,1);
    170170printf("\nmodel map for f%c genotype:\n",g1.getFormat());
    171 printModelMap(g1.getGene(),mod1.getMap());
     171printModelMap(g1.getGenes(),mod1.getMap());
    172172mod1.getMap().print();
    173173Model mod2(g2,1);
    174174printf("\nmodel map for f%c genotype:\n",g2.getFormat());
    175 printModelMap(g2.getGene(),mod2.getMap());
     175printModelMap(g2.getGenes(),mod2.getMap());
    176176mod2.getMap().print();
    177177return 0;
  • cpp/frams/_demos/genomanipulation.cpp

    r391 r534  
    7979CHANGE_ONE_PROPERTY(p->extraProperties());
    8080p->getModel().close();
    81 printf("\nLet's see f0... (check out part #%d !)\n\n%s\n", p->refno, p->getModel().getF0Geno().getGene().c_str());
     81printf("\nLet's see f0... (check out part #%d !)\n\n%s\n", p->refno, p->getModel().getF0Geno().getGenes().c_str());
    8282}
    8383
     
    9191j->getModel().close();
    9292printf("The Part's position is changed, but everything else stays intact:\n\n%s\n",
    93        j->getModel().getF0Geno().getGene().c_str());
     93       j->getModel().getF0Geno().getGenes().c_str());
    9494}
    9595
     
    104104j->getModel().close();
    105105printf("Position of the second Part referenced by this joint (part #%d) is now changed:\n\n%s\n",
    106        j->part2->refno, j->getModel().getF0Geno().getGene().c_str());
     106       j->part2->refno, j->getModel().getF0Geno().getGenes().c_str());
    107107printf("If no delta fields are defined, they will be computed automatically.\n"
    108108       "You can always delete existing delta values by using Joint::resetDelta().\n"
     
    112112j->resetDelta();
    113113j->getModel().close();
    114 printf("As you can see, Joint's delta fields have altered:\n\n%s\n", j->getModel().getF0Geno().getGene().c_str());
     114printf("As you can see, Joint's delta fields have altered:\n\n%s\n", j->getModel().getF0Geno().getGenes().c_str());
    115115}
    116116
     
    123123j->getModel().close();
    124124printf("f0 is now:\n\n%s\n...so this is %s joint.\n",
    125        j->getModel().getF0Geno().getGene().c_str(), option?"a delta":"an absolute");
     125       j->getModel().getF0Geno().getGenes().c_str(), option?"a delta":"an absolute");
    126126
    127127}
     
    155155CHANGE_ONE_PROPERTY(j->extraProperties());
    156156j->getModel().close();
    157 printf("And after that we have this genotype:\n\n%s\n", j->getModel().getF0Geno().getGene().c_str());
     157printf("And after that we have this genotype:\n\n%s\n", j->getModel().getF0Geno().getGenes().c_str());
    158158}
    159159
     
    250250n->getModel().close();
    251251printf("The final object description will be then: '%s'\nAnd the full f0 genotype:\n\n%s\n",
    252        n->getDetails().c_str(), n->getModel().getF0Geno().getGene().c_str());
     252       n->getDetails().c_str(), n->getModel().getF0Geno().getGenes().c_str());
    253253
    254254
     
    281281        }
    282282Geno g(gen);
    283 printf("\nSource genotype: '%s'\n",g.getGene().c_str());
     283printf("\nSource genotype: '%s'\n",g.getGenes().c_str());
    284284printf("                  ( format %c %s)\n",
    285285       g.getFormat(), g.getComment().c_str());
     
    292292        return 2;       
    293293        }
    294 printf("Converted to f0:\n%s\n",m.getF0Geno().getGene().c_str());
     294printf("Converted to f0:\n%s\n",m.getF0Geno().getGenes().c_str());
    295295
    296296printf("Model contains: %d part(s)\n"
  • cpp/frams/_demos/genooper_test.cpp

    r532 r534  
    99{
    1010        printf("Genotype: %s\nFormat: %c\nValid: %s\nComment: %s\n",
    11                 g.getGene().c_str(), g.getFormat(), g.isValid() ? "yes" : "no", g.getComment().len() == 0 ? "(empty)" : g.getComment().c_str());
     11                g.getGenes().c_str(), g.getFormat(), g.isValid() ? "yes" : "no", g.getComment().len() == 0 ? "(empty)" : g.getComment().c_str());
    1212}
    1313
     
    4747        printGenAndTitle(gvalidated, "validated");
    4848
    49         printf("\nHTMLized: %s\n", genetics.genman.HTMLize(gvalidated.getGene().c_str()).c_str());
     49        printf("\nHTMLized: %s\n", genetics.genman.HTMLize(gvalidated.getGenes().c_str()).c_str());
    5050
    5151        return 0;
  • cpp/frams/_demos/geometry/apices_test.cpp

    r526 r534  
    11// This file is a part of Framsticks SDK.  http://www.framsticks.com/
    2 // Copyright (C) 1999-2015  Maciej Komosinski and Szymon Ulatowski.
     2// Copyright (C) 1999-2016  Maciej Komosinski and Szymon Ulatowski.
    33// See LICENSE.txt for details.
    44
     
    4747        // Finishing result Model and printing its genotype.
    4848        resultModel.close();
    49         puts(resultModel.getF0Geno().getGeneAndFormat().c_str());
     49        puts(resultModel.getF0Geno().getGenesAndFormat().c_str());
    5050}
    5151
  • cpp/frams/_demos/geometry/info_test.cpp

    r526 r534  
    11// This file is a part of Framsticks SDK.  http://www.framsticks.com/
    2 // Copyright (C) 1999-2015  Maciej Komosinski and Szymon Ulatowski.
     2// Copyright (C) 1999-2016  Maciej Komosinski and Szymon Ulatowski.
    33// See LICENSE.txt for details.
    44
     
    7272        // Finishing result Model and printing its genotype.
    7373        resultModel.close();
    74         puts(resultModel.getF0Geno().getGeneAndFormat().c_str());
     74        puts(resultModel.getF0Geno().getGenesAndFormat().c_str());
    7575       
    7676        // Printing calculated values.
  • cpp/frams/_demos/geometry/surface_test.cpp

    r526 r534  
    11// This file is a part of Framsticks SDK.  http://www.framsticks.com/
    2 // Copyright (C) 1999-2015  Maciej Komosinski and Szymon Ulatowski.
     2// Copyright (C) 1999-2016  Maciej Komosinski and Szymon Ulatowski.
    33// See LICENSE.txt for details.
    44
     
    4747        // Finishing result Model and printing its genotype.
    4848        resultModel.close();
    49         puts(resultModel.getF0Geno().getGeneAndFormat().c_str());
     49        puts(resultModel.getF0Geno().getGenesAndFormat().c_str());
    5050}
    5151
  • cpp/frams/_demos/geometry/volume_test.cpp

    r526 r534  
    11// This file is a part of Framsticks SDK.  http://www.framsticks.com/
    2 // Copyright (C) 1999-2015  Maciej Komosinski and Szymon Ulatowski.
     2// Copyright (C) 1999-2016  Maciej Komosinski and Szymon Ulatowski.
    33// See LICENSE.txt for details.
    44
     
    3939        // Finishing result Model and printing its genotype.
    4040        resultModel.close();
    41         puts(resultModel.getF0Geno().getGeneAndFormat().c_str());
     41        puts(resultModel.getF0Geno().getGenesAndFormat().c_str());
    4242}
    4343
  • cpp/frams/_demos/multiline_f0_test.cpp

    r391 r534  
    2626        }
    2727Geno g(gen);
    28 printf("\nSource genotype: '%s'\n",g.getGene().c_str());
     28printf("\nSource genotype: '%s'\n",g.getGenes().c_str());
    2929printf("                  ( format %c %s)\n",
    3030       g.getFormat(), g.getComment().c_str());
     
    3737        return 2;       
    3838        }
    39 printf("Converted to f0:\n%s\n",m.getF0Geno().getGene().c_str());
     39printf("Converted to f0:\n%s\n",m.getF0Geno().getGenes().c_str());
    4040
    4141printf("\nusing Param::save() to create the \"expanded\" form of the f0 genotype...\n(MultiParamLoader should be able to load this)");
  • cpp/frams/_demos/part_shapes.cpp

    r526 r534  
    11// This file is a part of Framsticks SDK.  http://www.framsticks.com/
    2 // Copyright (C) 1999-2015  Maciej Komosinski and Szymon Ulatowski.
     2// Copyright (C) 1999-2016  Maciej Komosinski and Szymon Ulatowski.
    33// See LICENSE.txt for details.
    44
     
    5252
    5353        m.close();
    54         puts(m.getF0Geno().getGeneAndFormat().c_str());
     54        puts(m.getF0Geno().getGenesAndFormat().c_str());
    5555        // the genotype can be fed directly to the genotype viewer, like this:
    5656        // part_shapes | theater -g -
  • cpp/frams/_demos/shapeconvert.cpp

    r526 r534  
    11// This file is a part of Framsticks SDK.  http://www.framsticks.com/
    2 // Copyright (C) 1999-2015  Maciej Komosinski and Szymon Ulatowski.
     2// Copyright (C) 1999-2016  Maciej Komosinski and Szymon Ulatowski.
    33// See LICENSE.txt for details.
    44
     
    8787
    8888        Geno f0_g = newmodel.getF0Geno();
    89         puts(f0_g.getGeneAndFormat().c_str());
     89        puts(f0_g.getGenesAndFormat().c_str());
    9090
    9191        return 0;
  • cpp/frams/genetics/f1/conv_f1.cpp

    r528 r534  
    111111builder.model.close(); // model is ready to use now
    112112if (map) builder.model.getCurrentToF0Map(*map); // generate f1-to-f0 conversion map
    113 return builder.model.getF0Geno().getGene();
     113return builder.model.getF0Geno().getGenes();
    114114}
    115115
  • cpp/frams/genetics/f4/conv_f4.cpp

    r528 r534  
    3232                // generate to-f0 conversion map
    3333                model->getCurrentToF0Map(*map);
    34         SString out = model->getF0Geno().getGene();
     34        SString out = model->getF0Geno().getGenes();
    3535        delete model;
    3636        return out;
  • cpp/frams/genetics/f9/conv_f9.cpp

    r319 r534  
    5656        if (map != NULL)
    5757                m.getCurrentToF0Map(*map);
    58         return m.getF0Geno().getGene();
     58        return m.getF0Geno().getGenes();
    5959}
    6060
  • 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        {
  • cpp/frams/genetics/geno.cpp

    r530 r534  
    3232        name = genname;
    3333        txt = comment;
    34         setGeneAndFormat(genstring,genformat);
    35 }
    36 
    37 void Geno::setGeneAndFormat(const SString& genstring, char genformat)
     34        setGenesAndFormat(genstring,genformat);
     35}
     36
     37void Geno::setGenesAndFormat(const SString& genstring, char genformat)
    3838{
    3939        mapinshift = 0;
     
    151151}
    152152
    153 void Geno::setGeneOnly(const SString& g)
     153void Geno::setGenesAssumingSameFormat(const SString& g)
    154154{
    155155        gen = g;
     
    174174}
    175175
    176 SString Geno::getGeneAndFormat(void) const
     176SString Geno::getGenesAndFormat(void) const
    177177{
    178178        SString out;
     
    211211}
    212212
    213 SString Geno::getGene(void) const { return gen; }
     213SString Geno::getGenes(void) const { return gen; }
    214214SString Geno::getName(void) const { return name; }
    215215char Geno::getFormat(void) const { return format; }
  • cpp/frams/genetics/geno.h

    r530 r534  
    11// This file is a part of Framsticks SDK.  http://www.framsticks.com/
    2 // Copyright (C) 1999-2015  Maciej Komosinski and Szymon Ulatowski.
     2// Copyright (C) 1999-2016  Maciej Komosinski and Szymon Ulatowski.
    33// See LICENSE.txt for details.
    44
     
    8585
    8686        /// return string representation, with format comment at the beginning
    87         SString getGeneAndFormat(void) const;
     87        SString getGenesAndFormat(void) const;
    8888
    8989        void setString(const SString& genewithcomments);
    9090
    91         /** @param genformat=-1 -> take from genstring comment (like the constructor) else specify the valid format in genformat and pure gene in genstring */
    92         void setGeneAndFormat(const SString& genstring, char genformat=-1);
    93         /** g must be pure gene, without format. for the standard behavior use setGeneAndFormat() */
    94         void setGeneOnly(const SString& g);
    95         SString getGene(void) const;
     91        /** @param genformat=-1 -> detect genotype format from genstring comment (like the constructor does), else specify the valid format in genformat and pure genes in genstring. */
     92        void setGenesAndFormat(const SString& genstring, char genformat=-1);
     93        /** g must be pure genes, without format. For the standard behavior use setGenesAndFormat() */
     94        void setGenesAssumingSameFormat(const SString& g);
     95        SString getGenes(void) const;
    9696
    9797        SString getName(void) const;
  • cpp/frams/genetics/genoconv.cpp

    r483 r534  
    181181        char *t = path;
    182182        SString tmp;
    183         tmp = in.getGene();
     183        tmp = in.getGenes();
    184184        MultiMap lastmap, tmpmap;
    185185        int firstmap = 1;
  • cpp/frams/model/autoname.cpp

    r512 r534  
    5454SString AutoName::firstName(Model& model)
    5555{
    56         return firstName(model.getGeno().getGene());
     56        return firstName(model.getGeno().getGenes());
    5757}
    5858
  • cpp/frams/model/model.cpp

    r528 r534  
    308308                return;
    309309        }
    310         SString f0txt = f0geno.getGene();
     310        SString f0txt = f0geno.getGenes();
    311311        buildstatus = building; // was: open();
    312312        if (autobuildmaps)
  • cpp/frams/vm/classes/genoobj.cpp

    r526 r534  
    5353void GenoObj::get_genotype(ExtValue *ret)
    5454{
    55         ret->setString(getGene());
     55        ret->setString(getGenes());
    5656}
    5757
     
    8080void GenoObj::get_string(ExtValue *ret)
    8181{
    82         ret->setString(getGeneAndFormat());
     82        ret->setString(getGenesAndFormat());
    8383}
    8484
     
    9797void GenoObj::get_f0genotype(ExtValue *ret)
    9898{
    99         ret->setString(getConverted('0').getGene());
     99        ret->setString(getConverted('0').getGenes());
    100100}
    101101
     
    178178{
    179179        VectorObject *vec = new VectorObject;
    180         vec->data += new ExtValue(getGeneAndFormat());
     180        vec->data += new ExtValue(getGenesAndFormat());
    181181        vec->data += new ExtValue(getName());
    182182        vec->data += new ExtValue(getComment());
Note: See TracChangeset for help on using the changeset viewer.