public CarnotTreeNode findFirst(Object object) {
   for (Enumeration e = depthFirstEnumeration(); e.hasMoreElements(); ) {
     CarnotTreeNode node = (CarnotTreeNode) e.nextElement();
     if (node.getUserObject() == object) {
       return node;
     }
   }
   return null;
 }
 public CarnotTreeNode getNode(Object element) {
   for (int i = 0; i < getChildCount(); i++) {
     CarnotTreeNode node = (CarnotTreeNode) children.get(i);
     if (node.getUserObject() == element) {
       return node;
     }
   }
   return null;
 }
 public Iterator findAll(final Object object) {
   ArrayList list = new ArrayList();
   for (Enumeration e = depthFirstEnumeration(); e.hasMoreElements(); ) {
     CarnotTreeNode node = (CarnotTreeNode) e.nextElement();
     if (node.getUserObject() == object) {
       list.add(node);
     }
   }
   return list.iterator();
 }
 public void update() {
   if (!compareValue.equals(getCompareValue(userObject))) {
     if (isRoot()) {
       treeModel.nodeChanged(this);
     } else {
       CarnotTreeNode parent = (CarnotTreeNode) getParent();
       treeModel.removeNodeFromParent(this);
       treeModel.insertNodeInto(this, parent, parent.findCreateIndex(userObject));
     }
     compareValue = getCompareValue(userObject);
   }
 }
 public CarnotTreeNode add(int index, Object userObject) {
   CarnotTreeNode newNode = create(userObject, false);
   newNode.treeModel = treeModel;
   treeModel.insertNodeInto(newNode, this, index);
   return newNode;
 }
 public void delete(ModelElement element) {
   CarnotTreeNode node = getNode(element);
   if (node != null) {
     node.delete();
   }
 }