コード例 #1
0
void UmlAcceptEventAction::write(FileOut & out) {
  write_begin(out, "AcceptEventAction");
  
  if (isUnmarshall())
    out << " isUnmarshall=\"true\"";
  
  Q3CString trig;
  
  switch (_lang) {
  case Uml:
    trig = trigger();
    break;
  case Cpp:
    trig = cppTrigger();
    break;
  default:
    // java
    trig = javaTrigger();
  }

  if (! trig.isEmpty()) {
    out.ref(this, "trigger", "TRIGGER_");
    write_end(out);
    
    out.indent();
    out << "<trigger xmi:type=\"uml:Trigger\"";
    out.id_prefix(this, "TRIGGER_");
    out << " name=\"";
    out.quote(trig);
    out << "\"/>\n";
  }
  else
    write_end(out);

}
コード例 #2
0
ファイル: UmlTransition.cpp プロジェクト: gregsmirnov/bouml
void UmlTransition::generate(UmlClass * machine, UmlClass * anystate, UmlState * state, QCString & body, QCString indent) {
  if (!cppTrigger().isEmpty()) {
    UmlCom::trace("Error : transition from a pseudo state can't have trigger<br>");
    throw 0;
  }

  QList<UmlTransition> l;
  
  l.append(this);
  generate(l, machine, anystate, state, body, indent, FALSE);
}
コード例 #3
0
ファイル: UmlTransition.cpp プロジェクト: bleakxanadu/douml
Q3CString UmlTransition::triggerName()
{
    // get & check trigger's name
    Q3CString s = cppTrigger();

    if (s.isEmpty()) {
        switch (parent()->kind()) {
        case anInitialPseudoState:
#ifndef WIN32
#warning to check
#endif
        case anEntryPointPseudoState:
            s = "create";
            break;

        case aState:
            s = "_completion";
            break;

        case anExitPointPseudoState:
            // note : not managed as a 'standard' completion
            // see UmlExitPointPseudoState class
            break;

        default:
#ifndef WIN32
#warning to check
#endif
            UmlCom::trace("Error : transition must have a trigger<br>");
            throw 0;
        }
    }
    else if ((parent()->kind() == anInitialPseudoState) ||
#ifndef WIN32
#warning to check
#endif
             (parent()->kind() == anEntryPointPseudoState)) {
        if (s != "create") {
            UmlCom::trace("Error : the transition from an 'initial' or 'entry point' pseudo state may only have the trigger 'create'<br>");
            throw 0;
        }
    }
    else if (s == "create") {
        UmlCom::trace("Error : only the transition from an 'initial' or 'entry point' pseudo state may have the trigger 'create'<br>");
        throw 0;
    }
    else if (s[0] == '_') {
        UmlCom::trace("Error : sorry, trigger's name can't start by a '_'<br>");
        throw 0;
    }

    return s;
}
コード例 #4
0
ファイル: UmlTransition.cpp プロジェクト: 02JanDal/douml
void UmlTransition::write_it(FileOut & out)
{
    out.indent();
    out << "<transition xmi:type=\"uml:Transition\"";
    out.id(this);

    if (!name().isEmpty() && (name() != "<transition>")) {
        out << " name=\"";
        out.quote(name());
        out << '"';
    }

    out.ref(parent(), "source");
    out.ref(target(), "target");

    if (parent() == target())
        out << " kind=\"" << ((isExternal()) ? "external" : "internal") << '"';

    out << ">\n";
    out.indent(+1);
    write_description_properties(out);

    WrapperStr trig;
    WrapperStr grd;
    WrapperStr effect;

    switch (_lang) {
    case Uml:
        trig = trigger();
        grd = guard();
        effect = activity();
        break;

    case Cpp:
        trig = cppTrigger();
        grd = cppGuard();
        effect = cppActivity();
        break;

    default: // Java
        trig = javaTrigger();
        grd = javaGuard();
        effect = javaActivity();
        break;
    }

    if (! trig.isEmpty()) {
        out.indent();
        out << "<trigger xmi:type=\"uml:Trigger\"";
        out.id_prefix(this, "TRIGGER_");
        out << " name=\"";
        out.quote(trig);
        out << "\"/>\n";
    }

    if (! grd.isEmpty()) {
        out.indent();
        out << "<guard xmi:type=\"uml:Constraint\"";
        out.id_prefix(this, "GUARD_");
        out << ">\n";
        out.indent();
        out << "\t<specification xmi:type=\"uml:OpaqueExpression\"";
        out.id_prefix(this, "GUARD_EXPR_");
        out << ">\n";
        out.indent();
        out << "\t\t<body>";
        out.quote(grd);
        out << "</body>\n";
        out.indent();
        out << "\t</specification>\n";
        out.indent();
        out << "</guard>\n";
    }

    if (! effect.isEmpty()) {
        out.indent();
        out << "<effect xmi:type=\"uml:Activity\"";
        out.id_prefix(this, "EFFECT_");
        out << ">\n";
        out.indent();
        out << "\t<body>";
        out.quote(effect);
        out << "</body>\n";
        out.indent();
        out << "</effect>\n";
    }

    out.indent(-1);
    out.indent();
    out << "</transition>\n";

    unload();
}