/*
If the current node exists in the nodes list, bring it to the front
428985
@Override
    public List<Node> getNodes(ByteArray key) {
        logger.debug("Giving pref to localhost ! ");
        List<Node> nodes = null;
        List<Node> reorderedNodes = new ArrayList<Node>();

        try {
            nodes = super.getNodes(key);
            if(nodes == null) {
                return null;
            }

            String currentHost = InetAddress.getLocalHost().getHostName();
            for(Node n: nodes) {
                if(currentHost.contains(n.getHost()) || n.getHost().contains(currentHost)) {
                    logger.debug("Found localhost ! ");
                    reorderedNodes.add(n);
                    nodes.remove(n);
                    break;
                }
            }
            reorderedNodes.addAll(nodes);
            nodes = reorderedNodes;
        } catch(VoldemortException e) {
            pipelineData.setFatalError(e);
            return null;
        } catch(UnknownHostException e) {
            e.printStackTrace();
            return null;
        }
        return nodes;
    }
409260
function (value) {
        var node;

        if (value instanceof LinkedListNode) {
            node = value;
            validateNode(node, this);

            if (node._next === node) {
                this.head = null;
            }
            else {
                node._next._prev = node._prev;
                node._prev._next = node._next;

                if (this.head === node) {
                    this.head = node._next;
                }
            }
            node._list = null;
            node._next = null;
            node._prev = null;
            this.size--;

            return true;
        }
        else {
            if ((node = this.find(value)) !== null) {
                this.remove(node);
                return true;
            }
            return false;
        }
    }
818013
function nodeBeforeLocation(location) {
        var node;
        exports.root.each(function each(n) {
            if (!n.location || location < n.location) {
                return true;
            }
            if (!node || node.location < n.location) {
                node = n;
            }
        });
        return node;
    }
727162
public boolean goInto(ElementContext rootContext, String... innerElements) throws IOException, XMLException {
		ElementContext parent = rootContext;
		for (int i = 0; i < innerElements.length; ++i) {
			if (!nextInnerElement(parent, innerElements[i]))
				return false;
			parent = event.context.getFirst();
		}
		return true;
	}
150950
function (p) {
				if (p) {
					for (var i = 0; i < p.childNodes.length; i++) {
						if (p.childNodes[i].nodeType != 3 && p.childNodes[i].nodeType != 8) {
							var cEl = jsPlumb.getElement(p.childNodes[i]),
								cid = _currentInstance.getId(p.childNodes[i], null, true);
							if (cid && _elementsWithEndpoints[cid] && _elementsWithEndpoints[cid] > 0) {
								var cOff = _currentInstance.getOffset(cEl);
								_delements[id][cid] = {
									id: cid,
									offset: {
										left: cOff.left - parentOffset.left,
										top: cOff.top - parentOffset.top
									}
								};
								_draggablesForElements[cid] = id;
							}
							_oneLevel(p.childNodes[i]);
						}
					}
				}
			}
638781
function (node) {
            if (node.startToken.prev && node.startToken.prev.type !== 'LineBreak') {
                insertBefore(node.startToken, nextLineFactory());
            }
        }
950457
def visit_if(self, node, parent):
        """"""
        newnode = nodes.If(node.lineno, node.col_offset, parent)
        newnode.postinit(
            self.visit(node.test, newnode),
            [self.visit(child, newnode) for child in node.body],
            [self.visit(child, newnode) for child in node.orelse],
        )
        return newnode
1195455
function next(prev, current, isPre) {
    if (prev && prev.parentNode === current || isPre(current)) {
        return current.nextSibling || current.parentNode;
    }

    return current.firstChild || current.nextSibling || current.parentNode;
}
954725
private static void moveAllFollowing(
      Node start, Node srcParent, Node destParent) {
    for (Node n = start.getNext(); n != null; n = start.getNext()) {
      boolean isFunctionDeclaration = NodeUtil.isFunctionDeclaration(n);
      srcParent.removeChild(n);
      if (isFunctionDeclaration) {
        destParent.addChildToFront(n);
      } else {
        destParent.addChildToBack(n);
      }
    }
  }
48079
def node_is_on_list(self, node):
        
        next = self.node_next(node)
        if next == node or next is None:
            assert(self.node_prev(node) is next)
            return False

        return True
772382
void appendEndElement()
  {
    // pop up the stacks

    if (previousSiblingWasParent)
      nodes.writeEntry(previousSibling, 2, NULL);

    // Pop parentage
    previousSibling = currentParent;
    nodes.readSlot(currentParent, gotslot);
    currentParent = gotslot[1] & 0xFFFF;

    // The element just being finished will be
    // the previous sibling for the next operation
    previousSiblingWasParent = true;

    // Pop a level of namespace table
    // namespaceTable.removeLastElem();
  }
206730
protected void addContentItems(List<CmsResultItemBean> list, boolean front, boolean showPath) {

        if (front) {
            list = Lists.reverse(list);
        }
        for (CmsResultItemBean resultItem : list) {
            addSingleResult(resultItem, front, showPath);
        }
        if (isTilingViewAllowed()) {
            m_selectView.getElement().getStyle().clearDisplay();
            selectView(m_selectView.getFormValueAsString());
        } else {
            m_selectView.getElement().getStyle().setDisplay(Display.NONE);
            selectView(DETAILS);
        }
        onContentChange();
    }
453518
function hasIncomingEdge(list, node) {
    for (var i = 0, l = list.length; i < l; ++i) {
      if (list[i].links.find(function(e,i,a){
        return node._id == e;
      })) return true;
    }
    return false;
  }
583232
function walk(node, rootNode, prev) {
      var sibling, parent, startName = prev ? 'lastChild' : 'firstChild', siblingName = prev ? 'prev' : 'next';

      // Walk into nodes if it has a start
      if (node[startName]) {
        return node[startName];
      }

      // Return the sibling if it has one
      if (node !== rootNode) {
        sibling = node[siblingName];

        if (sibling) {
          return sibling;
        }

        // Walk up the parents to look for siblings
        for (parent = node.parent; parent && parent !== rootNode; parent = parent.parent) {
          sibling = parent[siblingName];

          if (sibling) {
            return sibling;
          }
        }
      }
    }
631705
function insertTo(root, node, before) {
  if (!root) return
  root.insertBefore(before, node)
  root.removeChild(node)
}
431043
private void addFirstChildElements() {
		for (Node node : nodes) {
			Index index = helper.getIndexInParent(node, false);
			if (index.index == 0)
				result.add(node);
		}
	}
1205821
public void gotoEnd() {
	currentNode = tree;
	while (currentNode.hasChildren()) {
	    currentNode = currentNode.getChildren().get(
		    currentNode.getChildren().size() - 1);
	}
    }