/*
解析UMI对应的节点
@param  {_$$Node}  根节点
@param  {String}   UMI值
@param  {Function} 解析过程处理函数
@return {_$$Node}  对应节点
504606
function(_root,_umi,_hanlder){
        var _node = _root,
            _hanlder = _hanlder||_f;
        if (_umi!='/'){
            _u._$forEach(
                _umi.split('/'),function(_name){
                    var _result = _hanlder(_node,_name);
                    if (!_result) 
                        return !0;
                    _node = _result;
                }
            );
        }
        return _node;
    }
946466
function (node) {
      let currentNode = node;
      let i;
      let j;
      let k;
      let l;
      // Get the component path
      const componentPath = [];
      while (currentNode) {
        if (currentNode.property && currentNode.property.type === 'Identifier') {
          componentPath.push(currentNode.property.name);
        }
        if (currentNode.object && currentNode.object.type === 'Identifier') {
          componentPath.push(currentNode.object.name);
        }
        currentNode = currentNode.object;
      }
      componentPath.reverse();

      // Find the variable in the current scope
      const variableName = componentPath.shift();
      if (!variableName) {
        return null;
      }
      let variableInScope;
      const variables = context.getScope().variables;
      for (i = 0, j = variables.length; i < j; i++) { // eslint-disable-line no-plusplus
        if (variables[i].name === variableName) {
          variableInScope = variables[i];
          break;
        }
      }
      if (!variableInScope) {
        return null;
      }

      // Find the variable declaration
      let defInScope;
      const defs = variableInScope.defs;
      for (i = 0, j = defs.length; i < j; i++) { // eslint-disable-line no-plusplus
        if (
          defs[i].type === 'ClassName' ||
          defs[i].type === 'FunctionName' ||
          defs[i].type === 'Variable'
        ) {
          defInScope = defs[i];
          break;
        }
      }
      if (!defInScope) {
        return null;
      }
      currentNode = defInScope.node.init || defInScope.node;

      // Traverse the node properties to the component declaration
      for (i = 0, j = componentPath.length; i < j; i++) { // eslint-disable-line no-plusplus
        if (!currentNode.properties) {
          continue; // eslint-disable-line no-continue
        }
        for (k = 0, l = currentNode.properties.length; k < l; k++) { // eslint-disable-line no-plusplus, max-len
          if (currentNode.properties[k].key.name === componentPath[i]) {
            currentNode = currentNode.properties[k];
            break;
          }
        }
        if (!currentNode) {
          return null;
        }
        currentNode = currentNode.value;
      }

      // Return the component
      return components.get(currentNode);
    }
969060
private V findSmallest(Node node) {
        if (node == null) {
            return null;
        }

        while (node.left != null) {
            node = node.left;
        }

        return node.item;
    }
422994
function stringifyNode(node)
{
	var result = "<"+node.nodeName;
	var numAttrs = node.attrs.length;
	
	for (var i=0; i<numAttrs; i++)
	{
		result += " "+ node.attrs[i].name +'="'+ node.attrs[i].value +'"';
	}
	
	result += ">";
	
	return result;
}
93130
protected function getVNodeValue($node)
    {
        // for cell types having a "v" tag containing the value.
        // if not, the returned value should be empty string.
        $vNode = $node->getElementsByTagName(self::XML_NODE_VALUE)->item(0);
        return ($vNode !== null) ? $vNode->nodeValue : '';
    }
448645
public static org.jdom2.Element convert(org.w3c.dom.Element node)
	{
		if (node == null)
			return null; // Convert null->null

		DOMBuilder builder = new DOMBuilder();

		return builder.build(node);
	}
980115
function nodeStream(node) {
    var result = [];
    (function (node, offset) {
      for (var i = 0; i < node.childNodes.length; i++) {
        if (node.childNodes[i].nodeType == 3)
          offset += node.childNodes[i].nodeValue.length;
        else if (node.childNodes[i].nodeName == 'BR')
          offset += 1;
        else if (node.childNodes[i].nodeType == 1) {
          result.push({
            event: 'start',
            offset: offset,
            node: node.childNodes[i]
          });
          offset = arguments.callee(node.childNodes[i], offset);
          result.push({
            event: 'stop',
            offset: offset,
            node: node.childNodes[i]
          });
        }
      }
      return offset;
    })(node, 0);
    return result;
  }
535350
function wrapper(node, schema) {

    // NODES['*'] = xtend(NODES['*'], schema.NODES['*']);
    // delete schema.NODES;

    var ctx = {type: 'root', children: []}
    var replace

    if (!node || typeof node !== 'object' || !node.type) {
        return ctx
    }

    replace = one(xtend(defaults, schema || {}), node, [])

    if (!replace) {
        return ctx
    }

    if ('length' in replace) {
        if (replace.length === 1) {
            return replace[0]
        }

        ctx.children = replace

        return ctx
    }

    return replace
}
624925
function(node) {
			var label = node.name;
			//include id if present
			var match = /id=['"]\S*["']/.exec(node.raw); //$NON-NLS-0$
			if (match) {
				label = label + " " + match[0]; //$NON-NLS-0$
			}
			//include class if present
			match = /class=['"]\S*["']/.exec(node.raw); //$NON-NLS-0$
			if (match) {
				label = label + " " + match[0]; //$NON-NLS-0$
			}
			return label;
		}
969100
function node(either) {
		var theNode = either;
		if (typeof(either) === "string") { //$NON-NLS-0$
			theNode = document.getElementById(either);
		}	
		return theNode;
	}
1223244
function getStack(node, uri) {
	var path = uri;
	while (node && node.parent && node.file) {
		path += ('-->' + node.file);
		if (node.file == uri) {
			break;
		}
		node = node.parent;

	}
	return path;
}
1218733
function preload(node) {
        var self = arguments.callee;
        if (node && node.nodeType === 1) {
            var $preload = $('preload', node),
                len = $preload.length;
            while (len--) {
                var tmpNode = $preload[len],
                    dataset = tmpNode.dataset,
                    type = dataset.type,
                    url = dataset.url;
                var fn = preloadFn['load' + type.toUpperCase()];
                typeof fn === 'function' && fn(url, function(tmpNode) {
                    return function() {
                        //将该标签删除，释放内存
                        tmpNode.parentNode && tmpNode.parentNode.removeChild(tmpNode);
                        tmpNode = null;
                    };
                }(tmpNode));
            }
        }
        return self;
    }
1004001
function getIENodeHash(node) {
  if (node && node.nodeType > 0) {
    switch (node.nodeType) {
      case 1: // Element
        return node.uniqueID;
      case 9: // Document
        return node.documentElement && node.documentElement.uniqueID;
    }
  }
}
841264
function getBytes(node) {
    var text = getText(node);
    return text ? ByteUtils.arrayToBuffer(ByteUtils.base64ToBytes(text)) : undefined;
}
8438
function getAttribute(node, key) {
    var map = attrMap[key];
    if (map) return typeof map === "function" ? map(node) : node[map];
    if (checkAttributes) {
      return node.getAttribute(key);
    }
    var attrNode = node.getAttributeNode(key);
    // 对于selected checked 当返回为bool值时  将其标准化为 selected = "selected"
    // 方便后续处理
    // 很多时候null可以作为标志位，nes中大部分特殊flag都用null标示
    return typeof node[key] === "boolean" 
            ? node[key] ? key : null
            : (attrNode && attrNode.specified ?attrNode.value : null);
  }
913739
function (node, options, recursive) {
			options = (options)? options : {};

			// recursive calls
		    if (recursive === undefined) {
		        if (node.parentNode && node.nodeName !== 'HTML'){
		            return this.getParentTreeWalk(node.parentNode, options, true);
				}else{
		            return this.formatEmpty();
				}
		    }
		    if (node !== null && node !== undefined && node.parentNode) {
		        if (this.isMicroformat( node, options )) {
					// if we have a match return microformat
					options.node = node;
		            return this.get( options );
		        }else{
		            return this.getParentTreeWalk(node.parentNode, options, true);
		        }
		    }else{
		        return this.formatEmpty();
		    }
		}
214454
public static Character convertChar(JsonNode node) {
        if (node instanceof POJONode) {
            return convertChar(DPathUtils.extractValue((POJONode) node));
        }
        return node.isNumber() ? (char) node.asInt()
                : node.isTextual() ? (node.asText().length() > 0 ? node.asText().charAt(0) : 0) : 0;
    }