Beispiel #1
0
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";
}
Beispiel #2
0
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";
}
Beispiel #3
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();
}
Beispiel #4
0
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();
}
Beispiel #5
0
/* write domain state */
void dom_write_state (DOM *dom, PBF *bf, SET *subset)
{
  /* mark domain output */

  PBF_Label (bf, "DOM");

#if IOVER >= 3
  /* write iover */

  PBF_Label (bf, "IOVER");

  int iover  = ABS (dom->solfec->iover);

  PBF_Int (bf, &iover, 1);
#endif

  /* write time step */

  PBF_Label (bf, "STEP");

  PBF_Double (bf, &dom->step, 1);

  /* write constraints merit */

  PBF_Label (bf, "MERIT");

  PBF_Double (bf, &dom->merit, 1);

  /* write complete data of newly created bodies and empty the newly created bodies set */

  write_new_bodies (dom); /* writing is done to a separate file */

  SET_Free (&dom->setmem, &dom->newb);

  /* write regular bodies (this also includes states of newly created ones) */

  PBF_Label (bf, "BODS");

  if (subset)
  {
    int nbod = SET_Size (subset);

    PBF_Int (bf, &nbod, 1);
  }
  else PBF_Int (bf, &dom->nbod, 1);

  for (BODY *bod = dom->bod; bod; bod = bod->next)
  {
    if (subset && !SET_Find (subset, (void*) (long) bod->id, NULL)) continue;

    PBF_Uint (bf, &bod->id, 1);

    if (bod->label) PBF_Label (bf, bod->label); /* label body record for fast access */

    BODY_Write_State (bod, bf);
  }

  /* write constraints */

  PBF_Label (bf, "CONS");

  if (subset)
  {
    int ncon = 0;

    for (CON *con = dom->con; con; con = con->next)
    {
      if (subset)
      {
	if (!SET_Find (subset, (void*) (long) con->master->id, NULL)) continue;
	if (con->slave && !SET_Find (subset, (void*) (long) con->slave->id, NULL)) continue;
      }

      ncon ++;
    }

    PBF_Int (bf, &ncon, 1);
  }
  else PBF_Int (bf, &dom->ncon, 1);

  for (CON *con = dom->con; con; con = con->next)
  {
    if (subset)
    {
      if (!SET_Find (subset, (void*) (long) con->master->id, NULL)) continue;
      if (con->slave && !SET_Find (subset, (void*) (long) con->slave->id, NULL)) continue;
    }

    write_constraint (con, bf);
  }
}
Beispiel #6
0
void UmlOperation::write(FileOut & out)
{
    WrapperStr decl;

    switch (_lang) {
    case Uml:
        out.indent();
        out << "<ownedOperation xmi:type=\"uml:Operation\" name=\"";
        out.quote((const char *)name()); //[jasa] ambiguous call
        break;

    case Cpp:
        decl = cppDecl();

        if (decl.isEmpty())
            return;

        remove_comments(decl);
        out.indent();
        out << "<ownedOperation xmi:type=\"uml:Operation\" name=\"";
        out.quote((const char *)true_name(name(), cppDecl())); //[jasa] ambiguous call
        break;

    default: // Java
        decl = javaDecl();

        if (decl.isEmpty())
            return;

        remove_comments(decl);
        out.indent();
        out << "<ownedOperation xmi:type=\"uml:Operation\" name=\"";
        out.quote((const char *)true_name(name(), javaDecl())); //[jasa] ambiguous call
        break;
    }

    out << '"';
    out.id(this);

    write_visibility(out);
    write_scope(out);

    if ((_lang == Cpp) && isCppConst())
        out << " isQuery=\"true\"";

    out << " isAbstract=\""
        << ((isAbstract()) ? "true" : "false")
        << "\">\n";

    out.indent(+1);

    write_constraint(out);
    write_annotation(out);
    write_description_properties(out);
    write_exceptions(out);
    write_return_type(out, decl);

    if (_lang == Uml)
        write_uml_params(out);
    else
        write_cpp_java_params(out, decl);

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

    unload();
}