package market.Mes.MaterielTrack.vo;

import java.util.ArrayList;
import java.util.List;



public class Proc_Tree {

	/*
	 * prc_materiel_process 物料进程表
	 * PRC_MATERIEL_RELATION  物料关系表
	 */
	 int h_pad = 2;
     int height = 45;
     int w_pad = 5;
     int width = 110;

      String id;
      Boolean highLight=false;
      int c_Top=0;
     //serial_no  object_no prc_code prc_code_desc create_time   remark
     public List<PrcMaterielProcess> self= null; //prc_materiel_process 物料进程表
     
     public List<Proc_Tree> children=null;
     
     
     public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public List<PrcMaterielProcess> getSelf() {
		return self;
	}

	public void setSelf(List<PrcMaterielProcess> self) {
		this.self = self;
	}

	public List<Proc_Tree> getChildren() {
		return children;
	}

	public void setChildren(List<Proc_Tree> children) {
		this.children = children;
	}

	public int getH_pad() {
		return h_pad;
	}

	public void setH_pad(int h_pad) {
		this.h_pad = h_pad;
	}

	public int getHeight() {
		return height;
	}

	public void setHeight(int height) {
		this.height = height;
	}

	public int getW_pad() {
		return w_pad;
	}

	public void setW_pad(int w_pad) {
		this.w_pad = w_pad;
	}

	public int getWidth() {
		return width;
	}

	public void setWidth(int width) {
		this.width = width;
	}


	public Boolean getHighLight() {
		return highLight;
	}

	public void setHighLight(Boolean highLight) {
		this.highLight = highLight;
	}

	public int getC_Top() {
		return c_Top;
	}

	public void setC_Top(int c_Top) {
		this.c_Top = c_Top;
	}



	public Proc_Tree()
     {
         self = new ArrayList<PrcMaterielProcess>();
         children = new ArrayList<Proc_Tree>();

         c_Top = 0;
     }

     public Proc_Tree(String PlateNo)
     {
         id = PlateNo;

         self = new ArrayList<PrcMaterielProcess>();
         children = new ArrayList<Proc_Tree>();

         c_Top = 0;
     }

     public void CalcMaxDepth()
     {
         CalcMaxDepth(0);
     }

     public int CalcMaxDepth(int top)
     {
         int _tmpTop = top;

         if (children == null || children.size() <= 0)
         {
             _tmpTop = top + h_pad + height;
             c_Top = top + h_pad;
         }
         else
         {
             for (int iter = 0; iter < children.size(); iter++)
             {
                 _tmpTop = children.get(iter).CalcMaxDepth(_tmpTop);
             }
             c_Top = (children.get(0).c_Top + children.get(children.size() - 1).c_Top) / 2;
         }
         return _tmpTop;
     }
     
}
