Beispiel #1
0
 /*
  * @see org.primordion.xholon.base.IXholon#insertAfter(org.primordion.xholon.base.IXholon)
  */
 public void insertAfter(XholonTreeNode newLeftSibling) {
   if (newLeftSibling.hasNextSibling()) {
     parent = newLeftSibling.getParentNode();
     nextSibling = newLeftSibling.getNextSibling();
     newLeftSibling.setNextSibling(this);
   } else { // last sibling
     setParentSiblingLinks(newLeftSibling);
   }
 }
Beispiel #2
0
 /*
  * @see org.primordion.xholon.base.IXholon#insertBefore(org.primordion.xholon.base.IXholon)
  */
 public void insertBefore(XholonTreeNode newNextSibling) {
   parent = newNextSibling.getParentNode();
   if (parent.getFirstChild() == newNextSibling) {
     parent.setFirstChild(this);
   } else {
     XholonTreeNode lSibling = newNextSibling.getPreviousSibling();
     lSibling.setNextSibling(this);
   }
   setNextSibling(newNextSibling);
 }
Beispiel #3
0
 /*
  * @see org.primordion.xholon.base.IXholon#removeChild()
  */
 public void removeChild() {
   if (!isRootNode()) {
     XholonTreeNode lNode = getPreviousSibling();
     XholonTreeNode rNode = getNextSibling();
     if (lNode == null) { // this is the first (leftmost) sibling
       if (rNode == null) {
         getParentNode().setFirstChild(null);
       } else {
         getParentNode().setFirstChild(rNode); // nextSibling is new firstChild of parent
       }
     } else {
       if (rNode == null) {
         lNode.setNextSibling(null);
       } else {
         lNode.setNextSibling(rNode);
       }
     }
     setParentNode(null);
     setNextSibling(null);
   }
 }
Beispiel #4
0
 /*
  * @see org.primordion.xholon.base.IXholon#setParentSiblingLinks(org.primordion.xholon.base.TreeNode)
  */
 public void setParentSiblingLinks(XholonTreeNode previousSibling) {
   setParentNode(previousSibling.getParentNode()); // previousSibling already has parent
   previousSibling.setNextSibling(this);
 }