code: public void addChild(Node node) throws ChildNodeException {
      if (node != null) {
        if (!allowChildren) {
          throw new ChildNodeException();
        }
  
        if (getFirstChild() == null) {
          setFirstChild(node);
          getFirstChild().setPrevSibling(firstChild);
          getFirstChild().setNextSibling(firstChild);
        } else {    // Add it to the end of the list
          Node lastChild = getFirstChild().getPrevSibling();
          if (lastChild != null) {
            lastChild.setNextSibling(node);
          }
          node.setNextSibling(getFirstChild());
        }
        node.setParent(this);
      }
    }
docs: This function adds a child to the linked-list of children for this node. It adds the child to the end of the list.
  
  @param node Node that is the node to be added as a child of this Node.
  @throws ChildNodeException