def _buildTree(self, weights, candidates):
intervals = []<EOL>total = <NUM_LIT:0.0><EOL>for i in range(<NUM_LIT:0>, len(weights)) :<EOL><INDENT>weight = weights[i]<EOL>obj = candidates[i]<EOL>start = total<EOL>end = total + weight<EOL>intervals.append(WeightedRandom.Interval(start, end, obj))<EOL>total = total + weight<EOL><DEDENT>return IntervalTree(intervals)<EOL>
@summary: build interval tree from cumulative weights