#include "UmlActivityNode.h"
#include "FlowContainer.h"
#include "UmlActivity.h"
#include "UmlActivityObject.h"
#include "UmlFlow.h"
#include "FileOut.h"
void UmlFlow::write(FileOut & out) {
out.indent();
out << "\n";
UmlItem * gp = parent()->parent();
FlowContainer * fc = dynamic_cast(gp);
if (fc == 0)
// pin
fc = dynamic_cast(gp->parent());
fc->memo_flow(this);
}
void UmlFlow::memo_incoming_flow() {
target()->add_incoming_flow(this);
}
void UmlFlow::write_it(FileOut & out) {
const char * k;
switch (parent()->parent()->kind()) {
case anActivity:
k = "edge";
break;
case anInterruptibleActivityRegion:
k = (stereotype() == "interrupt")
? "interruptingEdge" : "containedEdge";
break;
default:
// anExpansionRegion
k = "containedEdge";
}
out.indent();
out << '<' << k
<< ((is_control_flow()) ? " xmi:type=\"uml:ControlFlow\""
: " xmi:type=\"uml:ObjectFlow\"");
out.id(this);
if (!name().isEmpty() && (name() != "")) {
out << " name=\"";
out.quote(name());
out << '"';
}
out.ref(parent(), "source");
out.ref(target(), "target");
QCString w;
QCString g;
QCString s;
QCString t;
switch (_lang) {
case Uml:
w = weight();
g = guard();
s = selection();
t = transformation();
break;
case Cpp:
w = cppWeight();
g = cppGuard();
s = cppSelection();
t = cppTransformation();
break;
default:
// java
w = javaWeight();
g = javaGuard();
s = javaSelection();
t = javaTransformation();
}
write_selection(out, s);
if (! t.isEmpty())
out.ref(activity()->add_opaque_behavior(t), "transformation", "OPAQUE_BEHAVIOR_");
out << ">\n";
out.indent(+1);
write_description_properties(out);
if (! w.isEmpty()) {
out.indent();
out << "\n";
}
if (! g.isEmpty()) {
out.indent();
out << "\n";
out.indent();
out << "\t";
out.quote(g);
out << "\n";
out.indent();
out << "\n";
}
out.indent(-1);
out.indent();
out << "" << k << ">\n";
unload();
}
bool UmlFlow::is_control_flow() {
UmlActivityObject * o = dynamic_cast(parent());
return ((o == 0) || o->isControlType());
}