Apply Iterator & Vistor pattern to support iterate the tree and operate on each node of tree