[Avida-SVN] r1391 - branches/uml/source/main
hjg at myxo.css.msu.edu
hjg at myxo.css.msu.edu
Tue Mar 6 09:54:20 PST 2007
Author: hjg
Date: 2007-03-06 12:54:20 -0500 (Tue, 06 Mar 2007)
New Revision: 1391
Modified:
branches/uml/source/main/cOrganism.cc
branches/uml/source/main/cOrganism.h
branches/uml/source/main/cTaskLib.cc
Log:
Tasks check for the generation of a specific diagram including transition labels.
Modified: branches/uml/source/main/cOrganism.cc
===================================================================
--- branches/uml/source/main/cOrganism.cc 2007-03-05 20:35:00 UTC (rev 1390)
+++ branches/uml/source/main/cOrganism.cc 2007-03-06 17:54:20 UTC (rev 1391)
@@ -529,6 +529,21 @@
}
+bool cOrganism::findTrans(int orig, int dest, std::string label)
+{
+ std::string t_lab;
+ for(std::vector<transition>::iterator i=transitions.begin(); i!=transitions.end(); ++i){
+ if((i->orig_state == orig) && (i->dest_state == dest)) {
+ t_lab = (i->trans.trigger + i->trans.guard + i->trans.action);
+ if (t_lab == label) {
+ return true;
+ }
+ }
+ }
+
+ return false;
+}
+
// For all of the next* functions
// increment the index. If the index points to the end of the vector, it should then point to
// the beginning of the vector.
Modified: branches/uml/source/main/cOrganism.h
===================================================================
--- branches/uml/source/main/cOrganism.h 2007-03-05 20:35:00 UTC (rev 1390)
+++ branches/uml/source/main/cOrganism.h 2007-03-06 17:54:20 UTC (rev 1391)
@@ -236,6 +236,7 @@
void modelCheck(cAvidaContext& ctx); // evaluate the model
void printXMI(cAvidaContext& ctx); // print the XMI version of the model
bool findTrans(int, int); // find a transition between two states
+ bool findTrans(int, int, std::string); // find a transition between two states with a specific label.
int numStates();
int numTrans();
Modified: branches/uml/source/main/cTaskLib.cc
===================================================================
--- branches/uml/source/main/cTaskLib.cc 2007-03-05 20:35:00 UTC (rev 1390)
+++ branches/uml/source/main/cTaskLib.cc 2007-03-06 17:54:20 UTC (rev 1391)
@@ -1854,7 +1854,7 @@
double cTaskLib::Task_Trans1(cTaskContext* ctx) const
{
- if (ctx->organism->findTrans(1,2)) return 1.0;
+ if (ctx->organism->findTrans(1,2, "tagaaa")) return 1.0;
return 0.0;
// check for a transition between 2 states
@@ -1863,25 +1863,25 @@
double cTaskLib::Task_Trans2(cTaskContext* ctx) const
{
- return ctx->organism->findTrans(2,3);
+ return ctx->organism->findTrans(2,3, "tagdab");
}
double cTaskLib::Task_Trans3(cTaskContext* ctx) const
{
- return ctx->organism->findTrans(3,4);
+ return ctx->organism->findTrans(3,4, "tcgbac");
}
double cTaskLib::Task_Trans4(cTaskContext* ctx) const
{
- return ctx->organism->findTrans(0,1);
+ return ctx->organism->findTrans(0,1, "tbgcad");
}
double cTaskLib::Task_Trans5(cTaskContext* ctx) const
{
- return ctx->organism->findTrans(4,0);
+ return ctx->organism->findTrans(4,0, "tdgaac");
}
More information about the Avida-cvs
mailing list