Beispiel #1
0
void BrowserNode::children(BrowserNodeList & nodes,
			   UmlCode kind1, UmlCode kind2) const {
  Q3ListViewItem * child;
  
  for (child = firstChild(); child; child = child->nextSibling())
    if (!((BrowserNode *) child)->is_deleted &&
	((((BrowserNode *) child)->get_type() == kind1) ||
	 (((BrowserNode *) child)->get_type() == kind2)))
      nodes.append((BrowserNode *) child);
}
void BrowserOperation::instances(BrowserNodeList & result)
{
    IdIterator<BrowserOperation> it(all);
    BrowserOperation * op;

    while(it.hasNext()){
        it.next();
        if ((op = it.value()) != 0)
            if (!op->deletedp())
                result.append(op);

    }

    result.sort_it();
}
Beispiel #3
0
void RelatedElementsDialog::accept() {
  bool inh = (inh_rb != 0) && inh_rb->isChecked();
  bool dep = dep_rb->isChecked();
  bool assoc = (assoc_rb != 0) && assoc_rb->isChecked();
  
  if (!inh && !dep && !assoc)
    return;

  bool sametype = sametype_rb->isChecked();
  UmlCode k = elt->get_type();
  
  elts.clear();

  Q3PtrDict<BrowserNode> d(71);
  BrowserNodeList added;
  int lvl = sb_level->value();
    
  added.append(elt);
  d.insert(elt, elt);
    
  do {
    BrowserNodeList newones;
    Q3PtrListIterator<BrowserNode> it(added);
    
    for (; it.current() != 0; ++it) {
      BrowserNode * e = (BrowserNode *) it.current();
      BrowserNode * bn;
      
      if (referenced_rb->isChecked()) {
	for (bn = (BrowserNode *) e->firstChild();
	     bn != 0;
	     bn = (BrowserNode *) bn->nextSibling()) {
	  if (! bn->deletedp()) {
	    BrowserNode * target;
	    
	    switch (bn->get_type()) {
	    case UmlAssociation:
	    case UmlDirectionalAssociation:
	    case UmlAggregation:
	    case UmlAggregationByValue:
	    case UmlDirectionalAggregation:
	    case UmlDirectionalAggregationByValue:
	      if (! assoc) continue;
	      target = ((RelationData *) bn->get_data())->get_end_class();
	      break;
	    case UmlDependency:
	      if (! dep) continue;
	      target = ((RelationData *) bn->get_data())->get_end_class();
	      break;
	    case UmlGeneralisation:
	    case UmlRealize:
	      if (! inh) continue;
	      target = ((RelationData *) bn->get_data())->get_end_class();
	      break;
	    case UmlDependOn:
	      if (! dep) continue;
	      target = ((SimpleRelationData *) bn->get_data())->get_end_node();
	      break;
	    case UmlInherit:
	      if (! inh) continue;
	      target = ((SimpleRelationData *) bn->get_data())->get_end_node();
	      break;
	    default:
	      continue;
	    }
	    
	    if ((sametype && (target->get_type() != k)) ||
		(d[target] != 0))
	      continue;
	    d.insert(target, target);
	    newones.append(target);
	  }
	}
      }
      
      if (referencing_rb->isChecked()) {
	if (e->get_type() == UmlClass)
	  BrowserRelation::get_relating(e, d, newones, inh, dep, assoc);
	BrowserSimpleRelation::get_relating(e, d, newones, inh, dep, sametype, k);
      }
    }
    
    added = newones;
  } while (--lvl != 0);
  
  d.remove(elt);
  
  Q3PtrDictIterator<BrowserNode> it(d);
  
  while (it.current()) {
    elts.append(it.current());
    ++it;
  }
  
  QDialog::accept();
}