[Avida-SVN] r2541 - branches/uml/source/main
hjg at myxo.css.msu.edu
hjg at myxo.css.msu.edu
Mon Apr 21 11:30:06 PDT 2008
Author: hjg
Date: 2008-04-21 14:30:06 -0400 (Mon, 21 Apr 2008)
New Revision: 2541
Modified:
branches/uml/source/main/cMDEProperty.cc
branches/uml/source/main/cUMLModel.cc
branches/uml/source/main/cUMLStateDiagram.cc
branches/uml/source/main/cUMLStateDiagram.h
Log:
Modified to support the use of transition labels.
Modified: branches/uml/source/main/cMDEProperty.cc
===================================================================
--- branches/uml/source/main/cMDEProperty.cc 2008-04-18 20:02:56 UTC (rev 2540)
+++ branches/uml/source/main/cMDEProperty.cc 2008-04-21 18:30:06 UTC (rev 2541)
@@ -1,3 +1,4 @@
+
/*
* cMDEProperty.cc
*
Modified: branches/uml/source/main/cUMLModel.cc
===================================================================
--- branches/uml/source/main/cUMLModel.cc 2008-04-18 20:02:56 UTC (rev 2540)
+++ branches/uml/source/main/cUMLModel.cc 2008-04-21 18:30:06 UTC (rev 2541)
@@ -167,6 +167,28 @@
}
infile >> temp;
}
+ } else if (line == "==TRIGGERS==") {
+ line.erase();
+ infile >> temp;
+ state_diagrams[cur_class].addTrigger("<null>", "<null>");
+ while (temp != "==END==") {
+ infile >> temp1 >> temp2;
+ if (temp=="1") {
+ state_diagrams[cur_class].addTrigger(temp1, temp2);
+ }
+ infile >> temp;
+ }
+ } else if (line == "==GUARDS==") {
+ line.erase();
+ infile >> temp;
+ state_diagrams[cur_class].addGuard("<null>");
+ while (temp != "==END==") {
+ infile >> temp2;
+ if (temp=="1") {
+ state_diagrams[cur_class].addGuard(temp2);
+ }
+ infile >> temp;
+ }
} else if (line == "==ACTIONS==") {
line.erase();
infile >> temp;
@@ -270,8 +292,8 @@
temp_size = c.numAttributes();
// add nulls.
- state_diagrams[i].addGuard("<null>");
- state_diagrams[i].addTrigger("<null>", "<null>");
+// state_diagrams[i].addGuard("<null>");
+// state_diagrams[i].addTrigger("<null>", "<null>");
// state_diagrams[i].addAction("<null>");
// For each attribute...
Modified: branches/uml/source/main/cUMLStateDiagram.cc
===================================================================
--- branches/uml/source/main/cUMLStateDiagram.cc 2008-04-18 20:02:56 UTC (rev 2540)
+++ branches/uml/source/main/cUMLStateDiagram.cc 2008-04-21 18:30:06 UTC (rev 2541)
@@ -590,4 +590,56 @@
}
+void cUMLStateDiagram::printStateDiagram()
+{
+ std::string temp, temp1, temp2, temp3;
+ std::string trig_label, trig_op_name;
+
+ boost::graph_traits<state_diagram>::edge_iterator edge_start, edge_end;
+ boost::graph_traits<state_diagram>::edge_descriptor ed;
+
+ int s_count = 0;
+ int t_count = 0;
+
+ // This state is the initial state; thus it should be printed regardless of whether it has an incoming
+ // edge or not.
+
+ std::cout << "States: \n\n";
+ for (; s_count < numStates(); ++s_count) {
+ temp = "s" + StringifyAnInt(s_count);
+ std::cout << "State: ";
+ std::cout << temp << std::endl;
+ }
+
+
+ std::vector<trigger_info>::iterator trig_it;
+ int count = 0;
+ for (trig_it = triggers.begin(); trig_it < triggers.end(); trig_it++) {
+ std::cout << "trigger " << count << " " << (*trig_it).operation_id << std::endl;
+ count++;
+ }
+
+ std::vector<std::string>::iterator act_it;
+ count = 0;
+ for (act_it = guards.begin(); act_it < guards.end(); act_it++) {
+ std::cout << "guard " << count << " " << (*act_it) << std::endl;
+ count++;
+ }
+
+ count = 0;
+ for (act_it = actions.begin(); act_it < actions.end(); act_it++) {
+ std::cout << "action " << count << " " << (*act_it) << std::endl;
+ count++;
+ }
+
+ count = 0;
+ std::vector<transition_properties>::iterator tl_it;
+ for (tl_it = transition_labels.begin(); tl_it < transition_labels.end(); tl_it++) {
+ std::cout << triggers[(*tl_it)._tr].operation_id << " " << guards[(*tl_it)._gu];
+ std::cout << " " << actions[(*tl_it)._act] << std::endl;
+ }
+
+
+ return;
+}
\ No newline at end of file
Modified: branches/uml/source/main/cUMLStateDiagram.h
===================================================================
--- branches/uml/source/main/cUMLStateDiagram.h 2008-04-18 20:02:56 UTC (rev 2540)
+++ branches/uml/source/main/cUMLStateDiagram.h 2008-04-21 18:30:06 UTC (rev 2541)
@@ -117,6 +117,9 @@
bool addGuard(std::string);
bool addAction(std::string);
bool addTransitionLabel(int, int, int);
+
+ // print
+ void printStateDiagram();
protected:
More information about the Avida-cvs
mailing list