标签:pass zha debug null adt import min thread log
package cn.firstflag.crm.service; import jxl.common.Logger; /** * * @author zhanmin.zheng * */ public class ThreadTree { private Logger log = Logger.getLogger(getClass()); private Integer childFlag = 0; private Integer threadFlag = 1; public class Node <T> { private T data; private Integer leftFlag = childFlag; private Integer rightFlag = childFlag; private Node leftChildren; private Node rightChildren; public Node() { super(); } public Node(T data) { super(); this.data = data; } } static Node pre = null; public void create(Node node) { if (node == null) return; if (node.leftChildren == null) { node.leftFlag = 1; } if (node.rightChildren == null) { node.rightFlag = 1; } if (node.leftFlag == 1) { node.leftChildren = pre; } if (pre != null && pre.rightFlag ==1) { pre.rightChildren = node; } pre = node; create(node.leftChildren); create(node.rightChildren); } public Node foreach(Node node) { while (node.leftFlag == 1) { node = node.leftChildren; } while (node.rightFlag == 1) { log.debug("pass " + node.data); node =node.rightChildren; } return node; } }
标签:pass zha debug null adt import min thread log
原文地址:http://www.cnblogs.com/sz-zzm/p/6110506.html