/**
  * FIXME comment.
  *
  * @param elem
  * @param result
  */
 private void addDNodeListElements(
     final DDiagramElementContainer elem, final Collection<DNodeListElement> result) {
   if (elem instanceof DNodeContainer) {
     final DNodeContainer container = (DNodeContainer) elem;
     final Iterator<DDiagramElement> it = container.getOwnedDiagramElements().iterator();
     while (it.hasNext()) {
       final DDiagramElement subElem = it.next();
       if (subElem instanceof DNodeListElement) {
         result.add((DNodeListElement) subElem);
       }
       if (subElem instanceof DDiagramElementContainer) {
         addDNodeListElements((DDiagramElementContainer) subElem, result);
       }
     }
   } else if (elem instanceof DNodeList) {
     final DNodeList list = (DNodeList) elem;
     result.addAll(list.getOwnedElements());
   }
 }
 /**
  * FIXME comment.
  *
  * @param elem
  * @param result
  */
 private void addDNodes(final DDiagramElementContainer elem, final Collection<DNode> result) {
   if (elem instanceof DNodeContainer) {
     final DNodeContainer container = (DNodeContainer) elem;
     addBorderNodes(container, result);
     final Iterator<DDiagramElement> it = container.getOwnedDiagramElements().iterator();
     while (it.hasNext()) {
       final DDiagramElement subElem = it.next();
       if (subElem instanceof DNode) {
         result.add((DNode) subElem);
         final DNode node = (DNode) subElem;
         addBorderNodes(node, result);
       }
       if (subElem instanceof DDiagramElementContainer) {
         addDNodes((DDiagramElementContainer) subElem, result);
       }
     }
   } else if (elem instanceof DNodeList) {
     /* Now DNodeList contains DNodeListElements and bordered nodes */
     addBorderNodes(elem, result);
   }
 }
 private void addDiagramElementContainers(
     final DDiagram diagram,
     final DNodeContainer container,
     final Collection<DDiagramElementContainer> result) {
   final Iterator<DDiagramElement> it = container.getOwnedDiagramElements().iterator();
   while (it.hasNext()) {
     final DDiagramElement elem = it.next();
     if (elem instanceof DDiagramElementContainer) {
       result.add((DDiagramElementContainer) elem);
     }
     if (elem instanceof DNodeContainer) {
       addDiagramElementContainers(diagram, (DNodeContainer) elem, result);
     }
   }
 }