/*! Returns a deep-copied clone of the QUmlProtocolTransition. */ QModelingElement *QUmlProtocolTransition::clone() const { QUmlProtocolTransition *c = new QUmlProtocolTransition; c->asQModelingObject()->setObjectName(this->asQModelingObject()->objectName()); c->asQModelingObject()->setProperty("role", this->asQModelingObject()->property("role")); foreach (QUmlComment *element, ownedComments()) c->addOwnedComment(dynamic_cast<QUmlComment *>(element->clone())); c->setName(name()); if (nameExpression()) c->setNameExpression(dynamic_cast<QUmlStringExpression *>(nameExpression()->clone())); c->setVisibility(visibility()); c->setLeaf(isLeaf()); foreach (QUmlElementImport *element, elementImports()) c->addElementImport(dynamic_cast<QUmlElementImport *>(element->clone())); foreach (QUmlConstraint *element, ownedRules()) c->addOwnedRule(dynamic_cast<QUmlConstraint *>(element->clone())); foreach (QUmlPackageImport *element, packageImports()) c->addPackageImport(dynamic_cast<QUmlPackageImport *>(element->clone())); if (effect()) c->setEffect(dynamic_cast<QUmlBehavior *>(effect()->clone())); if (guard()) c->setGuard(dynamic_cast<QUmlConstraint *>(guard()->clone())); c->setKind(kind()); foreach (QUmlTrigger *element, triggers()) c->addTrigger(dynamic_cast<QUmlTrigger *>(element->clone())); if (postCondition()) c->setPostCondition(dynamic_cast<QUmlConstraint *>(postCondition()->clone())); if (preCondition()) c->setPreCondition(dynamic_cast<QUmlConstraint *>(preCondition()->clone())); return c; }
int main(int argc, char* argv[]) { int ret = 0; sqlite3* phandle = NULL; /* 前置条件 */ ret = preCondition(&phandle); if (ret != SQLITE_OK) { fprintf(stderr, "pre-condition failure, return code = %d\n", ret); return EXIT_FAILURE; } /* 备份动作 */ ret = backupAction(phandle); if (ret != SQLITE_OK) { fprintf(stderr, "backup action failure, return code = %d\n", ret); return EXIT_FAILURE; } show(); /* 后置条件 */ ret = postCondition(phandle); if (ret != SQLITE_OK) { fprintf(stderr, "post condition failure, return code = %d\n", ret); return EXIT_FAILURE; } return EXIT_SUCCESS; }
void UmlActivityAction::write_end(FileOut & out, bool dontclose) { out << ">\n"; out.indent(+1); Q3CString s = constraint(); if (! s.isEmpty()) { out.indent(); out << "<ownedRule xmi:type=\"uml:Constraint\""; out.id_prefix(this, "CONSTRAINT_"); out.ref(this, "constrainedElement"); out << ">\n"; out.indent(); out << "\t<specification xmi:type=\"uml:OpaqueExpression\""; out.id_prefix(this, "CSPEC_"); out << ">\n"; out.indent(); out << "\t\t<body>"; out.quote(s); out << "</body>\n"; out.indent(); out << "\t</specification>\n"; out.indent(); out << "</ownedRule>\n"; } write_description_properties(out); switch (_lang) { case Uml: write_condition(out, preCondition(), TRUE); write_condition(out, postCondition(), FALSE); break; case Cpp: write_condition(out, cppPreCondition(), TRUE); write_condition(out, cppPostCondition(), FALSE); break; default: // java write_condition(out, javaPreCondition(), TRUE); write_condition(out, javaPostCondition(), FALSE); } const Q3PtrVector<UmlItem> ch = children(); unsigned n = ch.size(); for (unsigned i = 0; i != n; i += 1) ch[i]->write(out); write_incoming_flows(out); if (!dontclose) write_close(out); }
float Human_Guard_Wander::postCondition() { return 1.0f - preCondition(); }
float Human_Guard_MoveToTarget::postCondition() { return 1.0f - preCondition(); }
float Human_Guard_Fight::postCondition() { return 1.0f - preCondition(); }
float Human_Guard_Called_Disappear::postCondition() { return 1.0f - preCondition(); }
float Human_Guard_Called_TeleToTarget::postCondition() { return 1.0f - preCondition(); }