Put the source tree root node in the document cache.
TODO: This function needs to be a LOT more sophisticated.

@param n The node to cache.
@param source The Source object to cache.
510607
public void putDocumentInCache(int n, Source source)
  {

    int cachedNode = getNode(source);

    if (DTM.NULL != cachedNode)
    {
      if (!(cachedNode == n))
        throw new RuntimeException(
          "Programmer's Error!  "
          + "putDocumentInCache found reparse of doc: "
          + source.getSystemId());
      return;
    }
    if (null != source.getSystemId())
    {
      m_sourceTree.addElement(new SourceTree(n, source.getSystemId()));
    }
  }
846781
protected void appendNode(Node n)
    {
        if (mRootNode != null) {
            mRootNode.appendChild(n);
        } else {
            mElement.appendChild(n);
        }
    }
845709
public void insertAsNext(BasicDoubleLinkedNode<V> node) {

    BasicDoubleLinkedNode<V> next = getNext();
    if (next != null) {
      next.previous = node;
      node.setNext(next);
    }
    node.previous = this;
    setNext(node);
  }
1222547
public void addClassNodeToCompile(ClassNode node, SourceUnit location) {
        String nodeName = node.getName();
        classesToCompile.put(nodeName, node);
        classNameToSource.put(nodeName, location);
    }
312077
private void addNode(final TrieNode<V> node, final CharSequence key,
                         final int beginIndex, final TrieNode<V> newNode) {
        final int lastKeyIndex = key.length() - 1;
        TrieNode<V> currentNode = node;
        int i = beginIndex;

        for (; i < lastKeyIndex; i++) {
            final TrieNode<V> nextNode = new TrieNode<V>(false);
            currentNode.children.put(key.charAt(i), nextNode);
            currentNode = nextNode;
        }

        currentNode.children.put(key.charAt(i), newNode);
    }
167037
public void insertNode(int n, int pos)
  {

    if (!m_mutable)
      throw new RuntimeException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_NODESETDTM_NOT_MUTABLE, null)); //"This NodeSetDTM is not mutable!");

    insertElementAt(n, pos);
  }
85068
public void setTemplateSource(String name, String source) {
        mTemplateSources.put(name, new TemplateSource(name, source));
    }
697737
@SuppressWarnings("unchecked")
    private void delete(SoftHandle<K, V> n) {
        if (n.tree == null) {
            throw new IllegalArgumentException("Invalid handle!");
        }

        /*
         * Delete from belonging list. Care must be taken as the tree reference
         * is valid only if the node is the first in the list.
         */
        TreeNode<K, V> tree = n.tree;

        if (tree.cHead != n) {
            /*
             * Not first in list. Each case, remove and leave as ghost element.
             */
            if (n.next != null) {
                n.next.prev = n.prev;
            }
            n.prev.next = n.next;
        } else {
            /*
             * First in list
             */
            SoftHandle<K, V> nNext = n.next;
            tree.cHead = nNext;
            if (nNext != null) {
                /*
                 * More elements exists, remove and leave as ghost element.
                 * Update new first element to point to correct tree.
                 */
                nNext.prev = null;
                nNext.tree = tree;
            } else {
                /*
                 * No more elements, sift.
                 */
                sift(tree);

                /*
                 * If still no elements, remove tree.
                 */
                if (tree.cHead == null) {
                    if (tree.parent instanceof TreeNode) {
                        TreeNode<K, V> p = (TreeNode<K, V>) tree.parent;
                        if (p.left == tree) {
                            p.left = null;
                        } else {
                            p.right = null;
                        }
                    } else {
                        delete((RootListNode<K, V>) tree.parent);
                    }
                }

            }
        }

        n.tree = null;
        n.prev = null;
        n.next = null;

        size--;
    }
449149
public void setNodeText(Node n, String text) {
        if (n == null)
            return;
        Node nc = null;
        while ((nc = n.getFirstChild()) != null) {
            n.removeChild(nc);
        }
        if (n.getAttributes().getNamedItemNS(XFA_DATA_SCHEMA, "dataNode") != null)
            n.getAttributes().removeNamedItemNS(XFA_DATA_SCHEMA, "dataNode");
        n.appendChild(domDocument.createTextNode(text));
        changed = true;
    }
293468
public void add(XmlReader node)
    {
        Check.notNull(node);

        final Element element = node.getElement();
        document.adoptNode(element);
        root.appendChild(element);
    }
1319858
public void add( NameSource source ) {
        /*
            Unimplemented -
            Need to add an inner class util here that holds the source and
            monitors it by registering a listener
        */
        if ( sources == null )
            sources = new ArrayList();

        sources.add( source );
    }
776238
@Override
  public String toSource(Node n) {
    initCompilerOptionsIfTesting();
    return toSource(n, null, true);
  }
885600
public void add(N node) {
        if (! node.added) {
            nodes.add(node);
            node.added = true;
        }
    }
1230934
public static void deleteChildren(Node n, AbstractCompiler compiler) {
    while (n.hasChildren()) {
      deleteNode(n.getFirstChild(), compiler);
    }
  }
1154680
public static void setElementContent(final Node n,
                                       final String s) throws SAXException {
    NodeList children = n.getChildNodes();

    for (int i = 0; i < children.getLength(); i++) {
      Node curnode = children.item(i);

      n.removeChild(curnode);
    }

    Document d = n.getOwnerDocument();

    final Node textNode = d.createTextNode(s);

    n.appendChild(textNode);
  }
356545
public final void setSource(Node source) {
    if (prototypeSlot != null) {
      // NOTE(bashir): On one hand when source is null we want to drop any
      // references to old nodes retained in prototypeSlot. On the other hand
      // we cannot simply drop prototypeSlot, so we retain all information
      // except the propertyNode for which we use an approximation! These
      // details mostly matter in hot-swap passes.
      if (source == null || prototypeSlot.getNode() == null) {
        prototypeSlot =
            new Property(
                prototypeSlot.getName(),
                prototypeSlot.getType(),
                prototypeSlot.isTypeInferred(),
                source);
      }
    }
    this.source = source;
  }
68186
public void removeNode(int n)
  {

    if (!m_mutable)
      throw new RuntimeException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_NODESETDTM_NOT_MUTABLE, null)); //"This NodeSetDTM is not mutable!");

    this.removeElement(n);
  }