Esempio n. 1
0
void UmlActivityAction::write_condition(FileOut & out, Q3CString cond, bool pre) {
  if (! cond.isEmpty()) {
    const char * k;
    const char * K;
    const char * body;
    
    if (pre) {
      k = "pre";
      K = "PRE_";
      body = "PRE_BODY_";
    }
    else {
      k = "post";
      K = "POST_";
      body = "POST_BODY_";
    }
    
    out.indent();
    out << '<' << k << "condition xmi:type=\"uml:Constraint\"";
    out.id_prefix(this, K);
    out << ">\n";
    out.indent();
    out << "\t<specification xmi:type=\"uml:OpaqueExpression\"";
    out.id_prefix(this, body);
    out << " body=\"";
    out.quote(cond);
    out << "\"/>\n";
    out.indent();
    out << "</" << k << "condition>\n";
  }
}
Esempio n. 2
0
void UmlFormalParameter::write(FileOut & out, UmlClass * cl, int rank, bool uml20) const {
  out.indent();
  out << "<parameter";
  out.idref_prefix(cl, "TEMPLPARAM", rank);
  out << "/>\n";
  out.indent();
  out << "<ownedParameter xmi:type=\"uml:ClassifierTemplateParameter\"";
  out.id_prefix(cl, "TEMPLPARAM", rank);
  out << ">\n";
  out.indent(+1);

  out.indent();
  if (uml20)
    out << "<ownedElement xmi:type=\"uml:Class\"";
  else
    out << "<ownedParameteredElement xmi:type=\"uml:Class\"";
  out.id_prefix(cl, "TEMPLELEM", rank);
  out << " name=\"";
  out.quote(name());
  out << '"';
  out.ref(cl, "templateParameter", "TEMPLPARAM", rank);
  out << "/>\n";

  if (defaultValue().type != 0)
    UmlItem::write_default_value(out, defaultValue().type->name(), cl, rank);
  else
    UmlItem::write_default_value(out, defaultValue().explicit_type, cl, rank);

  out.indent(-1);
  out.indent();
  out << "</ownedParameter>\n";
}
Esempio n. 3
0
void UmlRelation::write_extension(FileOut & out) {
  if ((side(TRUE) == this) && 
      (parent()->stereotype() == "stereotype") &&
      (roleType()->stereotype() == "metaclass")) {
    const char * k = (_uml_20) ? "ownedMember" : "packagedElement";
    
    out.indent();
    out << "<" << k << " xmi:type=\"uml:Extension\" name=\"A_";
    out.quote((const char*)roleType()->name());//[jasa] ambiguous call
    out  << '_';
    out.quote((const char*)parent()->name());//[jasa] ambiguous call
    out << '"';
    out.id_prefix(this, "EXT_");
    out.ref(this, "memberEnd", "BASE_");
    out << ">\n";
    out.indent();
    out << "\t<ownedEnd xmi:type=\"uml:ExtensionEnd\" name=\"extension_";
    out.quote((const char*)parent()->name());//[jasa] ambiguous call
    out << '"';
    out.id_prefix(this, "EXTEND_");
    out.ref(this, "type");
    out << " aggregation=\"composite\"/>\n";
    out.indent();
    out << "</" << k << ">\n";
  }

  unload();
}
Esempio n. 4
0
void UmlItem::write_multiplicity(FileOut & out, WrapperStr s, UmlItem * who)
{
    if (!s.isEmpty()) {
        WrapperStr min;
        WrapperStr max;
        int index = s.find("..");

        if (index != -1) {
            min = s.left(index).stripWhiteSpace();
            max = s.mid(index + 2).stripWhiteSpace();
        }
        else
            min = max = s.stripWhiteSpace();

        out.indent();
        out << "<lowerValue xmi:type=\"uml:LiteralString\"";
        out.id_prefix(who, "MULTIPLICITY_L_");
        out << " value=\"" << min.operator QString() << "\"/>\n";

        out.indent();
        out << "<upperValue xmi:type=\"uml:LiteralString\"";
        out.id_prefix(who, "MULTIPLICITY_U_");
        out << " value=\"" << max.operator QString() << "\"/>\n";
    }
}
Esempio n. 5
0
void UmlOperation::write_events(FileOut & out)
{
    const char * k = (_uml_20) ? "ownedMember" : "packagedElement";
    UmlItem * prj = UmlPackage::getProject();
    Q3PtrDictIterator<char> it_oper(SentReceived);

    while (it_oper.current()) {
        out.indent();
        out << "<" << k << " xmi:type=\"uml:SendOperationEvent\"";
        out.id_prefix(prj, "SENDOPEREVT", (int)((long) it_oper.current()));
        out << " name=\"";
        out.quote((const char *)((UmlOperation *)it_oper.currentKey())->name()); //[jasa] ambiguous call
        out << '"';
        out.ref((UmlOperation *)it_oper.currentKey(), "operation");
        out << "/>\n";

        out.indent();
        out << "<" << k << " xmi:type=\"uml:ReceiveOperationEvent\"";
        out.id_prefix(prj, "RECOPEREVT", (int)((long) it_oper.current()));
        out << " name=\"";
        out.quote((const char *)((UmlOperation *)it_oper.currentKey())->name()); //[jasa] ambiguous call
        out << '"';
        out.ref((UmlOperation *)it_oper.currentKey(), "operation");
        out << "/>\n";

        ++it_oper;
    }

    Q3AsciiDictIterator<char> it_evt(Events);

    while (it_evt.current()) {
        out.indent();

        if (it_evt.currentKey()[0] == 'D') {
            out << "<" << k << " xmi:type=\"uml:DestructionEvent\"";
            out.id_prefix(prj, it_evt.current());
            out << "/>\n";
        }
        else {
            out << "<" << k << " xmi:type=\"uml:ExecutionEvent\"";
            out.id_prefix(prj, it_evt.current());

            if (*it_evt.currentKey() != 0) {
                out << " name=\"";
                out.quote(it_evt.currentKey() + 1);
                out << "\"/>\n";
            }
            else
                out << "/>\n";
        }

        free(it_evt.current());
        ++it_evt;
    }
}
Esempio n. 6
0
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);
}
Esempio n. 7
0
void UmlClass::write_formals(FileOut & out) {
  QValueList<UmlFormalParameter> formal_params = formals();
    
  if (!formal_params.isEmpty()) {
    out.indent();
    out << "<ownedTemplateSignature xmi:type=\"uml:";
    if (!_uml_20)
      out << "Redefinable";
    out << "TemplateSignature\"";
    out.id_prefix(this, "FORMALS_");
    out << ">\n";
    out.indent(+1);

    int rank;
    QValueList<UmlFormalParameter>::ConstIterator iter;

    for (iter = formal_params.begin(), rank = 0;
	 iter != formal_params.end();
	 ++iter, rank += 1)
      (*iter).write(out, this, rank, _uml_20);

    out.indent(-1);
    out.indent();
    out << "</ownedTemplateSignature>\n";
  }
}
Esempio n. 8
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);

}
Esempio n. 9
0
void UmlReplyAction::write(FileOut & out) {
  write_begin(out, "ReplyAction");
  
  Q3CString trig;
  
  switch (_lang) {
  case Uml:
    trig = replyToCall();
    break;
  case Cpp:
    trig = cppReplyToCall();
    break;
  default:
    // java
    trig = javaReplyToCall();
  }

  if (! trig.isEmpty()) {
    out.ref(this, "replyToCall", "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);
}
Esempio n. 10
0
void UmlRelation::write_relation(FileOut & out) {
  // note : it is the first side
 
  if (_assoc_class != 0)
    // generated in the association class
    return;
    
  const char * k = (_uml_20) ? "ownedElement" : "packagedElement";

  out.indent();
  out << '<' << k << " xmi:type=\"uml:Association\"";
  out.id_prefix(this, "ASSOC_");
  
  Q3CString s = name();
  int i1 = s.find("(");
  int i2 = s.findRev(")");
  
  if ((i1 != -1) && (i2 != -1) && (i2 > i1) && (s[i1+1] != '<')  && (s[i2-1] != '>')) {
    s = s.mid(i1 + 1, i2 - i1 - 1);
    
    if (!s.isEmpty()) {
      out << " name=\"";
      out.quote((const char*)s);//[jasa] ambiguous call
      out << '"';
    }
  }
  write_visibility(out);
  out << ">\n";
  
  write_ends(out);
  
  out.indent();
  out << "</" << k << ">\n";

}
Esempio n. 11
0
void UmlItem::write_stereotyped(FileOut & out)
{
    QMap<QString, Q3PtrList<UmlItem> >::Iterator it;

    for (it = _stereotypes.begin(); it != _stereotypes.end(); ++it) {
        const char * st = it.key();
        UmlClass * cl = UmlClass::findStereotype(it.key(), TRUE);

        if (cl != 0) {
            Q3ValueList<WrapperStr> extended;

            cl->get_extended(extended);

            Q3PtrList<UmlItem> & l = it.data();
            UmlItem * elt;

            for (elt = l.first(); elt != 0; elt = l.next()) {
                out << "\t<" << st;
                out.id_prefix(elt, "STELT_");

                const Q3Dict<WrapperStr> props = elt->properties();
                Q3DictIterator<WrapperStr> itp(props);

                while (itp.current()) {
                    QString k = itp.currentKey();

                    if (k.contains(':') == 2) {
                        out << " ";
                        out.quote((const char *)k.mid(k.findRev(':') + 1)); //[jasa] ambiguous call
                        out << "=\"";
                        out.quote((const char *)*itp.current());
                        out << '"';
                    }

                    ++itp;
                }

                Q3ValueList<WrapperStr>::Iterator iter_extended;

                for (iter_extended = extended.begin();
                        iter_extended != extended.end();
                        ++iter_extended) {
                    WrapperStr vr = "base_" + *iter_extended;

                    out.ref(elt, vr);
                }

                out << "/>\n";

                elt->unload();
            }
        }
    }

}
Esempio n. 12
0
void UmlItem::write_default_value(FileOut & out, Q3CString v, UmlItem * who, int rank)
{
  if (! v.isEmpty()) {
    if (v[0] == '=') {
      v = v.mid(1);
      if (v.isEmpty())
	return;
    }

    out.indent();
    out << "<defaultValue xmi:type=\"uml:LiteralString\"";
    if (rank == -1)
      out.id_prefix(who, "VALUE_");
    else
      out.id_prefix(who, "VALUE", rank);
    out << " value=\"";
    out.quote((const char*)v);//[jasa] ambiguous call
    out << "\"/>\n";
  }
}
Esempio n. 13
0
void UmlActivityParameter::write(FileOut & out) {
  // write parameter def

  out.indent();
  out << "<ownedParameter name=\"";
  out.quote(name());
  out << '"';
  out.id(this);
  write_dir(out);
  write_effect(out);
  write_flags(out);
  out << ">\n";
  
  out.indent(+1);
  
  write_description_properties(out);
  write_multiplicity(out, multiplicity(), this);
  write_default_value(out, defaultValue(), this);
  UmlItem::write_type(out, type());
  
  out.indent(-1);

  out.indent();
  out << "</ownedParameter>\n";

  //write parameter node
  out.indent();
  out << "<node xmi:type=\"uml:ActivityParameterNode\" name =\"";
  out.quote(name());
  out << '"';
  out.id_prefix(this, "PARAMETER_NODE_");
  if (isControlType())
    out << " isControlType=\"true\"";
  write_ordering(out);
  write_selection(out);
  write_in_state(out);
  out << ">\n";
  out.indent(+1);

  UmlItem::write_type(out, type());

  const Q3PtrVector<UmlItem> ch = children();
  unsigned n = ch.size();
  
  for (unsigned i = 0; i != n; i += 1)
    ch[i]->write(out);

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

  unload();
}
Esempio n. 14
0
void UmlRelation::write_ends(FileOut & out) {
  // note : it is the first side
 
  out.indent();
  out << "\t<memberEnd";
  out.idref(this);
  out << "/>\n";
  
  UmlRelation * other = side(FALSE);
  
  out.indent();
  if (other != 0) {
    out << "\t<memberEnd";
    out.idref(other);
    out << "/>\n";
  }
  else {
    out << "\t<ownedEnd xmi:type=\"uml:Property\"";
    out.id_prefix(this, "REVERSE_");
    if (_assoc_class != 0)
      out.ref(_assoc_class, "association");
    else
      out.ref(this, "association", "ASSOC_");
    out << " visibility=\"" << ((_vis_prefix) ? "vis_private\"" : "private\"");
    out.ref(parent(), "type");
    out << " aggregation=\"";
    if (_gen_eclipse)
      out << "none";
    else {
      switch (relationKind()) {
      case anAggregation:
      case aDirectionalAggregation:
	out << "shared";
	break;
      case anAggregationByValue:
      case aDirectionalAggregationByValue:
	out << "composite";
	break;
      default:
	out << "none";
      }
    }
    out << "\" isNavigable=\"false\"/>\n";

    out.indent();
    out << "\t<memberEnd ";
    out.idref_prefix(this, "REVERSE_");
    out << "/>\n";
  }

}
Esempio n. 15
0
void UmlArtifact::write_manifest(FileOut & out, UmlItem * x, const char * name, unsigned rank)
{
    out.indent();
    out << "<manifestation xmi:type=\"uml:Manifestation\"";
    out.id_prefix(this, "MANIFESTATION", rank);
    out.ref(this, "client");
    out.ref(x, "supplier");
    out.ref(x, "utilizedElement");

    if (name != 0)
        out << " name=\"" << name << '"';

    out << "/>\n";
}
Esempio n. 16
0
void UmlClass::write_actuals(FileOut & out)
{
    Q3ValueList<UmlActualParameter> actual_params = actuals();
    Q3ValueList<UmlActualParameter>::ConstIterator iter;
    int rank;
    UmlClass * super = 0;

    for (iter = actual_params.begin(), rank = 0;
         iter != actual_params.end();
         ++iter, rank += 1) {
        if (super != (*iter).superClass()) {
            if (super != 0) {
                out.indent(-1);
                out.indent();
                out << "</templateBinding>\n";
            }

            super = (*iter).superClass();

            out.indent();
            out << "<templateBinding xmi:type=\"uml:TemplateBinding\"";
            out.id_prefix(this, "ACTUAL", rank);
            out << ">\n";
            out.indent(+1);

            out.indent();
            out << "<boundElement";
            out.idref(this);
            out << " />\n";

            out.indent();
            out << "<signature";
            out.idref_prefix(super, "FORMALS_");
            out << " />\n";
        }

        (*iter).write(out, this, rank);
    }

    if (super != 0) {
        out.indent(-1);
        out.indent();
        out << "</templateBinding>\n";
    }

}
Esempio n. 17
0
void UmlOnSignalAction::write_signal(FileOut & out) {
  Q3CString sig;
  
  switch (_lang) {
  case Uml:
    sig = signal();
    break;
  case Cpp:
    sig = cppSignal();
    break;
  default:
    // java
    sig = javaSignal();
  }

  if (! sig.isEmpty()) {
    out.indent();
    out << "<signal xmi:type=\"uml:Signal\"";
    out.id_prefix(this, "SIGNAL_");
    out << " name=\"";
    out.quote(sig);
    out << "\"/>\n";
  }
}
Esempio n. 18
0
void UmlFragment::write(FileOut & out, UmlItem * diagram, Q3PtrList<UmlSequenceMessage> & msgs)
{
    WrapperStr oper = name();

    if (oper == "ref")
        write_ref(out, diagram, msgs);
    else {
        if ((oper != "alt") &&
            (oper != "opt") &&
            (oper != "loop") &&
            (oper != "break") &&
            (oper != "par") &&
            (oper != "seq") &&
            (oper != "strict") &&
            (oper != "neg") &&
            (oper != "critical") &&
            (oper != "assert") &&
            (oper != "ignore") &&
            (oper != "consider"))
            oper = "";
        else {
            static int rank = 0;

            out.indent();
            out << "<fragment xmi:type=\"uml:CombinedFragment\"";
            out.id_prefix(diagram, "COMBINEDFRAGMENT", ++rank);

            if (! covered.isEmpty()) {
                out << " covered=\"";

                UmlClassInstanceReference * lifeline = covered.first();

                for (;;) {
                    out.ref_only(diagram, lifeline->lifeline());
                    lifeline = covered.next();

                    if (lifeline == 0)
                        break;

                    out << " ";
                }

                out << '"';
            }

            out << " interactionOperator=\"" << oper.operator QString() << "\">\n";
            out.indent(+1);
        }

        const Q3PtrVector<UmlFragmentCompartment> & subs = compartments();
        unsigned n = subs.size();

        for (unsigned i = 0; i != n; i += 1)
            subs.at(i)->write(out, diagram, msgs, oper);

        if (!oper.isEmpty()) {
            out.indent(-1);
            out.indent();
            out << "</fragment>\n";
        }
    }
}
Esempio n. 19
0
void UmlComponent::write(FileOut & out)
{
    const char * k = (parent()->kind() == anUseCase)
                     ? "ownedUseCase"
                     : ((_uml_20) ? "ownedMember" : "packagedElement");

    out.indent();
    out << "<" << k << " xmi:type=\"uml:Component\"";
    out.id(this);
    out << " name=\"";
    out.quote((const char *)name()); //[jasa] ambiguous call
    out << "\">\n";
    out.indent(+1);
    write_description_properties(out);

    const QVector<UmlItem*> ch = children();
    unsigned n = ch.size();
    unsigned index;

    for (index = 0; index != n; index += 1)
        ch[index]->write(out);

    // provided

    const QVector< UmlClass* > & prov = providedClasses();

    n = prov.size();

    for (index = 0; index != n; index += 1) {
        UmlClass * cl = prov[index];

        out.indent();
        out << "<interfaceRealization xmi:type=\"uml:InterfaceRealization\"";
        out.id_prefix(this, "PROV_", index);
        out.ref(cl, "supplier");
        out.ref(this, "client");
        out.ref(cl, "contract");
        out << "/>\n";
    }

    // realizing

    const QVector< UmlClass* > & rea = realizingClasses();

    n = rea.size();

    for (index = 0; index != n; index += 1) {
        UmlClass * cl = rea[index];

        out.indent();
        out << "<realization xmi:type=\"uml:ComponentRealization\"";
        out.id_prefix(this, "REA_", index);
        out.ref(cl, "supplier");
        out.ref(this, "client");
        out.ref(cl, "realizingClassifier");
        out << "/>\n";
    }

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

    // required

    const QVector< UmlClass* > & req = requiredClasses();

    n = req.size();

    for (index = 0; index != n; index += 1) {
        UmlClass * cl = req[index];

        out.indent();
        out << "<" << k << " xmi:type=\"uml:Usage\"";
        out.id_prefix(this, "REQ_", index);
        out.ref(cl, "supplier");
        out.ref(this, "client");
        out << "/>\n";
    }

    unload();

}
Esempio n. 20
0
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();
}
Esempio n. 21
0
void UmlState::write(FileOut & out) {
  anItemKind pkind = parent()->kind();
  bool mach = (pkind != aState) && (pkind != aRegion);
  UmlState * ref = reference();
  const char * k;
  
  if (mach) {
    k = (_uml_20) ? "ownedMember" : "packagedElement";
    memo_incoming_trans();
  }
  else
    k = "subvertex";
  
  out.indent(); 
  out << "<" << k << " xmi:type=\"uml:"
    << ((mach || (stereotype() == "machine")) ? "StateMachine" : "State")
    << '"';
  out.id(this); 
  out << " name=\"";
  out.quote(name());
  out << '"';
  if (ref != 0)
    out.ref(ref, "submachine");
  else {
    if (specification() != 0)
      out.ref(specification(), "specification");
    if (isActive())
      out << " isActive=\"true\"";
  }
  out << ">\n";
  out.indent(+1); 
  
  write_description_properties(out); 
  
  if (ref == 0) {
    QCString doentry;
    QCString doactivity;
    QCString doexit;
    
    switch (_lang) {
    case Uml:
      doentry = entryBehavior();
      doactivity = doActivity();
      doexit = exitBehavior();
      break;
    case Cpp:
      doentry = cppEntryBehavior();
      doactivity = cppDoActivity();
      doexit = cppExitBehavior();
      break;
    default: // Java
      doentry = javaEntryBehavior();
      doactivity = javaDoActivity();
      doexit = javaExitBehavior();
      break;
    }
    
    if (! doentry.isEmpty()) {
      out.indent();
      out << "<entry xmi:type=\"uml:Activity\"";
      out.id_prefix(this, "ENTRY_");
      out << ">\n";
      out.indent();
      out << "\t<body>";
      out.quote(doentry);
      out << "</body>\n";
      out.indent();
      out << "</entry>\n";
    }
    
    if (! doactivity.isEmpty()) {
      out.indent();
      out << "<doActivity xmi:type=\"uml:Activity\"";
      out.id_prefix(this, "DOACTIVITY_");
      out << ">\n";
      out.indent();
      out << "\t<body>";
      out.quote(doactivity);
      out << "</body>\n";
      out.indent();
      out << "</doActivity>\n";
    }
    
    if (! doexit.isEmpty()) {
      out.indent();
      out << "<exit xmi:type=\"uml:Activity\"";
      out.id_prefix(this, "EXIT_");
      out << ">\n";
      out.indent();
      out << "\t<body>";
      out.quote(doexit);
      out << "</body>\n";
      out.indent();
      out << "</exit>\n";
    }
  }
  
  while (! _incoming_trans.isEmpty())
    _incoming_trans.take(0)->write_in(out);
  
  const QVector<UmlItem> ch = children(); 
  unsigned n = ch.size();
  unsigned i;
  bool need_region = FALSE;
     
  for (i = 0; i != n; i += 1) {
    if (ch[i]->kind() != aRegion) {
      need_region = TRUE;
      break;
    }
  }

  if (need_region) {
    if (ref == 0) {
      out.indent();
      out << "<region xmi:type=\"uml:Region\"";
      out.id_prefix(this, "IMPLICIT_REGION_");
      out << " name=\"Bouml_Implicit_Region\">\n";
      out.indent(+1);
    }
    
    for (i = 0; i != n; i += 1)
      if (ch[i]->kind() != aRegion)
	ch[i]->write(out);
    
#if 0
    // to bypass Eclipse's bug
    while (! _trans.isEmpty())
      _trans.take(0)->write_it(out);
#endif
    
    if (ref == 0) {
      out.indent(-1);
      out.indent();
      out << "</region>\n";
    }
  }

  if (ref == 0) {
    for (i = 0; i != n; i += 1)
      if (ch[i]->kind() == aRegion)
	ch[i]->write(out);
  }
       
#if 1
    // to bypass Eclipse's bug
    while (! _trans.isEmpty())
      _trans.take(0)->write_it(out);
#endif
    
  out.indent(-1); 
  out.indent(); 
  out << "</" << k << ">\n"; 
    
  unload(); 
}
Esempio n. 22
0
void UmlCollaborationMessage::write(FileOut & out, UmlItem * diagram, const Q3PtrVector< UmlCollaborationMessage > & msgs, unsigned & index)
{
  unsigned sup = msgs.size();
  UmlPackage * prj = UmlPackage::getProject();
  
  while (index != sup) {
    const UmlCollaborationMessage * msg = msgs[index++];
    Q3CString pfix = msg->hrank() + ".";
    unsigned pfixlen = pfix.length();
    
#define MSG  "MSG", msg->itsrank
#define SEND "MSGOCCSPECSEND", msg->itsrank
#define REC  "MSGOCCSPECREC", msg->itsrank
#define BEH  "BEHEXECSPEC", msg->itsrank
#define EXEC "EXECOCCSPEC", msg->itsrank
    
    out.indent();
    out << "<fragment xmi:type=\"uml:MessageOccurrenceSpecification\"";
    out.id_prefix(diagram, SEND);
    out.ref(diagram, "covered", msg->from()->lifeline());
    out.ref(prj, "event", 
	    (msg->operation() != 0) ? msg->operation()->event(FALSE)
				    : UmlOperation::event("SEND", msg->form()));
    out.ref(diagram, "message", MSG);
    out << "/>\n";
    
    out.indent();
    out << "<message xmi:type=\"uml:Message\"";
    out.id_prefix(diagram, MSG);
    out << " name=\"";
    out.quote((const char*)((msg->operation() != 0) ? msg->operation()->name()
				      : msg->form()));//[jasa] ambiguous call
    out << '"';
    out.ref(diagram, "sendEvent", SEND);
    out.ref(diagram, "receiveEvent", REC);
    out.ref(diagram, "connector", msg->from()->connector(msg->to()));
    out << "/>\n";
    
    out.indent();
    out << "<fragment xmi:type=\"uml:MessageOccurrenceSpecification\"";
    out.id_prefix(diagram, REC);
    out.ref(diagram, "covered", msg->to()->lifeline());
    out.ref(prj, "event", 
	    (msg->operation() != 0) ? msg->operation()->event(TRUE)
				    : UmlOperation::event("REC", msg->form()));
    out.ref(diagram, "message", MSG);
    out << "/>\n";
    
    out.indent();
    out << "<fragment xmi:type=\"uml:BehaviorExecutionSpecification\"";
    out.id_prefix(diagram, BEH);
    out.ref(diagram, "covered", msg->to()->lifeline());
    out.ref(diagram, "start", REC);
    out.ref(diagram, "finish", EXEC);
    out << "/>\n";
    
    if (index != sup) {
      Q3CString pfix2 = msgs[index]->hrank() + ".";
      
      if ((pfix2.length() > pfixlen) && !strncmp(pfix, pfix2, pfixlen))
	write(out, diagram, msgs, index);
    }
    
    out.indent();
    out << "<fragment xmi:type=\"uml:ExecutionOccurrenceSpecification\"";
    out.id_prefix(diagram, EXEC);
    out.ref(diagram, "covered", msg->to()->lifeline());
    out.ref(prj, "event", 
	    UmlOperation::event("EXEC",
				(msg->operation() != 0) ? msg->operation()->name()
							: msg->form()));
    out.ref(diagram, "execution", BEH);
    out << "/>\n";
  }
}
Esempio n. 23
0
void UmlSequenceMessage::write_them(FileOut & out, UmlItem * diagram, const QVector< UmlSequenceMessage* > & msgs)
{
    int n = msgs.size();

    for (int i = 0; i != n; i += 1) {
        UmlSequenceMessage * msg = msgs[i];

        if (msg->used) {
#define MSG  "MSG", msg->itsrank
#define SEND "MSGOCCSPECSEND", msg->itsrank
#define REC  "MSGOCCSPECREC", msg->itsrank

            switch (msg->kind()) {
            case aSynchronousCall:
            case anAsynchronousCall:
                out.indent();
                out << "<message xmi:type=\"uml:Message\"";
                out.id_prefix(diagram, MSG);
                out << " name=\"";
                out.quote((msg->operation() != 0) ? msg->operation()->name()
                          : msg->form());
                out << ((msg->kind() == anAsynchronousCall)
                        ? "\" messageSort=\"asynchCall\""
                        : "\" messageSort=\"synchCall\"");

                if (msg->from() == 0) {
                    out << " messageKind=\"found\"";
                    out.ref(diagram, "receiveEvent", REC);
                }
                else if (msg->to() == 0) {
                    out << " messageKind=\"lost\"";
                    out.ref(diagram, "sendEvent", SEND);
                }
                else {
                    out << " messageKind=\"complete\"";
                    out.ref(diagram, "sendEvent", SEND);
                    out.ref(diagram, "receiveEvent", REC);
                    out.ref(diagram, "connector", msg->from()->connector(msg->to()));
                }

                if (!msg->stereotype().isEmpty() && UmlItem::gen_extension()) {
                    out << ">\n";
                    out.indent();
                    out << "\t<xmi:Extension extender=\"Bouml\"><stereotype name=\"";
                    out.quote(msg->stereotype());
                    out << "\"/></xmi:Extension>\n";
                    out.indent();
                    out << "</message>\n";
                }
                else
                    out << "/>\n";

                break;

            case anExplicitReturn:
                out.indent();
                out << "<message xmi:type=\"uml:Message\"";
                out.id_prefix(diagram, MSG);
                out << " name=\"";
                out.quote(msg->form());
                out << "\" messageSort=\"reply\"";
                out.ref(diagram, "sendEvent", SEND);
                out.ref(diagram, "receiveEvent", REC);
                out.ref(diagram, "connector", msg->from()->connector(msg->to()));

                if (!msg->stereotype().isEmpty() && UmlItem::gen_extension()) {
                    out << ">\n";
                    out.indent();
                    out << "\t<xmi:Extension extender=\"Bouml\"><stereotype name=\"";
                    out.quote(msg->stereotype());
                    out << "\"/></xmi:Extension>\n";
                    out.indent();
                    out << "</message>\n";
                }
                else
                    out << "/>\n";

                break;

            default:
                break;
            }

#undef MSG
#undef SEND
#undef REC
        }
    }
}
Esempio n. 24
0
void UmlSequenceMessage::write_fragment(FileOut & out, UmlItem * diagram, QList< UmlSequenceMessage* > & msgs)
{
    msgs.removeOne(this);

#define MSG  "MSG", itsrank
#define SEND "MSGOCCSPECSEND", itsrank
#define REF_SEND  "MSGOCCSPECSEND", reverse->itsrank
#define REC  "MSGOCCSPECREC", itsrank
#define BEH  "BEHEXECSPEC", itsrank
#define REF_BEH  "BEHEXECSPEC", reverse->itsrank
#define EXEC "EXECOCCSPEC", itsrank
#define REF_EXEC "EXECOCCSPEC", reverse->itsrank
#define DEL "DELOCCSPEC", itsrank

    UmlPackage * prj = UmlPackage::getProject();

    switch (kind()) {
    case aSynchronousCall:
    case anAsynchronousCall:
        used = TRUE;

        if (from() != 0) {
            out.indent();
            out << "<fragment xmi:type=\"uml:MessageOccurrenceSpecification\"";
            out.id_prefix(diagram, SEND);
            out.ref(diagram, "covered", from()->lifeline());
            out.ref(prj, "event",
                    (operation() != 0) ? operation()->event(FALSE)
                    : UmlOperation::event("SEND", form()));
            out.ref(diagram, "message", MSG);
            out << "/>\n";
        }

        if (to() != 0) {
            out.indent();
            out << "<fragment xmi:type=\"uml:MessageOccurrenceSpecification\"";
            out.id_prefix(diagram, REC);
            out.ref(diagram, "covered", to()->lifeline());
            out.ref(prj, "event",
                    (operation() != 0) ? operation()->event(TRUE)
                    : UmlOperation::event("REC", form()));
            out.ref(diagram, "message", MSG);
            out << "/>\n";

            out.indent();
            out << "<fragment xmi:type=\"uml:BehaviorExecutionSpecification\"";
            out.id_prefix(diagram, BEH);
            out.ref(diagram, "covered", to()->lifeline());
            out.ref(diagram, "start", REC);

            if (reverse != 0) {
                if (reverse->kind() == anExplicitReturn)
                    out.ref(diagram, "finish", REF_SEND);
                else
                    out.ref(diagram, "finish", REF_EXEC);
            }

            out << "/>\n";
        }

        break;

    case anExplicitReturn:
        used = TRUE;

        out.indent();
        out << "<fragment xmi:type=\"uml:MessageOccurrenceSpecification\"";
        out.id_prefix(diagram, SEND);
        out.ref(diagram, "covered", from()->lifeline());
        out.ref(prj, "event", UmlOperation::event("SEND", form()));
        out.ref(diagram, "message", MSG);
        out << "/>\n";

        out.indent();
        out << "<fragment xmi:type=\"uml:MessageOccurrenceSpecification\"";
        out.id_prefix(diagram, REC);
        out.ref(diagram, "covered", to()->lifeline());
        out.ref(prj, "event", UmlOperation::event("REC", form()));
        out.ref(diagram, "message", MSG);
        out << "/>\n";
        break;

    case aDestruction:
        out.indent();
        out << "<fragment xmi:type=\"uml:OccurrenceSpecification\"";
        out.id_prefix(diagram, DEL);
        out.ref(diagram, "covered", from()->lifeline());
        out.ref(prj, "event", UmlOperation::event("DEL", ""));
        out << "/>\n";
        break;

    case anInteractionUse:
        break;

    default:
        if (reverse != 0) {
            out.indent();
            out << "<fragment xmi:type=\"uml:ExecutionOccurrenceSpecification\"";
            out.id_prefix(diagram, EXEC);
            out.ref(diagram, "covered", from()->lifeline());
            out.ref(prj, "event", UmlOperation::event("EXEC", form()));
            out.ref(diagram, "execution", REF_BEH);
            out << "/>\n";
        }

        break;
    }

#undef MSG
#undef SEND
#undef REF_SEND
#undef REC
#undef BEH
#undef REF_BEH
#undef EXEC
#undef REF_EXEC
#undef DEL
}
Esempio n. 25
0
void UmlClass::write(FileOut & out) {
  QCString st = stereotype();
  
  if (st == "metaclass")
    return;
  
  bool is_actor = (st == "actor");
  bool is_enum = (st == "enum");
  bool is_stereotype =
    (st == "stereotype") && 
    (parent()->parent()->kind() == aPackage) &&
    (parent()->parent()->stereotype() == "profile");
  
  if (!is_actor) {
    switch (_lang) {
    case Cpp:
      if (cppDecl().isEmpty())
	return;
      break;
    case Java:
      if (javaDecl().isEmpty())
	return;
    default:
      break;
    }
  }

  const char * k = (parent()->kind() == aClass)
    ? "nestedClassifier"
    : ((!_uml_20)
       ? "packagedElement"
       : ((is_stereotype) ? "ownedStereotype" : "ownedMember"));
  bool is_assoc_class = (_assoc != 0);
  
  out.indent();
  out << "<" << k << " xmi:type=\"uml:"
    << ((is_actor) 
	? "Actor"
	: ((is_assoc_class)
	   ? "AssociationClass"
	   : ((st == "interface")
	      ? "Interface" 
	      : ((is_enum)
		 ?"Enumeration"
		 : ((is_stereotype) ? "Stereotype" : "Class")))))
    << "\" name=\"";
  out.quote(name());
  out << '"';
  out.id(this);
  write_visibility(out);
  if (isAbstract())
    out << " isAbstract=\"true\"";
  if (isActive())
    out << " isActive=\"true\"";
  out << ">\n";
  
  if (is_assoc_class)
    _assoc->write_ends(out);
    
  out.indent(+1);
  
  write_constraint(out);
  write_annotation(out);
  write_description_properties(out);
  
  if (_gen_extension && (st == "typedef")) {
    const UmlTypeSpec & base = baseType();
    
    if ((base.type != 0) || !base.explicit_type.isEmpty()) {
      out.indent();
      out << "<xmi:Extension extender=\"Bouml\">\n";
      out.indent();
      out << "\t<typedef>\n";
      out.indent(+2);
      UmlItem::write_type(out, base, "base");
      out.indent(-2);
      out.indent();
      out << "\t</typedef>\n";
      out.indent();
      out << "</xmi:Extension>\n";
    }
  }
  
  write_formals(out);
  write_actuals(out);
  
  const QVector<UmlItem> ch = children();
  unsigned n = ch.size();
  unsigned i;
  
  for (i = 0; i != n; i += 1)
    ch[i]->write(out);
  
  if (is_stereotype) {
    QCString path;
    
    if (propertyValue("stereotypeIconPath", path) && !path.isEmpty()) {
      out.indent();
      out << "<icon xmi:type=\"uml:Image\"";
      out.id_prefix(this, "Icon_");
      out << " location=\"" << path << "\"/>\n";
    }
  }
  
  out.indent(-1);
  out.indent();
  out << "</" << k << ">\n";
  
  if (is_stereotype)
    for (i = 0; i != n; i += 1)
      if (ch[i]->kind() == aRelation)
	((UmlRelation *) ch[i])->write_extension(out);
  
  unload();
}
Esempio n. 26
0
void UmlFragment::write_ref(FileOut & out, UmlItem * diagram, Q3PtrList< UmlSequenceMessage > & msgs)
{
    static int rank = 0;

    out.indent();
    out << "<fragment xmi:type=\"uml:InteractionUse\"";
    out.id_prefix(diagram, "INTERACTIONUSE", ++rank);

    const Q3PtrVector<UmlClassInstanceReference> & v = UmlBaseFragment::covered();
    unsigned n;
    unsigned index;

    n = v.count();

    if (n != 0) {
        out << " covered=\"";

        index = 0;

        for (;;) {
            out.ref_only(diagram, v.at(index)->lifeline());

            if (++index == n)
                break;

            out << " ";
        }

        out << '"';
    }

    UmlDiagram * d = refer();

    if (d != 0) {
        switch (d->kind()) {
        case aSequenceDiagram:
        case aCollaborationDiagram:
            out.ref(d, "refersTo", "INTERACTION_");

            if (arguments().isEmpty())
                out << "/>\n";
            else {
                static int rank = 0;

                out << ">\n";
                out.indent();
                out << "\t<argument xmi:type=\"uml:OpaqueExpression\"";
                out.id_prefix(d, "INTER_ARG_EXPR_", ++rank);
                out << ">\n";
                out.indent();
                out << "\t\t<body>";
                out.quote(arguments());
                out << "</body>\n";
                out.indent();
                out << "\t</argument>\n";
                out.indent();
                out << "</fragment>\n";
            }

            break;

        default:
            out << "/>\n";
            break;
        }
    }
    else
        out << "/>\n";

    // remove internal messages and compartment

    const Q3PtrVector<UmlFragmentCompartment> & subs = compartments();

    n = subs.size();

    for (index = 0; index != n; index += 1)
        subs.at(index)->bypass(msgs);
}