コード例 #1
0
ファイル: UmlRelation.cpp プロジェクト: SciBoy/douml
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();
}
コード例 #2
0
ファイル: UmlOperation.cpp プロジェクト: bleakxanadu/douml
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;
    }
}
コード例 #3
0
ファイル: UmlRelation.cpp プロジェクト: SciBoy/douml
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";
  }

}
コード例 #4
0
ファイル: UmlArtifact.cpp プロジェクト: 02JanDal/douml
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";
}
コード例 #5
0
ファイル: UmlActivityPartition.cpp プロジェクト: SciBoy/douml
void UmlActivityPartition::write(FileOut & out) {
  const char * p = (parent()->kind() == aPartition)
    ? "subpartition" : "group";
  
  out.indent();
  out << "<" << p << " xmi:type=\"uml:ActivityPartition\" name=\"";
  out.quote((const char*)name());//[jasa] ambiguous call
  out << '"';
  out.id(this);
  if (isDimension())
    out << " isDimension=\"true\"";
  if (isExternal())
    out << " isExternal=\"true\"";
  if (represents() != 0)
    out.ref(represents(), "represents");
  out << ">\n";
  out.indent(+1);
  
  write_description_properties(out); 
  
  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 << "</" << p << ">\n";

  unload();
}
コード例 #6
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);

}
コード例 #7
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);
}
コード例 #8
0
ファイル: UmlNcRelation.cpp プロジェクト: mobius3/douml
void UmlNcRelation::write(FileOut & out)
{
    if ((relationKind() == aDependency) &&
            (parent()->kind() == anUseCase) &&
            (target()->kind() == anUseCase)) {
        const char * t;
        const char * r;

        if (stereotype() == "include") {
            t = "Include";
            r = "addition";
        }
        else if (stereotype() == "extend") {
            t = "Extend";
            r = "extendedCase";
        }
        else {
            write(out, TRUE);
            return;
        }

        out.indent();
        out << "<" << stereotype() << " xmi:type=\"uml:" << t << "\"";
        out.id(this);
        out.ref(target(), r);
        out << ">\n";
        out.indent(+1);
        write_description_properties(out);
        out.indent(-1);
        out.indent();
        out << "</" << stereotype() << ">\n";
    }
    else
        write(out, TRUE);
}
コード例 #9
0
ファイル: UmlRelation.cpp プロジェクト: SciBoy/douml
void UmlRelation::write_dependency(FileOut & out) {
  const char * k = (_uml_20) ? "ownedElement" : "packagedElement";

  out.indent();
  out << '<' << k << " xmi:type=\"uml:Dependency\"";
  out.id(this);
  out.ref(parent(), "client");
  out.ref(roleType(), "supplier");
  out << ">\n";
  out.indent(+1); 
  write_constraint(out);
  write_description_properties(out);
  out.indent(-1);
  out.indent();
  out << "</" << k << ">\n";
}
コード例 #10
0
ファイル: UmlFormalParameter.cpp プロジェクト: SciBoy/douml
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";
}
コード例 #11
0
ファイル: UmlNcRelation.cpp プロジェクト: mobius3/douml
void UmlNcRelation::write_generalization(FileOut & out)
{
    out.indent();
    out << "<generalization xmi:type=\"uml:Generalization\"";
    out.id(this);
    out.ref(target(), "general");
    out << "/>\n";
}
コード例 #12
0
ファイル: UmlNcRelation.cpp プロジェクト: mobius3/douml
void UmlNcRelation::write_dependency(FileOut & out)
{
    const char * k = (_uml_20) ? "ownedElement" : "packagedElement";

    out.indent();
    out << '<' << k <<
        (((parent()->kind() == anArtifact) && (stereotype() == "manifest"))
         ?  " xmi:type=\"uml:Manifestation\"" : " xmi:type=\"uml:Dependency\"");
    out.id(this);
    out.ref(parent(), "client");
    out.ref(target(), "supplier");
    out << ">\n";
    out.indent(+1);
    write_description_properties(out);
    out.indent(-1);
    out.indent();
    out << "</" << k << ">\n";
}
コード例 #13
0
ファイル: UmlItem.cpp プロジェクト: vresnev/douml
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();
            }
        }
    }

}
コード例 #14
0
ファイル: UmlActivityAction.cpp プロジェクト: SciBoy/douml
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);
}
コード例 #15
0
ファイル: UmlRelation.cpp プロジェクト: SciBoy/douml
void UmlRelation::write_generalization(FileOut & out) {
  out.indent();
  out << "<generalization xmi:type=\"uml:Generalization\"";
  out.id(this);
  out.ref(roleType(), "general");
  if (!constraint().isEmpty()) {
    out << ">\n";
    out.indent(+1);
    write_constraint(out);
    out.indent(-1);
    out.indent();
    out << "</generalization>\n";
  }
  else
    out << "/>\n";
}
コード例 #16
0
void UmlActivityObject::write_in_state(FileOut & out) {
  QCString s = inState();
  
  if (!s.isEmpty()) {
    UmlState * st = UmlState::find(s);

    if (st != 0)
      out.ref(st, "inState");
    else {
      // not legal but ...
      out << " inState=\"";
      out.quote(s);
      out << '"';
    }
  }
}
コード例 #17
0
void UmlEntryPointPseudoState::write(FileOut & out) {
  UmlEntryPointPseudoState * ref = reference();
  
  out.indent();
  if (ref != 0)
    out << "<connection";
  else
    out << "<subvertex xmi:type=\"uml:Pseudostate\"";
  out.id(this);
  if (! name().isEmpty()) {
    out << " name=\"";
    out.quote(name());
    out << '"';
  }
  if (ref != 0) {
    out.ref(ref, "entry");
    out << ">\n";
  }
  else
    out << " kind=\"entryPoint\">\n";

  out.indent(+1);
  
  write_description_properties(out); 
     
  while (! _incoming_trans.isEmpty())
    _incoming_trans.take(0)->write_in(out);
  
  const QVector<UmlItem> ch = children(); 
  unsigned n = ch.size();
  unsigned i;
     
  for (i = 0; i != n; i += 1)
    ch[i]->write(out);

  out.indent(-1);
  out.indent();
  if (ref != 0)
    out << "</connection>\n";
  else
    out << "</subvertex>\n";
    
  unload(); 
}
コード例 #18
0
void UmlValueSpecificationAction::write(FileOut & out) {
  write_begin(out, "ValueSpecificationAction");
  
  Q3CString val;
  
  switch (_lang) {
  case Uml:
    val = value();
    break;
  case Cpp:
    val = cppValue();
    break;
  default:
    // Java
    val = javaValue();
  }
  if (! val.isEmpty())
    out.ref(activity()->add_opaque_expression(val, this),
	    "value", "OPAQUE_EXPRESSION_");

  write_end(out);
}
コード例 #19
0
ファイル: UmlSequenceMessage.cpp プロジェクト: DoUML/douml
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
}
コード例 #20
0
ファイル: UmlComponent.cpp プロジェクト: DoUML/douml
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();

}
コード例 #21
0
ファイル: UmlRelation.cpp プロジェクト: SciBoy/douml
void UmlRelation::write_relation_as_attribute(FileOut & out) {
  UmlRelation * first = side(TRUE);
  Q3CString s;  
  UmlClass * base;

  if ((first->parent()->stereotype() == "stereotype") &&
      (first->roleType()->stereotype() == "metaclass")) {
    if (this != first)
      return;
    
    base = first->roleType();
    s = "base_" + base->name();
  }
  else {
    base = 0;
      
    switch (_lang) {
    case Uml:
      s = roleName();
      break;
    case Cpp:
      if (cppDecl().isEmpty())
	return;
      s = true_name(roleName(), cppDecl());
      break;
    default: // Java
      if (javaDecl().isEmpty())
	return;
      s = true_name(roleName(), javaDecl());
    }
  }
  
  out.indent();
  out << "<ownedAttribute xmi:type=\"uml:Property\" name=\"" << s << '"';
  out.id(this);
  
  if (base != 0)
    out.ref(first, "association", "EXT_");
  else {
    write_visibility(out);
    write_scope(out);
    if (isReadOnly())
      out << " isReadOnly=\"true\"";
    if (isDerived()) {
      out << " isDerived=\"true\"";
      if (isDerivedUnion())
	out << " isDerivedUnion=\"true\"";
    }
    if (isOrdered())
      out << " isOrdered=\"true\"";
    if (isUnique())
      out << " isUnique=\"true\"";
  
    if (first->_assoc_class != 0)
      out.ref(first->_assoc_class, "association");
    else
      out.ref(first, "association", "ASSOC_");
  
    out << " aggregation=\"";
    if (this == first) {
      parent()->memo_relation(this);
      if (_gen_eclipse) {
	switch (relationKind()) {
	case anAggregation:
	case aDirectionalAggregation:
	  out << "shared";
	  break;
	case anAggregationByValue:
	case aDirectionalAggregationByValue:
	  out << "composite";
	  break;
	default:
	  out << "none";
	}
      }
      else
	out << "none";
    }
    else 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 << '"';
  }
  
  out << ">\n";
  out.indent(+1);
  
  out.indent();
  out << "<type xmi:type=\"uml:Class\"";
  if (base != 0) {
    if (! base->propertyValue("metaclassPath", s))
      s = (_uml_20) ? "http://schema.omg.org/spec/UML/2.0/uml.xml"
		    : "http://schema.omg.org/spec/UML/2.1/uml.xml";
    out << " href=\"" << s << '#' << base->name() << '"';
  }
  else
    out.idref(roleType());
  out << "/>\n";
  write_multiplicity(out, multiplicity(), this);
  write_default_value(out, defaultValue(), this);
  write_constraint(out);
  write_annotation(out);
  write_description_properties(out);
  
  out.indent(-1);
  out.indent();
  out << "</ownedAttribute>\n";

  unload();
}
コード例 #22
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();
}
コード例 #23
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(); 
}
コード例 #24
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";
  }
}
コード例 #25
0
ファイル: UmlFragment.cpp プロジェクト: 02JanDal/douml
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);
}
コード例 #26
0
ファイル: UmlSequenceMessage.cpp プロジェクト: DoUML/douml
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
        }
    }
}