*/
public static ThriftTaskInProgressList toThrift(TaskInProgress[] tasks,
JobTracker tracker,
int fromIdx,
int toIdx) {
ThriftTaskInProgressList ret = new ThriftTaskInProgressList();
if (toIdx > tasks.length)
toIdx = tasks.length;
if (fromIdx > toIdx) {
assert false; // Internal callers should not pass in bogus args
fromIdx = toIdx;
}
ArrayList<ThriftTaskInProgress> taskArr = new
ArrayList<ThriftTaskInProgress>(toIdx - fromIdx);
for (int i = fromIdx; i < toIdx; ++i)
taskArr.add(toThrift(tasks[i], tracker));
ret.setTasks(taskArr);
ret.setNumTotalTasks(tasks.length);
return ret;
}