19 package ca.uqac.lif.synthia.tree;
21 import java.util.ArrayList;
22 import java.util.List;
65 System.out.println(
"Height " + target_height);
66 List<Node<T>> list =
new ArrayList<Node<T>>(1);
68 populate(list, 0, target_height - 1, 1);
72 protected void populate(List<
Node<T>> list,
int child_index,
int target_height,
int current_height)
74 if (list.isEmpty() || target_height == 0)
78 for (
int i = 0; i < list.size(); i++)
87 }
while (degree == 0);
88 int new_child_index = (int) Math.floor(
m_child.
pick() * (float) degree);
89 for (
int j = 0; j < degree; j++)
98 int new_child_index = (int) Math.floor(
m_child.
pick() * (float) degree);
99 int new_height = Math.min(target_height, Math.max(0,
m_totalHeight.
pick() - current_height));
100 for (
int j = 0; j < degree; j++)